ppc 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ppc.rb +1 -1
- data/lib/ppc/api.rb +2 -1
- data/lib/ppc/api/baidu/keyword.rb +14 -0
- data/lib/ppc/api/qihu.rb +1 -0
- data/lib/ppc/operation/account.rb +4 -0
- data/lib/ppc/operation/group.rb +4 -0
- data/lib/ppc/operation/plan.rb +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb284288f99cec5c5170ca7be5ed1d1905794f8b
|
4
|
+
data.tar.gz: c49847b4b734897d5e4358fed6d9b2bed226dd9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd447a7473731993f10ca59449c25bfd3142043f480fdfe7566a729236aefce86d03bba22c268b15c74b2b0645fef8011ccf61a436e5d47f68029a3c5fafc191
|
7
|
+
data.tar.gz: 57c25853c560096966e8541907c1b65afd46fbf5dc6b27f58258057106356134cbd6db260ea4532b44e9705ae54bb40a58c1207943759d20698127cf36b4f963
|
data/lib/ppc.rb
CHANGED
data/lib/ppc/api.rb
CHANGED
@@ -62,7 +62,8 @@ module PPC
|
|
62
62
|
else
|
63
63
|
response = http.post(uri.path, http_body, http_header)
|
64
64
|
end
|
65
|
-
begin
|
65
|
+
qihu_quota = begin response.to_hash["quotaremain"][0].to_i rescue nil end
|
66
|
+
begin JSON.parse(response.body).merge(qihu_quota: qihu_quota) rescue response.body end
|
66
67
|
end
|
67
68
|
|
68
69
|
def process( response, key, &func)
|
@@ -105,6 +105,20 @@ module PPC
|
|
105
105
|
process(response, 'groupKeywords' ){|x| reverse_type( x , KeywordQualityType) }
|
106
106
|
end
|
107
107
|
|
108
|
+
def self.search( auth, params )
|
109
|
+
body = {
|
110
|
+
searchWord: params[:keyword],
|
111
|
+
startNum: 1,
|
112
|
+
endNum: 1000,
|
113
|
+
searchLevel: 2,
|
114
|
+
searchType: 1,
|
115
|
+
}
|
116
|
+
body.merge!(campaignId: params[:plan_id]) if params[:plan_id]
|
117
|
+
body.merge!(adgroupId: params[:group_id]) if params[:group_id]
|
118
|
+
response = request( auth, "Search", 'getMaterialInfoBySearch', body )
|
119
|
+
process(response, 'materialSearchInfos' ){|x| x[0]["materialSearchInfos"].map{|tmp| tmp["materialInfos"]} }
|
120
|
+
end
|
121
|
+
|
108
122
|
end # keyword
|
109
123
|
end # Baidu
|
110
124
|
end # API
|
data/lib/ppc/api/qihu.rb
CHANGED
@@ -38,6 +38,7 @@ module PPC
|
|
38
38
|
result[:failure] = response['failures'] || response["failure_key"]
|
39
39
|
result[:result] = (key.empty? ? func[response] : func[response[key]]) rescue nil
|
40
40
|
result[:no_quota] = (response['failures']['code'] == '90401') rescue false
|
41
|
+
result[:rquota] = response[:qihu_quota] rescue 0
|
41
42
|
result
|
42
43
|
end
|
43
44
|
|
data/lib/ppc/operation/group.rb
CHANGED
@@ -44,6 +44,10 @@ module PPC
|
|
44
44
|
def add_creative( creatives )
|
45
45
|
call( "creative" ).add( @auth, creatives.map{|creative| creative.merge(group_id: @id)} )
|
46
46
|
end
|
47
|
+
|
48
|
+
def search_keyword( keyword )
|
49
|
+
call( "keyword" ).search( @auth, {group_id: @id, keyword: keyword})
|
50
|
+
end
|
47
51
|
|
48
52
|
end # Group
|
49
53
|
end # Operation
|
data/lib/ppc/operation/plan.rb
CHANGED
@@ -53,6 +53,9 @@ module PPC
|
|
53
53
|
call( "group" ).add( @auth, groups.map{|group| group.merge(plan_id: @id)} )
|
54
54
|
end
|
55
55
|
|
56
|
+
def search_keyword( keyword )
|
57
|
+
call( "keyword" ).search( @auth, {plan_id: @id, keyword: keyword})
|
58
|
+
end
|
56
59
|
|
57
60
|
end # class plan
|
58
61
|
end # mudole Opeartion
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ppc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chienli Ma
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httparty
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.
|
204
|
+
rubygems_version: 2.6.10
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: ppc api for baidu qihu sogou sm
|