qihu360 0.3.13 → 0.3.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -6
- data/lib/qihu/auth.rb +5 -1
- data/lib/qihu/dianjing/api/base.rb +0 -2
- data/lib/qihu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dd5017488ec22ca95132048253c31b8c012a742
|
4
|
+
data.tar.gz: 5b4292e94a7403b5e430c54468129ceff799bbda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
|
data/lib/qihu/auth.rb
CHANGED
@@ -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
|
data/lib/qihu/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|