ppc 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/LICENSE +334 -17
- data/README.md +75 -3
- data/lib/ppc.rb +3 -1
- data/lib/ppc/api.rb +137 -2
- data/lib/ppc/api/baidu.rb +20 -99
- data/lib/ppc/api/baidu/account.rb +21 -21
- data/lib/ppc/api/baidu/bulk.rb +39 -3
- data/lib/ppc/api/baidu/creative.rb +33 -33
- data/lib/ppc/api/baidu/group.rb +14 -14
- data/lib/ppc/api/baidu/keyword.rb +57 -46
- data/lib/ppc/api/baidu/phone_new_creative.rb +51 -0
- data/lib/ppc/api/baidu/plan.rb +34 -31
- data/lib/ppc/api/baidu/rank.rb +23 -0
- data/lib/ppc/api/baidu/report.rb +100 -81
- data/lib/ppc/api/qihu.rb +150 -0
- data/lib/ppc/api/qihu/account.rb +86 -0
- data/lib/ppc/api/qihu/bulk.rb +35 -0
- data/lib/ppc/api/qihu/creative.rb +108 -0
- data/lib/ppc/api/qihu/group.rb +96 -0
- data/lib/ppc/api/qihu/keyword.rb +113 -0
- data/lib/ppc/api/qihu/plan.rb +64 -0
- data/lib/ppc/api/qihu/rank.rb +25 -0
- data/lib/ppc/api/qihu/report.rb +159 -0
- data/lib/ppc/api/qihu/sublink.rb +71 -0
- data/lib/ppc/api/shenma.rb +64 -0
- data/lib/ppc/api/shenma/report.rb +135 -0
- data/lib/ppc/api/sm.rb +50 -0
- data/lib/ppc/api/sm/account.rb +44 -0
- data/lib/ppc/api/sm/bulk.rb +69 -0
- data/lib/ppc/api/sm/creative.rb +86 -0
- data/lib/ppc/api/sm/group.rb +94 -0
- data/lib/ppc/api/sm/keyword.rb +132 -0
- data/lib/ppc/api/sm/phone_new_creative.rb +51 -0
- data/lib/ppc/api/sm/plan.rb +63 -0
- data/lib/ppc/api/sm/report.rb +136 -0
- data/lib/ppc/api/sogou.rb +118 -0
- data/lib/ppc/api/sogou/account.rb +42 -0
- data/lib/ppc/api/sogou/bulk.rb +69 -0
- data/lib/ppc/api/sogou/creative.rb +117 -0
- data/lib/ppc/api/sogou/group.rb +123 -0
- data/lib/ppc/api/sogou/keyword.rb +188 -0
- data/lib/ppc/api/sogou/plan.rb +66 -0
- data/lib/ppc/api/sogou/report.rb +129 -0
- data/lib/ppc/ext.rb +17 -0
- data/lib/ppc/operation.rb +50 -36
- data/lib/ppc/operation/account.rb +19 -7
- data/lib/ppc/operation/creative.rb +7 -7
- data/lib/ppc/operation/group.rb +2 -2
- data/lib/ppc/operation/keyword.rb +11 -8
- data/lib/ppc/operation/report.rb +23 -0
- data/ppc.gemspec +14 -4
- data/spec/baidu/api_baidu_account_spec.rb +16 -0
- data/spec/baidu/api_baidu_creative_spec.rb +73 -0
- data/spec/{api_baidu_group_spec.rb → baidu/api_baidu_group_spec.rb} +12 -17
- data/spec/baidu/api_baidu_keyword_spec.rb +61 -0
- data/spec/baidu/api_baidu_phone_spec.rb +22 -0
- data/spec/{api_baidu_plan_spec.rb → baidu/api_baidu_plan_spec.rb} +11 -10
- data/spec/baidu/api_baidu_report_spec.rb +44 -0
- data/spec/{api_baidu_spec.rb → baidu/api_baidu_spec.rb} +10 -15
- data/spec/operation/operation_baidu_report_spec.rb +17 -0
- data/spec/operation/operation_baidu_spec.rb +126 -0
- data/spec/operation/operation_qihu_report_spec.rb +18 -0
- data/spec/operation/operation_qihu_spec.rb +94 -0
- data/spec/operation/operation_sm_report_spec.rb +21 -0
- data/spec/operation/operation_sogou_report_spec.rb +17 -0
- data/spec/operation/operation_sogou_spec.rb +88 -0
- data/spec/{operation_spec_helper.rb → operation/operation_spec_helper.rb} +3 -5
- data/spec/qihu/api_qihu_account_spec.rb +29 -0
- data/spec/qihu/api_qihu_creative_spec.rb +48 -0
- data/spec/qihu/api_qihu_group_spec.rb +40 -0
- data/spec/qihu/api_qihu_keyword_spec.rb +50 -0
- data/spec/qihu/api_qihu_plan_spec.rb +39 -0
- data/spec/qihu/api_qihu_report_spec.rb +54 -0
- data/spec/qihu/api_qihu_sublink_spec.rb +36 -0
- data/spec/sm/api_sm_account_spec.rb +8 -0
- data/spec/sm/api_sm_creative_spec.rb +52 -0
- data/spec/sm/api_sm_group_spec.rb +75 -0
- data/spec/sm/api_sm_keyword_spec.rb +59 -0
- data/spec/sm/api_sm_plan_spec.rb +39 -0
- data/spec/sm/api_sm_report_spec.rb +30 -0
- data/spec/sogou/api_sogou_account_spec.rb +17 -0
- data/spec/sogou/api_sogou_creative_spec.rb +51 -0
- data/spec/sogou/api_sogou_group_spec.rb +50 -0
- data/spec/sogou/api_sogou_keyword_spec.rb +54 -0
- data/spec/sogou/api_sogou_plan_spec.rb +43 -0
- data/spec/sogou/api_sogou_report_spec.rb +51 -0
- data/spec/spec_helper.rb +49 -10
- metadata +140 -46
- data/lib/ppc/baidu.rb +0 -152
- data/lib/ppc/baidu/account.rb +0 -88
- data/lib/ppc/baidu/bulk.rb +0 -52
- data/lib/ppc/baidu/group.rb +0 -99
- data/lib/ppc/baidu/key.rb +0 -38
- data/lib/ppc/baidu/plan.rb +0 -85
- data/lib/ppc/baidu/report.rb +0 -82
- data/spec/api_baidu_account_spec.rb +0 -18
- data/spec/api_baidu_creative_spec.rb +0 -71
- data/spec/api_baidu_keyword_spec.rb +0 -64
- data/spec/api_baidu_report_spec.rb +0 -32
- data/spec/baidu_account_spec.rb +0 -32
- data/spec/baidu_bulk_spec.rb +0 -21
- data/spec/baidu_group_spec.rb +0 -56
- data/spec/baidu_plan_spec.rb +0 -129
- data/spec/baidu_report_spec.rb +0 -24
- data/spec/operation_spec.rb +0 -87
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'time'
|
2
|
+
require_relative 'operation_spec_helper'
|
3
|
+
|
4
|
+
auth = $baidu_auth.merge( se:'baidu' )
|
5
|
+
preparation = ::PPC::API::Baidu::Group::ids( auth )
|
6
|
+
test_plan_id = preparation[:result][0][:plan_id]
|
7
|
+
test_group_id = preparation[:result][0][:group_ids][0]
|
8
|
+
test_keyword_id = 16261990918
|
9
|
+
test_creative_id = 5043421168
|
10
|
+
|
11
|
+
::PPC::API::Baidu::debug_on
|
12
|
+
|
13
|
+
describe ::PPC::Operation::Account do
|
14
|
+
subject{
|
15
|
+
::PPC::Operation::Account.new( auth )
|
16
|
+
}
|
17
|
+
|
18
|
+
it_should_behave_like( "object", {budget:2990})
|
19
|
+
it_should_behave_like( "object parent", 'plan')
|
20
|
+
|
21
|
+
it_should_behave_like( "object operator", 'plan',
|
22
|
+
{name:'operation_test_plan'},
|
23
|
+
{name:'updated_operation_test_plan'})
|
24
|
+
|
25
|
+
it_should_behave_like( "object operator", 'group',
|
26
|
+
{ name:'test_operation_group',
|
27
|
+
plan_id:test_plan_id,
|
28
|
+
price:500 },
|
29
|
+
{name:'updated_operation_test_group'} )
|
30
|
+
|
31
|
+
it_should_behave_like( "object operator", 'keyword',
|
32
|
+
{ keyword:'testKeyword', group_id:test_group_id,
|
33
|
+
match_type:'exact'},
|
34
|
+
{ match_type:'wide'})
|
35
|
+
|
36
|
+
it_should_behave_like( "object operator", 'creative',
|
37
|
+
{
|
38
|
+
group_id: test_group_id,
|
39
|
+
title: 'OperationTestCreative', preference:1,
|
40
|
+
description1:'this is rest',
|
41
|
+
description2:'also is a test',
|
42
|
+
pc_destination:$baidu_domain,
|
43
|
+
pc_display:$baidu_domain
|
44
|
+
},
|
45
|
+
{
|
46
|
+
title:'OperationTestCreative',
|
47
|
+
description1:'this is a updated test',
|
48
|
+
pc_destination:$baidu_domain,
|
49
|
+
mobil_destination:$baidu_domain
|
50
|
+
} )
|
51
|
+
|
52
|
+
# opetation report test
|
53
|
+
it 'can get report' do
|
54
|
+
endDate = ( Time.now-100*3600*24).utc.iso8601
|
55
|
+
startDate =( Time.now-20*3600*24).utc.iso8601
|
56
|
+
pa = { startDate:startDate, endDate:endDate }
|
57
|
+
subject.query_report( pa )
|
58
|
+
subject.keyword_report( pa )
|
59
|
+
subject.creative_report( pa )
|
60
|
+
end
|
61
|
+
|
62
|
+
# bulk job test
|
63
|
+
it "acn download all objs" do
|
64
|
+
subject.download
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe ::PPC::Operation::Plan do
|
69
|
+
# get test subject
|
70
|
+
subject{
|
71
|
+
::PPC::Operation::Plan.new( auth.merge({id:test_plan_id}) )
|
72
|
+
}
|
73
|
+
it_should_behave_like( "object", {budget:2000})
|
74
|
+
it_should_behave_like( "object operator", 'group',
|
75
|
+
{name:'test_operation_group', price:500},
|
76
|
+
{name:'updated_operation_test_group'} )
|
77
|
+
it_should_behave_like( "object parent", 'group')
|
78
|
+
end
|
79
|
+
|
80
|
+
describe ::PPC::Operation::Group do
|
81
|
+
# get test subject
|
82
|
+
subject{
|
83
|
+
::PPC::Operation::Group.new( auth.merge({id:test_group_id}) )
|
84
|
+
}
|
85
|
+
|
86
|
+
it_should_behave_like( "object", {price:200})
|
87
|
+
it_should_behave_like( "object operator", 'keyword',
|
88
|
+
{
|
89
|
+
keyword:'testKeyword', group_id:test_group_id,
|
90
|
+
match_type:'exact'
|
91
|
+
},
|
92
|
+
{ match_type:'wide'})
|
93
|
+
it_should_behave_like( "object parent", 'keyword')
|
94
|
+
end
|
95
|
+
|
96
|
+
describe ::PPC::Operation::Keyword do
|
97
|
+
# keyword subject
|
98
|
+
subject{
|
99
|
+
::PPC::Operation::Keyword.new( auth.merge({id:test_keyword_id}) )
|
100
|
+
}
|
101
|
+
|
102
|
+
it 'can get info' do
|
103
|
+
is_success( subject.info )
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'can update info' do
|
107
|
+
# not implemented
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
describe ::PPC::Operation::Creative do
|
113
|
+
# keyword subject
|
114
|
+
subject{
|
115
|
+
::PPC::Operation::Creative.new( auth.merge({id:test_creative_id}) )
|
116
|
+
}
|
117
|
+
|
118
|
+
it 'can get info' do
|
119
|
+
is_success( subject.info )
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'can update info' do
|
123
|
+
#not implemented
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
auth = $qihu_auth
|
2
|
+
|
3
|
+
describe ::PPC::Operation::Account do
|
4
|
+
subject{
|
5
|
+
::PPC::Operation::Account.new( auth )
|
6
|
+
}
|
7
|
+
# opetation report test
|
8
|
+
it 'can get report' do
|
9
|
+
endDate = ( Time.now-2*3600*24).to_s[0..9].split('-').join
|
10
|
+
startDate =( Time.now-27*3600*24).to_s[0..9].split('-').join
|
11
|
+
|
12
|
+
p "startDate:#{startDate},endDate:#{endDate}"
|
13
|
+
param = {startDate:startDate, endDate:endDate}
|
14
|
+
|
15
|
+
subject.keyword_report( param, true )
|
16
|
+
subject.creative_report( param, true )
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require './operation_spec_helper'
|
2
|
+
|
3
|
+
auth = $qihu_auth
|
4
|
+
|
5
|
+
test_plan_id = 717479502
|
6
|
+
test_group_id = 1203987666
|
7
|
+
test_keyword_id
|
8
|
+
|
9
|
+
describe ::PPC::Operation::Account do
|
10
|
+
subject{
|
11
|
+
::PPC::Operation::Account.new( auth )
|
12
|
+
}
|
13
|
+
|
14
|
+
it_should_behave_like( "object", {budget:2990})
|
15
|
+
|
16
|
+
it_should_behave_like( "object operator", 'plan',
|
17
|
+
{name:'operation_test_plan'},
|
18
|
+
{name:'updated_operation_test_plan'})
|
19
|
+
|
20
|
+
it_should_behave_like( "object operator", 'group',
|
21
|
+
{
|
22
|
+
name:'test_operation_group',
|
23
|
+
plan_id:test_plan_id, price:500
|
24
|
+
},
|
25
|
+
{name:'updated_operation_test_group'} )
|
26
|
+
|
27
|
+
# report test
|
28
|
+
it 'can get report' do
|
29
|
+
endDate = ( Time.now-2*3600*24).to_s[0..9].split('-').join
|
30
|
+
startDate =( Time.now-27*3600*24).to_s[0..9].split('-').join
|
31
|
+
|
32
|
+
param = {startDate:startDate, endDate:endDate}
|
33
|
+
|
34
|
+
subject.keyword_report( param, true )
|
35
|
+
subject.creative_report( param, true )
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe ::PPC::Operation::Plan do
|
40
|
+
# get test subject
|
41
|
+
subject{
|
42
|
+
::PPC::Operation::Plan.new( auth.merge({id:test_plan_id}) )
|
43
|
+
}
|
44
|
+
|
45
|
+
it_should_behave_like( "object", {budget:2000})
|
46
|
+
|
47
|
+
it_should_behave_like( "object operator", 'group',
|
48
|
+
{name:'test_operation_group', price:500},
|
49
|
+
{name:'updated_operation_test_group'} )
|
50
|
+
|
51
|
+
it_should_behave_like( "object parent", 'group')
|
52
|
+
end
|
53
|
+
|
54
|
+
describe ::PPC::Operation::Group do
|
55
|
+
# get test subject
|
56
|
+
subject{
|
57
|
+
::PPC::Operation::Group.new( auth.merge({id:test_group_id}) )
|
58
|
+
}
|
59
|
+
|
60
|
+
it_should_behave_like( "object", {price:200})
|
61
|
+
|
62
|
+
it_should_behave_like( "object operator", 'keyword',
|
63
|
+
{
|
64
|
+
keyword:'testKeyword',
|
65
|
+
group_id:test_group_id, match_type:'exact'
|
66
|
+
},
|
67
|
+
{ match_type:'wide'}
|
68
|
+
)
|
69
|
+
|
70
|
+
it_should_behave_like( "object parent", 'keyword')
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
describe ::PPC::Operation::Keyword do
|
75
|
+
# keyword subject
|
76
|
+
subject{
|
77
|
+
::PPC::Operation::Keyword.new( auth.merge({id:test_keyword_id}) )
|
78
|
+
}
|
79
|
+
|
80
|
+
it 'can get info' do
|
81
|
+
is_success( subject.info )
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'can update info' do
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe ::PPC::Operation::Creative do
|
89
|
+
#
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
describe "::PPC::API::Sm::Report Operation interface" do
|
2
|
+
auth = $sm_auth
|
3
|
+
|
4
|
+
subject{
|
5
|
+
::PPC::API::Sm::Report
|
6
|
+
}
|
7
|
+
# opetation report test
|
8
|
+
it 'can get report' do
|
9
|
+
endDate = "20150407"
|
10
|
+
startDate = "20150407"
|
11
|
+
|
12
|
+
p "startDate:#{startDate}"
|
13
|
+
p "endDate:#{endDate}"
|
14
|
+
|
15
|
+
param = {startDate:startDate, endDate:endDate}
|
16
|
+
p subject.query_report( auth, param, true )
|
17
|
+
p subject.keyword_report( auth, param, true )
|
18
|
+
p subject.creative_report( auth,param, true )
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
describe ::PPC::Operation::Account do
|
2
|
+
subject{
|
3
|
+
::PPC::Operation::Account.new( $sogou_auth )
|
4
|
+
}
|
5
|
+
# opetation report test
|
6
|
+
it 'can get report' do
|
7
|
+
endDate = ( Time.now-2*3600*24).to_s[0..9].split('-').join
|
8
|
+
startDate =( Time.now-27*3600*24).to_s[0..9].split('-').join
|
9
|
+
|
10
|
+
p "startDate:#{startDate},endDate:#{endDate}"
|
11
|
+
param = {startDate:startDate, endDate:endDate}
|
12
|
+
|
13
|
+
subject.query_report( param )
|
14
|
+
subject.keyword_report( param )
|
15
|
+
subject.creative_report( param )
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require_relative 'operation_spec_helper'
|
2
|
+
|
3
|
+
auth = $sogou_auth
|
4
|
+
preparation = ::PPC::API::Sogou::Group::ids( auth )
|
5
|
+
test_plan_id = preparation[:result][0][:plan_id]
|
6
|
+
test_group_id = preparation[:result][0][:group_ids][0]
|
7
|
+
test_keyword_id = 2517133587
|
8
|
+
test_creative_id = 1519567392
|
9
|
+
|
10
|
+
::PPC::API::Sogou.debug_on
|
11
|
+
|
12
|
+
describe ::PPC::Operation::Account do
|
13
|
+
subject{
|
14
|
+
::PPC::Operation::Account.new( auth )
|
15
|
+
}
|
16
|
+
|
17
|
+
it_should_behave_like( "object", {budget:2990})
|
18
|
+
it_should_behave_like( "object parent", 'plan')
|
19
|
+
|
20
|
+
it_should_behave_like( "object operator", 'plan', {name:'operation_test_plan'},
|
21
|
+
{name:'updated_operation_test_plan'})
|
22
|
+
|
23
|
+
it_should_behave_like( "object operator", 'group',
|
24
|
+
{name:'test_operation_group',plan_id:test_plan_id, price:500},
|
25
|
+
{name:'updated_operation_test_group'} )
|
26
|
+
|
27
|
+
# report test
|
28
|
+
it 'can get report' do
|
29
|
+
endDate = ( Time.now-2*3600*24).to_s[0..9].split('-').join
|
30
|
+
startDate =( Time.now-27*3600*24).to_s[0..9].split('-').join
|
31
|
+
|
32
|
+
param = {startDate:startDate, endDate:endDate}
|
33
|
+
|
34
|
+
subject.query_report( param )
|
35
|
+
subject.keyword_report( param )
|
36
|
+
subject.creative_report( param )
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ::PPC::Operation::Plan do
|
42
|
+
# get test subject
|
43
|
+
subject{
|
44
|
+
::PPC::Operation::Plan.new( auth.merge({id:test_plan_id}) )
|
45
|
+
}
|
46
|
+
|
47
|
+
it_should_behave_like( "object", {budget:2000})
|
48
|
+
it_should_behave_like( "object operator", 'group',
|
49
|
+
{name:'test_operation_group', price:500},
|
50
|
+
{name:'updated_operation_test_group'} )
|
51
|
+
it_should_behave_like( "object parent", 'group')
|
52
|
+
end
|
53
|
+
|
54
|
+
describe ::PPC::Operation::Group do
|
55
|
+
# get test subject
|
56
|
+
subject{
|
57
|
+
::PPC::Operation::Group.new( auth.merge({id:test_group_id}) )
|
58
|
+
}
|
59
|
+
|
60
|
+
it_should_behave_like( "object", {price:200})
|
61
|
+
it_should_behave_like( "object parent", 'keyword')
|
62
|
+
end
|
63
|
+
|
64
|
+
describe ::PPC::Operation::Keyword do
|
65
|
+
# keyword subject
|
66
|
+
subject{
|
67
|
+
::PPC::Operation::Keyword.new( auth.merge({id:test_keyword_id}) )
|
68
|
+
}
|
69
|
+
|
70
|
+
it 'can get info' do
|
71
|
+
is_success( subject.info )
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe ::PPC::Operation::Creative do
|
76
|
+
# creative subject
|
77
|
+
subject{
|
78
|
+
::PPC::Operation::Creative.new( auth.merge({id:test_keyword_id}) )
|
79
|
+
}
|
80
|
+
|
81
|
+
it 'can get info' do
|
82
|
+
is_success( subject.info )
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
shared_examples "
|
1
|
+
shared_examples "object" do
|
2
2
|
| update |
|
3
3
|
it 'can get info' do
|
4
4
|
result = subject.info
|
@@ -12,7 +12,7 @@ shared_examples "it can operate itself" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# 在这之前要describ object
|
15
|
-
shared_examples "
|
15
|
+
shared_examples "object operator" do
|
16
16
|
|object_name, add_info, update_info |
|
17
17
|
object_id = 0
|
18
18
|
|
@@ -20,8 +20,6 @@ shared_examples "it can operate sub_objects" do
|
|
20
20
|
method_name = "add_"+object_name
|
21
21
|
result = subject.send( method_name.to_sym, add_info )
|
22
22
|
is_success( result )
|
23
|
-
p "HAHAHAAAHA"*12
|
24
|
-
p result
|
25
23
|
object_id = result[:result][0][:id]
|
26
24
|
end
|
27
25
|
|
@@ -38,7 +36,7 @@ shared_examples "it can operate sub_objects" do
|
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
41
|
-
shared_examples "
|
39
|
+
shared_examples "object parent" do
|
42
40
|
| object_name|
|
43
41
|
it 'can get all objects'do
|
44
42
|
result = subject.send( (object_name + 's').to_sym )
|
@@ -0,0 +1,29 @@
|
|
1
|
+
describe ::PPC::API::Qihu::Account do
|
2
|
+
auth = $qihu_auth
|
3
|
+
# ::PPC::API::Qihu.debug_on
|
4
|
+
it 'can get accnout info' do
|
5
|
+
response = ::PPC::API::Qihu::Account::info( auth )
|
6
|
+
p response
|
7
|
+
is_success( response )
|
8
|
+
expect( response[:result].keys ).to eq [:id, :name, :email, :company, :industry1, :industry2, :balance, :budget,:resources, :open_domains]
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'can update exclude iplist' do
|
12
|
+
response = ::PPC::API::Qihu::Account::update_exclude_ip( auth, ['127.0.0.1'] )
|
13
|
+
p response
|
14
|
+
is_success( response )
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can get exclude ip list' do
|
18
|
+
response = ::PPC::API::Qihu::Account::get_exclude_ip( auth )
|
19
|
+
p response
|
20
|
+
is_success( response )
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'can update budget' do
|
24
|
+
response = ::PPC::API::Qihu::Account::update_budget( auth, 0 )
|
25
|
+
p response
|
26
|
+
is_success( response )
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe ::PPC::API::Qihu::Creative do
|
2
|
+
auth = $qihu_auth
|
3
|
+
|
4
|
+
test_plan_id = ::PPC::API::Qihu::Plan::ids( auth )[:result][0].to_i
|
5
|
+
test_group_id = ::PPC::API::Qihu::Group::search_id_by_plan_id( auth, test_plan_id )[:result][0][:group_ids][0].to_i
|
6
|
+
test_Creative_id = 0
|
7
|
+
|
8
|
+
it 'can search creatives by group id' do
|
9
|
+
response = ::PPC::API::Qihu::Creative::search_id_by_group_id( auth, test_group_id )
|
10
|
+
is_success( response)
|
11
|
+
expect( response[:result].class ).to eq Array
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'can add a creative' do
|
15
|
+
creative1 = {
|
16
|
+
group_id:test_group_id,
|
17
|
+
title:"testCreative1",
|
18
|
+
description1:'testhahaa',
|
19
|
+
pc_destination:'www.elong.com'
|
20
|
+
}
|
21
|
+
response = ::PPC::API::Qihu::Creative::add( auth, creative1)
|
22
|
+
is_success( response )
|
23
|
+
test_Creative_id = response[:result][0][:id]
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'can update a creative' do
|
27
|
+
creative = { id:test_Creative_id, description2:'testaaaaa' }
|
28
|
+
response = ::PPC::API::Qihu::Creative::update( auth, creative )
|
29
|
+
is_success( response )
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'can get creatives' do
|
33
|
+
response = ::PPC::API::Qihu::Creative::get( auth, [test_Creative_id] )
|
34
|
+
is_success( response )
|
35
|
+
expect( response[:result][0].keys ).to include( :id, :title )
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'can get status' do
|
39
|
+
response = ::PPC::API::Qihu::Creative::status( auth, [test_Creative_id] )
|
40
|
+
is_success( response )
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'can delete a creative' do
|
44
|
+
response = ::PPC::API::Qihu::Creative::delete( auth, [test_Creative_id] )
|
45
|
+
is_success( response )
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|