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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bdc98be1e89c0a0319d0b93f41738cd6838cf628
4
- data.tar.gz: 8b8420fc0e8d9e7d1558f4611c893b949e3feafe
3
+ metadata.gz: dc059f49c35cff34cf3010be609b9e80d4445d22
4
+ data.tar.gz: 835c7716260bad6ec2163b3027a6493988674275
5
5
  SHA512:
6
- metadata.gz: 05e4e960d2c87b19e224c9b451f7e49f151e59cf5fda4251a6510640e230a872432e64c1ea98ce6a67461e9f7b4fd1c3cdfb3b0979d965c4027382c2647baeff
7
- data.tar.gz: 56b0d0457745fe45cb75dffb5cb1cb7c945b14668ae736d20ddf11659e6dab7ac9670cb02e9781a29448ba0e0118f3e6b171f48469d2ffaf06ae5746e2435254
6
+ metadata.gz: 8c739f0be44714ff7dfbf956f2bdc5ad1ce564f5408e88f149fd38e0756afeab08880f69ae8a1e94811763537a024b4a77f8f6272ab9fb820c03dcbfb225a4e1
7
+ data.tar.gz: 4a8b83db028ff74e9fa8d81056be70569a7d04aaba555be176d1dea864b9cf38ed81ad8a638d6eb8748414d38594b3915cfcd90ee04aaab199bba8e2f51af7dd
@@ -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| oper_id[keyword_id.to_s] = ''}
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
- data = params
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 = data)
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/'
@@ -1,5 +1,5 @@
1
1
  module E360
2
2
  module Tuiguang
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e360-tuiguang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Jie