ppc 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -1
  3. data/LICENSE +334 -17
  4. data/README.md +75 -3
  5. data/lib/ppc.rb +3 -1
  6. data/lib/ppc/api.rb +137 -2
  7. data/lib/ppc/api/baidu.rb +20 -99
  8. data/lib/ppc/api/baidu/account.rb +21 -21
  9. data/lib/ppc/api/baidu/bulk.rb +39 -3
  10. data/lib/ppc/api/baidu/creative.rb +33 -33
  11. data/lib/ppc/api/baidu/group.rb +14 -14
  12. data/lib/ppc/api/baidu/keyword.rb +57 -46
  13. data/lib/ppc/api/baidu/phone_new_creative.rb +51 -0
  14. data/lib/ppc/api/baidu/plan.rb +34 -31
  15. data/lib/ppc/api/baidu/rank.rb +23 -0
  16. data/lib/ppc/api/baidu/report.rb +100 -81
  17. data/lib/ppc/api/qihu.rb +150 -0
  18. data/lib/ppc/api/qihu/account.rb +86 -0
  19. data/lib/ppc/api/qihu/bulk.rb +35 -0
  20. data/lib/ppc/api/qihu/creative.rb +108 -0
  21. data/lib/ppc/api/qihu/group.rb +96 -0
  22. data/lib/ppc/api/qihu/keyword.rb +113 -0
  23. data/lib/ppc/api/qihu/plan.rb +64 -0
  24. data/lib/ppc/api/qihu/rank.rb +25 -0
  25. data/lib/ppc/api/qihu/report.rb +159 -0
  26. data/lib/ppc/api/qihu/sublink.rb +71 -0
  27. data/lib/ppc/api/shenma.rb +64 -0
  28. data/lib/ppc/api/shenma/report.rb +135 -0
  29. data/lib/ppc/api/sm.rb +50 -0
  30. data/lib/ppc/api/sm/account.rb +44 -0
  31. data/lib/ppc/api/sm/bulk.rb +69 -0
  32. data/lib/ppc/api/sm/creative.rb +86 -0
  33. data/lib/ppc/api/sm/group.rb +94 -0
  34. data/lib/ppc/api/sm/keyword.rb +132 -0
  35. data/lib/ppc/api/sm/phone_new_creative.rb +51 -0
  36. data/lib/ppc/api/sm/plan.rb +63 -0
  37. data/lib/ppc/api/sm/report.rb +136 -0
  38. data/lib/ppc/api/sogou.rb +118 -0
  39. data/lib/ppc/api/sogou/account.rb +42 -0
  40. data/lib/ppc/api/sogou/bulk.rb +69 -0
  41. data/lib/ppc/api/sogou/creative.rb +117 -0
  42. data/lib/ppc/api/sogou/group.rb +123 -0
  43. data/lib/ppc/api/sogou/keyword.rb +188 -0
  44. data/lib/ppc/api/sogou/plan.rb +66 -0
  45. data/lib/ppc/api/sogou/report.rb +129 -0
  46. data/lib/ppc/ext.rb +17 -0
  47. data/lib/ppc/operation.rb +50 -36
  48. data/lib/ppc/operation/account.rb +19 -7
  49. data/lib/ppc/operation/creative.rb +7 -7
  50. data/lib/ppc/operation/group.rb +2 -2
  51. data/lib/ppc/operation/keyword.rb +11 -8
  52. data/lib/ppc/operation/report.rb +23 -0
  53. data/ppc.gemspec +14 -4
  54. data/spec/baidu/api_baidu_account_spec.rb +16 -0
  55. data/spec/baidu/api_baidu_creative_spec.rb +73 -0
  56. data/spec/{api_baidu_group_spec.rb → baidu/api_baidu_group_spec.rb} +12 -17
  57. data/spec/baidu/api_baidu_keyword_spec.rb +61 -0
  58. data/spec/baidu/api_baidu_phone_spec.rb +22 -0
  59. data/spec/{api_baidu_plan_spec.rb → baidu/api_baidu_plan_spec.rb} +11 -10
  60. data/spec/baidu/api_baidu_report_spec.rb +44 -0
  61. data/spec/{api_baidu_spec.rb → baidu/api_baidu_spec.rb} +10 -15
  62. data/spec/operation/operation_baidu_report_spec.rb +17 -0
  63. data/spec/operation/operation_baidu_spec.rb +126 -0
  64. data/spec/operation/operation_qihu_report_spec.rb +18 -0
  65. data/spec/operation/operation_qihu_spec.rb +94 -0
  66. data/spec/operation/operation_sm_report_spec.rb +21 -0
  67. data/spec/operation/operation_sogou_report_spec.rb +17 -0
  68. data/spec/operation/operation_sogou_spec.rb +88 -0
  69. data/spec/{operation_spec_helper.rb → operation/operation_spec_helper.rb} +3 -5
  70. data/spec/qihu/api_qihu_account_spec.rb +29 -0
  71. data/spec/qihu/api_qihu_creative_spec.rb +48 -0
  72. data/spec/qihu/api_qihu_group_spec.rb +40 -0
  73. data/spec/qihu/api_qihu_keyword_spec.rb +50 -0
  74. data/spec/qihu/api_qihu_plan_spec.rb +39 -0
  75. data/spec/qihu/api_qihu_report_spec.rb +54 -0
  76. data/spec/qihu/api_qihu_sublink_spec.rb +36 -0
  77. data/spec/sm/api_sm_account_spec.rb +8 -0
  78. data/spec/sm/api_sm_creative_spec.rb +52 -0
  79. data/spec/sm/api_sm_group_spec.rb +75 -0
  80. data/spec/sm/api_sm_keyword_spec.rb +59 -0
  81. data/spec/sm/api_sm_plan_spec.rb +39 -0
  82. data/spec/sm/api_sm_report_spec.rb +30 -0
  83. data/spec/sogou/api_sogou_account_spec.rb +17 -0
  84. data/spec/sogou/api_sogou_creative_spec.rb +51 -0
  85. data/spec/sogou/api_sogou_group_spec.rb +50 -0
  86. data/spec/sogou/api_sogou_keyword_spec.rb +54 -0
  87. data/spec/sogou/api_sogou_plan_spec.rb +43 -0
  88. data/spec/sogou/api_sogou_report_spec.rb +51 -0
  89. data/spec/spec_helper.rb +49 -10
  90. metadata +140 -46
  91. data/lib/ppc/baidu.rb +0 -152
  92. data/lib/ppc/baidu/account.rb +0 -88
  93. data/lib/ppc/baidu/bulk.rb +0 -52
  94. data/lib/ppc/baidu/group.rb +0 -99
  95. data/lib/ppc/baidu/key.rb +0 -38
  96. data/lib/ppc/baidu/plan.rb +0 -85
  97. data/lib/ppc/baidu/report.rb +0 -82
  98. data/spec/api_baidu_account_spec.rb +0 -18
  99. data/spec/api_baidu_creative_spec.rb +0 -71
  100. data/spec/api_baidu_keyword_spec.rb +0 -64
  101. data/spec/api_baidu_report_spec.rb +0 -32
  102. data/spec/baidu_account_spec.rb +0 -32
  103. data/spec/baidu_bulk_spec.rb +0 -21
  104. data/spec/baidu_group_spec.rb +0 -56
  105. data/spec/baidu_plan_spec.rb +0 -129
  106. data/spec/baidu_report_spec.rb +0 -24
  107. data/spec/operation_spec.rb +0 -87
@@ -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
@@ -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
-