e360-tuiguang 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/e360/tuiguang.rb +5 -6
- data/lib/e360/tuiguang/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc059f49c35cff34cf3010be609b9e80d4445d22
|
4
|
+
data.tar.gz: 835c7716260bad6ec2163b3027a6493988674275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c739f0be44714ff7dfbf956f2bdc5ad1ce564f5408e88f149fd38e0756afeab08880f69ae8a1e94811763537a024b4a77f8f6272ab9fb820c03dcbfb225a4e1
|
7
|
+
data.tar.gz: 4a8b83db028ff74e9fa8d81056be70569a7d04aaba555be176d1dea864b9cf38ed81ad8a638d6eb8748414d38594b3915cfcd90ee04aaab199bba8e2f51af7dd
|
data/lib/e360/tuiguang.rb
CHANGED
@@ -142,7 +142,9 @@ module E360
|
|
142
142
|
def keywords_pause_and_enable(keyword_ids = [], pause = true)
|
143
143
|
params = {oper_type: pause ? -5 : 1, json: 1}
|
144
144
|
oper_id = {}
|
145
|
-
keyword_ids.map{|keyword_id|
|
145
|
+
keyword_ids.map {|keyword_id|
|
146
|
+
oper_id[keyword_id.to_s] = ''
|
147
|
+
}
|
146
148
|
params[:oper_id] = oper_id.to_json
|
147
149
|
result = ajax_request('http://dianjing.e.360.cn/keyword/upallstatus', params)
|
148
150
|
result['status'] && result['msg'] == '修改成功'
|
@@ -202,10 +204,7 @@ module E360
|
|
202
204
|
end
|
203
205
|
|
204
206
|
def ajax_request(url, params = {})
|
205
|
-
|
206
|
-
data = params.to_a if params.is_a?(Hash)
|
207
|
-
data << ['token', @token]
|
208
|
-
data << ['expire_times', @expire_times]
|
207
|
+
params.merge!(token: @token, expire_times: @expire_times)
|
209
208
|
url = URI(@url = url)
|
210
209
|
http = Net::HTTP.new(url.host, url.port)
|
211
210
|
request = Net::HTTP::Post.new(url)
|
@@ -225,7 +224,7 @@ module E360
|
|
225
224
|
request["token"] = @token
|
226
225
|
request["user-agent"] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'
|
227
226
|
request["x-requested-with"] = 'XMLHttpRequest'
|
228
|
-
request.set_form_data(@params =
|
227
|
+
request.set_form_data(@params = params)
|
229
228
|
response = http.request(request)
|
230
229
|
puts "Redirection: #{response['location']}" if response.is_a?(Net::HTTPRedirection)
|
231
230
|
raise TokenExpired if response.is_a?(Net::HTTPRedirection) && response['location'] == 'http://dianjing.e.360.cn/forbidden/'
|