ppc 2.0.2 → 2.0.3
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 +4 -4
- data/README.md +11 -9
- data/lib/ppc/api/baidu/account.rb +1 -0
- data/lib/ppc/api/baidu/report.rb +26 -1
- data/lib/ppc/api/sm/report.rb +24 -0
- data/lib/ppc/api/sogou/report.rb +22 -0
- data/lib/ppc/operation/report.rb +12 -0
- data/lib/ppc.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: 644d36e63a1131b4c40e51a9774a8fc3fcdce623
|
4
|
+
data.tar.gz: ec46a7efe0d2740a765e9bc2a13f6417bff8a439
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9126d0b364445da25d82be3ae6fb14a4c1741d90f461d8d1826ff299d0d225f4f61c6f3291e3a0b91159c52ccbe6691ed913fa1294d352e5fcaf514be54134ee
|
7
|
+
data.tar.gz: 4097196b9a88796223fe0f830053630fdbb284941f2c4f060999840daaad1959571c0ee7fd64979c2ad979843e938ac21de029d13977ecd835d367ee5d7a91a6
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ ppc
|
|
10
10
|
#How to use it ?
|
11
11
|
|
12
12
|
### Create an objects:
|
13
|
-
|
13
|
+
```ruby
|
14
14
|
param = {
|
15
15
|
se: 'baidu', # baidu,qihu,sogou,sm
|
16
16
|
username: 'username',
|
@@ -32,17 +32,18 @@ ppc
|
|
32
32
|
group = ::PPC::Operaion::Group.new(param)
|
33
33
|
creative = ::PPC::Operaion::Creative.new(param)
|
34
34
|
keyword = ::PPC::Operaion::Keyword.new(param)
|
35
|
-
|
35
|
+
```
|
36
36
|
###Get objects info:
|
37
|
-
|
37
|
+
```ruby
|
38
38
|
# get info
|
39
39
|
account.info[:result]
|
40
40
|
plan.info[:result]
|
41
41
|
group.info[:result]
|
42
42
|
creative.info[:result]
|
43
43
|
keyword.info[:result]
|
44
|
-
|
44
|
+
```
|
45
45
|
###Add keywords:
|
46
|
+
```ruby
|
46
47
|
keyword1 = { keyword: 'ppc1', group_id: 123, price:0.6, match_type:'wide'}
|
47
48
|
keyword2 = { keyword: 'ppc2', group_id: 123, price:0.6, match_type:'phrase'}
|
48
49
|
keyword3 = { keyword: 'ppc3', group_id: 123, price:0.6, match_type:'exact'}
|
@@ -50,19 +51,20 @@ ppc
|
|
50
51
|
account.add_keyword( [keyword1, keyword2, keyword3] )
|
51
52
|
plan.add_keyword( [keyword1, keyword2, keyword3] )
|
52
53
|
group.add_keyword( [keyword1, keyword2, keyword3] )
|
53
|
-
|
54
|
+
```
|
54
55
|
###Delete keywords
|
56
|
+
```ruby
|
55
57
|
account.delete_keyword( [123, 234, 345] )
|
56
58
|
plan.delete_keyword( [123, 234, 345] )
|
57
59
|
adgroup.delete_keyword( [123, 234, 345] )
|
58
|
-
|
60
|
+
```
|
59
61
|
-----------------------------------------------
|
60
62
|
|
61
63
|
#API:
|
62
64
|
|
63
65
|
### Return values:
|
64
66
|
All mehtods return a hash:
|
65
|
-
|
67
|
+
|
66
68
|
{
|
67
69
|
succ: boolean, # true if operation success else false
|
68
70
|
failure: Array, # failures info if operation false, else nil
|
@@ -74,7 +76,7 @@ All mehtods return a hash:
|
|
74
76
|
###API casting:
|
75
77
|
In each service class ::PPC::API::#{SE}::#{Service} there is a member map casting PPC API to Search engine Service API,
|
76
78
|
For example:
|
77
|
-
|
79
|
+
```ruby
|
78
80
|
::PPC::API::Baidu::Keyword.map = [
|
79
81
|
[:id,:keywordId],
|
80
82
|
[:group_id,:adgroupId],
|
@@ -87,7 +89,7 @@ For example:
|
|
87
89
|
[:status,:status],
|
88
90
|
[:pause,:pause]
|
89
91
|
]
|
90
|
-
|
92
|
+
```
|
91
93
|
ppc API keys are at the left side while search engine API keys are at the right side.
|
92
94
|
|
93
95
|
For more info please have a look into files in /ppc/api/
|
data/lib/ppc/api/baidu/report.rb
CHANGED
@@ -65,6 +65,7 @@ module PPC
|
|
65
65
|
requesttype[:idOnly] = param[:id_only] || false
|
66
66
|
requesttype[:startDate] = Time.parse( param[:startDate] ) rescue Time.now - 86400
|
67
67
|
requesttype[:endDate] = Time.parse( param[:endDate] ) rescue Time.now - 86400
|
68
|
+
requesttype[:statIds] = param[:statIds] if param[:statIds]
|
68
69
|
requesttype
|
69
70
|
end
|
70
71
|
|
@@ -97,7 +98,31 @@ module PPC
|
|
97
98
|
param[:unit] ||= 'day'
|
98
99
|
download_report( auth, param, debug )
|
99
100
|
end
|
100
|
-
|
101
|
+
|
102
|
+
def self.account_report( auth, param = {}, debug = false )
|
103
|
+
param[:type] ||= 'account'
|
104
|
+
param[:fields] ||= %w(impression click cpc cost ctr cpm conversion)
|
105
|
+
param[:level] ||= 'account'
|
106
|
+
param[:unit] ||= 'day'
|
107
|
+
download_report( auth, param, debug )
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.plan_report( auth, param = {}, debug = false )
|
111
|
+
param[:type] ||= 'plan'
|
112
|
+
param[:fields] ||= %w(impression click cpc cost ctr cpm conversion)
|
113
|
+
param[:level] ||= 'plan'
|
114
|
+
param[:unit] ||= 'day'
|
115
|
+
download_report( auth, param, debug )
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.group_report( auth, param = {}, debug = false )
|
119
|
+
param[:type] ||= 'group'
|
120
|
+
param[:fields] ||= %w(impression click cpc cost ctr cpm conversion)
|
121
|
+
param[:level] ||= 'group'
|
122
|
+
param[:unit] ||= 'day'
|
123
|
+
download_report( auth, param, debug )
|
124
|
+
end
|
125
|
+
|
101
126
|
def self.download_report( auth, param, debug = false )
|
102
127
|
p param
|
103
128
|
response = get_id( auth, param )
|
data/lib/ppc/api/sm/report.rb
CHANGED
@@ -94,6 +94,30 @@ module PPC
|
|
94
94
|
download_report( auth, param, debug )
|
95
95
|
end
|
96
96
|
|
97
|
+
def self.account_report( auth, param = {}, debug = false )
|
98
|
+
param[:type] ||= 'account'
|
99
|
+
param[:fields] ||= %w(click impression cost cpc ctr)
|
100
|
+
param[:range] ||= 'account'
|
101
|
+
param[:unit] ||= 'day'
|
102
|
+
download_report( auth, param, debug )
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.plan_report( auth, param = {}, debug = false )
|
106
|
+
param[:type] ||= 'plan'
|
107
|
+
param[:fields] ||= %w(click impression cost cpc ctr)
|
108
|
+
param[:range] ||= 'plan'
|
109
|
+
param[:unit] ||= 'day'
|
110
|
+
download_report( auth, param, debug )
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.group_report( auth, param = {}, debug = false )
|
114
|
+
param[:type] ||= 'group'
|
115
|
+
param[:fields] ||= %w(click impression cost cpc ctr)
|
116
|
+
param[:range] ||= 'group'
|
117
|
+
param[:unit] ||= 'day'
|
118
|
+
download_report( auth, param, debug )
|
119
|
+
end
|
120
|
+
|
97
121
|
def self.download_report( auth, param, debug = false )
|
98
122
|
response = get_id( auth, param )
|
99
123
|
if response[:succ]
|
data/lib/ppc/api/sogou/report.rb
CHANGED
@@ -57,6 +57,7 @@ module PPC
|
|
57
57
|
requesttype[:idOnly] = param[:id_only] if param[:id_only]!=nil
|
58
58
|
requesttype[:startDate] = (Time.parse( param[:startDate] ) rescue Time.now - 86400).utc.iso8601
|
59
59
|
requesttype[:endDate] = (Time.parse( param[:endDate] ) rescue Time.now - 86400).utc.iso8601
|
60
|
+
requesttype[:statIds] = param[:statIds] if param[:statIds]
|
60
61
|
return requesttype
|
61
62
|
end
|
62
63
|
|
@@ -105,6 +106,27 @@ module PPC
|
|
105
106
|
download_report( auth, param, debug )
|
106
107
|
end
|
107
108
|
|
109
|
+
def self.account_report( auth, param = {}, debug = false )
|
110
|
+
param[:type] ||= 'account'
|
111
|
+
param[:fields] ||= %w( cost cpc click impression ctr )
|
112
|
+
param[:range] ||= 'account'
|
113
|
+
download_report( auth, param, debug )
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.plan_report( auth, param = {}, debug = false )
|
117
|
+
param[:type] ||= 'plan'
|
118
|
+
param[:fields] ||= %w( cost cpc click impression ctr )
|
119
|
+
param[:range] ||= 'plan'
|
120
|
+
download_report( auth, param, debug )
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.group_report( auth, param = {}, debug = false )
|
124
|
+
param[:type] ||= 'group'
|
125
|
+
param[:fields] ||= %w( cost cpc click impression ctr)
|
126
|
+
param[:range] ||= 'group'
|
127
|
+
download_report( auth, param, debug )
|
128
|
+
end
|
129
|
+
|
108
130
|
end # Repost
|
109
131
|
end # Baidu
|
110
132
|
end # API
|
data/lib/ppc/operation/report.rb
CHANGED
@@ -18,6 +18,18 @@ module PPC
|
|
18
18
|
call( "report" ).keyword_report( @auth, param, debug )
|
19
19
|
end
|
20
20
|
|
21
|
+
def account_report( param = {}, debug = false )
|
22
|
+
call( "report" ).account_report( @auth, param, debug )
|
23
|
+
end
|
24
|
+
|
25
|
+
def plan_report( param = {}, debug = false )
|
26
|
+
call( "report" ).plan_report( @auth, param, debug )
|
27
|
+
end
|
28
|
+
|
29
|
+
def group_report( param = {}, debug = false )
|
30
|
+
call( "report" ).group_report( @auth, param, debug )
|
31
|
+
end
|
32
|
+
|
21
33
|
def rank_report( device = 0, debug = false )
|
22
34
|
call( "bulk" ).rank_report( @auth, device, debug)
|
23
35
|
end
|
data/lib/ppc.rb
CHANGED
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.3
|
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: 2016-
|
14
|
+
date: 2016-10-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httparty
|