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
data/spec/baidu_report_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
describe ::PPC::Baidu::Report do
|
2
|
-
subject{
|
3
|
-
::PPC::Baidu::Report.new(
|
4
|
-
debug:true,
|
5
|
-
username:'',
|
6
|
-
password:'',
|
7
|
-
token:'')
|
8
|
-
}
|
9
|
-
it "could get report_id" do
|
10
|
-
file_id = subject.file_id_of_query
|
11
|
-
expect(file_id.size).to eq 32
|
12
|
-
times = 0
|
13
|
-
state = 0
|
14
|
-
loop do
|
15
|
-
state = subject.state(file_id)
|
16
|
-
break if state == 3 or times >= 3
|
17
|
-
times += 1
|
18
|
-
sleep 5
|
19
|
-
end
|
20
|
-
expect(state).to eq 3
|
21
|
-
path = subject.path(file_id)
|
22
|
-
expect(path).to begin_with? 'https://'
|
23
|
-
end
|
24
|
-
end
|
data/spec/operation_spec.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
require 'operation_spec_helper'
|
2
|
-
|
3
|
-
Auth = {}
|
4
|
-
Auth[:username] = $baidu_username
|
5
|
-
Auth[:password] = $baidu_password
|
6
|
-
Auth[:token] = $baidu_token
|
7
|
-
Auth[:se] = 'baidu'
|
8
|
-
preparation = ::PPC::API::Baidu::Group::ids( Auth )
|
9
|
-
Test_plan_id = preparation[:result][0][:plan_id]
|
10
|
-
Test_group_id = preparation[:result][0][:group_ids][0]
|
11
|
-
|
12
|
-
|
13
|
-
describe ::PPC::Operation::Account do
|
14
|
-
subject{
|
15
|
-
::PPC::Operation::Account.new( Auth )
|
16
|
-
}
|
17
|
-
|
18
|
-
it_should_behave_like( "it can operate itself", {budget:2990})
|
19
|
-
it_should_behave_like( "it can get all sub_objects", 'plan')
|
20
|
-
|
21
|
-
it_should_behave_like( "it can operate sub_objects", 'plan', {name:'operation_test_plan'},
|
22
|
-
{name:'updated_operation_test_plan'})
|
23
|
-
|
24
|
-
it_should_behave_like( "it can operate sub_objects", 'group',
|
25
|
-
{name:'test_operation_group',plan_id:Test_plan_id, price:500},
|
26
|
-
{name:'updated_operation_test_group'} )
|
27
|
-
|
28
|
-
it_should_behave_like( "it can operate sub_objects", 'keyword',
|
29
|
-
{ keyword:'testKeyword', group_id:Test_group_id, match_type:'exact'},
|
30
|
-
{ match_type:'wide'})
|
31
|
-
|
32
|
-
it_should_behave_like( "it can operate sub_objects", 'creative',
|
33
|
-
{ group_id: Test_group_id,
|
34
|
-
title: 'OperationTestCreative', preference:1,
|
35
|
-
description1:'this is rest',
|
36
|
-
description2:'also is a test',
|
37
|
-
pc_destination:$baidu_domain,
|
38
|
-
pc_display:$baidu_domain },
|
39
|
-
{title:'OperationTestCreative', description1:'what the fuck'})
|
40
|
-
end
|
41
|
-
|
42
|
-
describe ::PPC::Operation::Plan do
|
43
|
-
# get test subject
|
44
|
-
subject{
|
45
|
-
::PPC::Operation::Plan.new( Auth.merge({id:Test_plan_id}) )
|
46
|
-
}
|
47
|
-
|
48
|
-
it_should_behave_like( "it can operate itself", {budget:2000})
|
49
|
-
it_should_behave_like( "it can operate sub_objects", 'group',
|
50
|
-
{name:'test_operation_group', price:500},
|
51
|
-
{name:'updated_operation_test_group'} )
|
52
|
-
it_should_behave_like( "it can get all sub_objects", 'group')
|
53
|
-
end
|
54
|
-
|
55
|
-
describe ::PPC::Operation::Group do
|
56
|
-
# get test subject
|
57
|
-
subject{
|
58
|
-
::PPC::Operation::Group.new( Auth.merge({id:Test_group_id}) )
|
59
|
-
}
|
60
|
-
|
61
|
-
it_should_behave_like( "it can operate itself", {price:200})
|
62
|
-
it_should_behave_like( "it can operate sub_objects", 'keyword',
|
63
|
-
{ keyword:'testKeyword', group_id:Test_group_id, match_type:'exact'},
|
64
|
-
{ match_type:'wide'})
|
65
|
-
it_should_behave_like( "it can get all sub_objects", 'keyword')
|
66
|
-
end
|
67
|
-
|
68
|
-
# describe ::PPC::Operation::Keyword do
|
69
|
-
# # get test subject
|
70
|
-
# subject{
|
71
|
-
# ::PPC::Operation::Keyword.new( Auth.merge({id:?}) )
|
72
|
-
# }
|
73
|
-
|
74
|
-
# it_should_behave_like( "it can operate itself", {price:200})
|
75
|
-
# end
|
76
|
-
|
77
|
-
# describe ::PPC::Operation::Creative do
|
78
|
-
# # get test subject
|
79
|
-
# subject{
|
80
|
-
# ::PPC::Operation::Creative.new( Auth.merge({id:?}) )
|
81
|
-
# }
|
82
|
-
|
83
|
-
# it_should_behave_like( "it can operate itself", {price:200})
|
84
|
-
# end
|
85
|
-
|
86
|
-
|
87
|
-
|