qihu360 0.3.13 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 353747a5058845779716e79a0b433d655d8bf1cc
4
- data.tar.gz: 1c31e5245c86462a1f151c22de9606d37949ef47
3
+ metadata.gz: 1dd5017488ec22ca95132048253c31b8c012a742
4
+ data.tar.gz: 5b4292e94a7403b5e430c54468129ceff799bbda
5
5
  SHA512:
6
- metadata.gz: 5f63e1f74749787f18a94e66f391a21e876042350a0b46ef3d57f1efb722882f1fb74448c332671092e28b9f6d548b5b0174136ae715835d538e1a2c1134c6a4
7
- data.tar.gz: 133bbc01459a9e07de4e11cd6cd9761733abbe4b7592c1c7ae598777443d3b3347a8bb29433c7625dc0f0cac5223cbf7731fbe74c4ca10a12627482ae77c4d3f
6
+ metadata.gz: c086d2c1376c8f850cf5986e98146aea176b9b4a5f5ae4cadbf67229d3e590f362833a8c292f77f82bc30ead02ffbe6ade839ad21552681c64e1296999273651
7
+ data.tar.gz: d810eb3044043deb3751d84fdb9fa7c930b8be455fcc6445db07e3bdd873ad77b7c1bb5b9d06666b3999709b8acdffc6dc208ac3967bc34f070a84cd8752b91c
data/README.md CHANGED
@@ -40,12 +40,25 @@
40
40
 
41
41
  #### 使用 access token 初始化
42
42
 
43
- auth = Qihu::Auth.new(id:'xxx', secret:'yyy', token:{
44
- :access_token => 'zzz', :refresh_token => 'qqq', :expires_at => 36000
45
- })
46
-
47
- // 或者这样传递 access token
48
- auth.get_token_from_hash(:access_token => 'zzz', :refresh_token => 'qqq', :expires_at => 36000)
43
+ auth = Qihu::Auth.new(id:'xxx', secret:'yyy', token:{
44
+ :access_token => 'zzz', :refresh_token => 'qqq', :expires_at => 36000
45
+ })
46
+
47
+ // 或者这样传递 access token
48
+ auth.get_token_from_hash(:access_token => 'zzz', :refresh_token => 'qqq', :expires_at => 36000)
49
+
50
+ #### 如何刷新 access token
51
+
52
+ auth = Qihu::Auth.new('xxx', 'yyy', token:{
53
+ :access_token => 'mmmm',
54
+ :refresh_token => 'nnnnn',
55
+ :expires_at => 1380050254,
56
+ :expires_in => 36000
57
+ })
58
+
59
+ # 刷新 access token 并返回自身
60
+ auth = auth.refresh_token
61
+
49
62
 
50
63
  ### 调用广告系统接口
51
64
 
@@ -59,6 +72,15 @@
59
72
 
60
73
  # 创建一个计划
61
74
  response = client.campign.add(name:'Beijing', budget:10000)
75
+
76
+ # 更改提交的方法
77
+ response = client.campign.add(name:'Beijing', bugget:20000, method:'get')
78
+
79
+ # 获得返回信息
80
+ status = response.status
81
+ headers = response.headers
82
+ body = response.body
83
+
62
84
 
63
85
  ## 贡献代码
64
86
 
@@ -14,7 +14,7 @@ module Qihu
14
14
  :ssl => {:verify => false},
15
15
  )
16
16
 
17
- if token
17
+ if token or !token.empty?
18
18
  @token = OAuth2::AccessToken.from_hash(@oauth2, token)
19
19
  end
20
20
  end
@@ -43,5 +43,9 @@ module Qihu
43
43
  @token = OAuth2::AccessToken.from_hash(@oauth2, token)
44
44
  return self
45
45
  end
46
+
47
+ def refresh_token
48
+ @token.refresh!
49
+ end
46
50
  end
47
51
  end
@@ -7,8 +7,6 @@ module Qihu
7
7
  end
8
8
 
9
9
  def method_missing(name, *args, &block)
10
- require 'pp'
11
-
12
10
  if name.match(/_/)
13
11
  name = name.to_s.split('_').each_with_index.map{|k, i| (i > 0) ? k.capitalize : k}.join("")
14
12
  end
@@ -1,3 +1,3 @@
1
1
  module Qihu
2
- VERSION = "0.3.13"
2
+ VERSION = "0.3.15"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qihu360
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-05 00:00:00.000000000 Z
11
+ date: 2013-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler