ppc 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +37 -0
  3. data/.rspec +2 -0
  4. data/LICENSE +339 -0
  5. data/README.md +78 -0
  6. data/lib/ppc.rb +17 -0
  7. data/lib/ppc/api.rb +10 -0
  8. data/lib/ppc/api/baidu.rb +138 -0
  9. data/lib/ppc/api/baidu/account.rb +47 -0
  10. data/lib/ppc/api/baidu/bulk.rb +41 -0
  11. data/lib/ppc/api/baidu/creative.rb +125 -0
  12. data/lib/ppc/api/baidu/group.rb +111 -0
  13. data/lib/ppc/api/baidu/keyword.rb +204 -0
  14. data/lib/ppc/api/baidu/plan.rb +68 -0
  15. data/lib/ppc/api/baidu/report.rb +143 -0
  16. data/lib/ppc/api/qihu.rb +107 -0
  17. data/lib/ppc/api/qihu/account.rb +86 -0
  18. data/lib/ppc/api/qihu/creative.rb +106 -0
  19. data/lib/ppc/api/qihu/group.rb +113 -0
  20. data/lib/ppc/api/qihu/keyword.rb +111 -0
  21. data/lib/ppc/api/qihu/plan.rb +64 -0
  22. data/lib/ppc/api/qihu/report.rb +159 -0
  23. data/lib/ppc/api/shenma.rb +64 -0
  24. data/lib/ppc/api/shenma/report.rb +135 -0
  25. data/lib/ppc/api/sogou.rb +122 -0
  26. data/lib/ppc/api/sogou/account.rb +42 -0
  27. data/lib/ppc/api/sogou/creative.rb +117 -0
  28. data/lib/ppc/api/sogou/group.rb +116 -0
  29. data/lib/ppc/api/sogou/keyword.rb +182 -0
  30. data/lib/ppc/api/sogou/plan.rb +66 -0
  31. data/lib/ppc/api/sogou/report.rb +129 -0
  32. data/lib/ppc/ext.rb +9 -0
  33. data/lib/ppc/operation.rb +196 -0
  34. data/lib/ppc/operation/account.rb +53 -0
  35. data/lib/ppc/operation/creative.rb +28 -0
  36. data/lib/ppc/operation/group.rb +59 -0
  37. data/lib/ppc/operation/keyword.rb +32 -0
  38. data/lib/ppc/operation/plan.rb +47 -0
  39. data/lib/ppc/operation/report.rb +19 -0
  40. data/ppc.gemspec +26 -0
  41. data/spec/baidu/api_baidu_account_spec.rb +15 -0
  42. data/spec/baidu/api_baidu_creative_spec.rb +67 -0
  43. data/spec/baidu/api_baidu_group_spec.rb +45 -0
  44. data/spec/baidu/api_baidu_keyword_spec.rb +61 -0
  45. data/spec/baidu/api_baidu_plan_spec.rb +43 -0
  46. data/spec/baidu/api_baidu_report_spec.rb +44 -0
  47. data/spec/baidu/api_baidu_spec.rb +55 -0
  48. data/spec/operation/operation_baidu_report_spec.rb +17 -0
  49. data/spec/operation/operation_baidu_spec.rb +78 -0
  50. data/spec/operation/operation_qihu_report_spec.rb +18 -0
  51. data/spec/operation/operation_qihu_spec.rb +51 -0
  52. data/spec/operation/operation_sogou_report_spec.rb +17 -0
  53. data/spec/operation/operation_sogou_spec.rb +51 -0
  54. data/spec/operation/operation_spec_helper.rb +51 -0
  55. data/spec/qihu/api_qihu_account_spec.rb +25 -0
  56. data/spec/qihu/api_qihu_creative_spec.rb +48 -0
  57. data/spec/qihu/api_qihu_group_spec.rb +40 -0
  58. data/spec/qihu/api_qihu_keyword_spec.rb +50 -0
  59. data/spec/qihu/api_qihu_plan_spec.rb +39 -0
  60. data/spec/qihu/api_qihu_report_spec.rb +54 -0
  61. data/spec/sogou/api_sogou_account_spec.rb +15 -0
  62. data/spec/sogou/api_sogou_creative_spec.rb +48 -0
  63. data/spec/sogou/api_sogou_group_spec.rb +45 -0
  64. data/spec/sogou/api_sogou_keyword_spec.rb +50 -0
  65. data/spec/sogou/api_sogou_plan_spec.rb +39 -0
  66. data/spec/sogou/api_sogou_report_spec.rb +51 -0
  67. data/spec/spec_helper.rb +134 -0
  68. metadata +177 -0
@@ -0,0 +1,40 @@
1
+ describe ::PPC::API::Qihu::Group do
2
+ auth = $qihu_auth
3
+
4
+ test_plan_id = ::PPC::API::Qihu::Plan::ids( auth )[:result][0].to_i
5
+ test_group_id = 0
6
+
7
+ it 'can add a group' do
8
+ group = { plan_id:test_plan_id, name:'testGroup', price:999}
9
+ response = ::PPC::API::Qihu::Group::add( auth, group)
10
+ is_success(response)
11
+ test_group_id = response[:result].to_i
12
+ end
13
+
14
+ it 'can update a group' do
15
+ group = { id: test_group_id, price:990}
16
+ response = ::PPC::API::Qihu::Group::update( auth, group )
17
+ is_success(response)
18
+ end
19
+
20
+ it 'can get a group' do
21
+ response = ::PPC::API::Qihu::Group::get( auth, test_group_id )
22
+ is_success( response )
23
+ end
24
+
25
+ it 'can search id by plan id ' do
26
+ response = ::PPC::API::Qihu::Group::search_id_by_plan_id( auth, 717479502 )
27
+ is_success( response )
28
+ end
29
+
30
+ it 'can search by plan id ' do
31
+ response = ::PPC::API::Qihu::Group::search_by_plan_id( auth, 717479502 )
32
+ is_success( response )
33
+ end
34
+
35
+ it 'can delete a group' do
36
+ response = ::PPC::API::Qihu::Group::delete( auth, test_group_id)
37
+ is_success( response )
38
+ end
39
+
40
+ end
@@ -0,0 +1,50 @@
1
+ describe ::PPC::API::Qihu::Keyword 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_keyword_id = 0
7
+
8
+ it 'can search keyword id by group id' do
9
+ response = ::PPC::API::Qihu::Keyword::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 search keyword by group id' do
15
+ response = ::PPC::API::Qihu::Keyword::search_by_group_id( auth, test_group_id )
16
+ is_success( response)
17
+ expect( response[:result].class ).to eq Array
18
+ end
19
+
20
+ it 'can add keyword' do
21
+ keyword1 = { group_id:test_group_id, keyword:"testKeyword1",price:0.3,match_type:"exact"}
22
+ response = ::PPC::API::Qihu::Keyword::add( auth, keyword1)
23
+ is_success( response )
24
+ test_keyword_id = response[:result][0]
25
+ p response
26
+ end
27
+
28
+ it 'can update keyword' do
29
+ keyword = { id:test_keyword_id, price:0.4 }
30
+ response = ::PPC::API::Qihu::Keyword::update( auth, keyword )
31
+ is_success( response )
32
+ end
33
+
34
+ it 'can get keyword' do
35
+ response = ::PPC::API::Qihu::Keyword::get( auth, test_keyword_id )
36
+ is_success( response )
37
+ expect( response[:result][0].keys ).to include( :id, :status )
38
+ end
39
+
40
+ it 'can get status' do
41
+ response = ::PPC::API::Qihu::Keyword::status( auth, test_keyword_id )
42
+ is_success( response )
43
+ end
44
+
45
+ it 'can delete keyword' do
46
+ response = ::PPC::API::Qihu::Keyword::delete( auth, test_keyword_id )
47
+ is_success( response )
48
+ end
49
+
50
+ end
@@ -0,0 +1,39 @@
1
+ describe ::PPC::API::Qihu::Plan do
2
+ auth = $qihu_auth
3
+
4
+ test_plan_id = 0
5
+
6
+ it ' can get all plan ids ' do
7
+ response = ::PPC::API::Qihu::Plan::ids( auth )
8
+ is_success( response )
9
+ expect( response[:result].class ).to eq Array
10
+ end
11
+
12
+ it ' can get all plans ' do
13
+ response = ::PPC::API::Qihu::Plan::all( auth )
14
+ is_success( response )
15
+ expect( response[:result].class ).to eq Array
16
+ end
17
+
18
+ it 'can add a plan' do
19
+ response = ::PPC::API::Qihu::Plan::add( auth, {name:'planForTest'})
20
+ is_success( response )
21
+ test_plan_id = response[:result]
22
+ end
23
+
24
+ it 'can get a plan' do
25
+ response = ::PPC::API::Qihu::Plan::get( auth, test_plan_id )
26
+ is_success( response )
27
+ end
28
+
29
+ it 'can update a plan' do
30
+ response = ::PPC::API::Qihu::Plan::update( auth, { id:test_plan_id, name:'planUpdateTest' } )
31
+ is_success( response )
32
+ end
33
+
34
+ it 'can delete a plan ' do
35
+ response = ::PPC::API::Qihu::Plan::delete( auth , test_plan_id )
36
+ is_success( response )
37
+ end
38
+
39
+ end
@@ -0,0 +1,54 @@
1
+ describe ::PPC::API::Qihu::Report do
2
+ auth = $qihu_auth
3
+
4
+ # param for test
5
+
6
+ # all method of query return 403 forbidden
7
+ type_list = ['keyword', 'creative', 'sublink']
8
+ method_list = ['','_now','_now_count','_count']
9
+
10
+ startDate = (Time.now - 5*24*3600).to_s[0...10].split('-').join
11
+ endDate = (Time.now - 2*24*3600).to_s[0...10].split('-').join
12
+ param = {level:"account", startDate:startDate, endDate:endDate}
13
+
14
+ ############################
15
+ # test for Web Service API #
16
+ ############################
17
+ it "has an workable abstract function" do
18
+ response = ::PPC::API::Qihu::Report.abstract( auth,'keyword','keywordNowCount','',{})
19
+ expect(response[:result][0].keys).to eq [:total_num,:total_page]
20
+ end
21
+
22
+ it "have all methods for each report type" do
23
+ method_list.each do |method|
24
+ type_list.each do |type|
25
+ method_name = type+method
26
+ method_name = method_name.to_sym
27
+ p ::PPC::API::Qihu::Report.send( method_name, auth, param)
28
+ # is_success( response )
29
+ end
30
+ end
31
+ end
32
+
33
+ ################################
34
+ # test for Operation interface #
35
+ ################################
36
+ it 'can download report' do
37
+ report = ::PPC::API::Qihu::Report.download_report( auth, 'keyword', param )
38
+ end
39
+
40
+ it 'can download keyword report' do
41
+ report = ::PPC::API::Qihu::Report.keyword_report( auth, param )
42
+ f = open('keyword.txt','w')
43
+ f.puts report
44
+ f.close
45
+ end
46
+
47
+ it 'can download creative report' do
48
+ report = ::PPC::API::Qihu::Report.creative_report( auth, param )
49
+ f = open('creative.txt','w')
50
+ f.puts report
51
+ f.close
52
+ end
53
+
54
+ end
@@ -0,0 +1,15 @@
1
+ describe ::PPC::API::Sogou::Account do
2
+ auth = $sogou_auth
3
+
4
+ it 'can get account info' do
5
+ result = ::PPC::API::Sogou::Account::info( auth )
6
+ is_success( result )
7
+ end
8
+
9
+ it 'can update account' do
10
+ update = {budget:500}
11
+ result = ::PPC::API::Sogou::Account::update( auth, update )
12
+ is_success( result )
13
+ end
14
+
15
+ end
@@ -0,0 +1,48 @@
1
+ # -*- coding:utf-8 -*-
2
+ describe ::PPC::API::Sogou::Creative do
3
+ '''
4
+ sogou的创意服务在add的时候需要审核因此自动测试不能一次通过,
5
+ 会出现Creative is pending的error.不过手动测试方法没问题了。
6
+ '''
7
+ auth = $sogou_auth
8
+
9
+ # prepare for test param
10
+ ::PPC::API::Sogou.debug_off
11
+ test_group_id = ::PPC::API::Sogou::Group::ids( auth )[:result][0][:group_ids][0]
12
+ test_creative_id = []
13
+ ::PPC::API::Sogou.debug_on
14
+
15
+ it 'can search Creative by group id' do
16
+ response = ::PPC::API::Sogou::Creative::search_by_group_id( auth, test_group_id )
17
+ is_success( response )
18
+ end
19
+
20
+ it 'can add Creative' do
21
+ Creative = { group_id: test_group_id, title: 'testCreative',
22
+ description1:"this is a test", description2: "this is another test",
23
+ pc_destination:$sogou_domain, pc_display:$sogou_domain }
24
+ response = ::PPC::API::Sogou::Creative::add( auth, Creative )
25
+ is_success( response )
26
+ p response
27
+ test_creative_id << response[:result][0][:id]
28
+ end
29
+
30
+ it 'can get status' do
31
+ response = ::PPC::API::Sogou::Creative::status( auth, test_creative_id)
32
+ is_success(response)
33
+ expect(response[:result][0].keys).to eq [:id,:status]
34
+ end
35
+
36
+ it 'can update Creative' do
37
+ update = { id:test_creative_id, description1: 'sogou_expiediction', pause:true}
38
+ response = ::PPC::API::Sogou::Creative::update( auth, update )
39
+ p response
40
+ is_success( response )
41
+ end
42
+
43
+ it 'can delete Creative' do
44
+ response = ::PPC::API::Sogou::Creative::delete( auth, test_creative_id )
45
+ is_success( response )
46
+ end
47
+
48
+ end
@@ -0,0 +1,45 @@
1
+ describe ::PPC::API::Sogou::Group do
2
+ auth = $sogou_auth
3
+
4
+ test_plan_id = ::PPC::API::Sogou::Plan.ids(auth)[:result][0]
5
+ test_group_id = []
6
+
7
+ it 'can get all group' do
8
+ response = ::PPC::API::Sogou::Group::ids( auth )
9
+ is_success( response )
10
+ end
11
+
12
+ it 'can add group' do
13
+ group = { name: 'test_group', plan_id:test_plan_id, price:500 }
14
+ response = ::PPC::API::Sogou::Group::add( auth, group )
15
+ is_success( response )
16
+ test_group_id << response[:result][0][:id]
17
+ end
18
+
19
+ it 'can update group' do
20
+ group = { id: test_group_id[0], price:600 }
21
+ response = ::PPC::API::Sogou::Group::update( auth, group )
22
+ is_success( response )
23
+ end
24
+
25
+ it 'can search group by group id' do
26
+ response = ::PPC::API::Sogou::Group::get( auth, test_group_id )
27
+ is_success( response )
28
+ end
29
+
30
+ it 'can search group id by plan id' do
31
+ response = ::PPC::API::Sogou::Group::search_id_by_plan_id( auth, test_plan_id )
32
+ is_success( response )
33
+ end
34
+
35
+ it 'search by plan id' do
36
+ response = ::PPC::API::Sogou::Group::search_by_plan_id( auth, test_plan_id )
37
+ is_success( response )
38
+ end
39
+
40
+ it 'can delete group' do
41
+ response = ::PPC::API::Sogou::Group::delete( auth, test_group_id )
42
+ is_success( response )
43
+ end
44
+
45
+ end
@@ -0,0 +1,50 @@
1
+ # -*- coding:utf-8 -*-
2
+ describe ::PPC::API::Sogou::Keyword do
3
+ '''
4
+ sogou的关键词服务在add的时候需要审核因此不能一次通过,
5
+ 会出现keyword is pending的error.不过手动测试方法没问题了。
6
+ '''
7
+ auth = $sogou_auth
8
+
9
+ ::PPC::API::Sogou.debug_off
10
+ test_group_id = ::PPC::API::Sogou::Group::ids( auth )[:result][0][:group_ids][0]
11
+ test_keyword_id = []
12
+ ::PPC::API::Sogou.debug_on
13
+
14
+ it 'can search keyword by group id' do
15
+ response = ::PPC::API::Sogou::Keyword::search_by_group_id( auth, test_group_id )
16
+ p response
17
+ is_success( response )
18
+ end
19
+
20
+ it 'can add keyword' do
21
+ keyword = { group_id: test_group_id, keyword: 'testkeyword', match_type:'exact' }
22
+ response = ::PPC::API::Sogou::Keyword::add( auth, keyword )
23
+ is_success( response )
24
+ test_keyword_id << response[:result][0][:id]
25
+ end
26
+
27
+ it 'can get status' do
28
+ response = ::PPC::API::Sogou::Keyword::status( auth, test_keyword_id)
29
+ is_success(response)
30
+ expect(response[:result][0].keys).to eq [:id,:status]
31
+ end
32
+
33
+ it 'can get quality' do
34
+ response = ::PPC::API::Sogou::Keyword::quality( auth, test_keyword_id)
35
+ is_success(response)
36
+ expect(response[:result][0].keys).to eq [:id,:quality]
37
+ end
38
+
39
+ it 'can update keyword' do
40
+ update = { id:test_keyword_id, pc_destination: $sogou_domain, pause:true}
41
+ response = ::PPC::API::Sogou::Keyword::update( auth, update )
42
+ is_success( response )
43
+ end
44
+
45
+ it 'can delete keyword' do
46
+ response = ::PPC::API::Sogou::Keyword::delete( auth, test_keyword_id )
47
+ is_success( response )
48
+ end
49
+
50
+ end
@@ -0,0 +1,39 @@
1
+ describe ::PPC::API::Sogou::Plan do
2
+ auth = $sogou_auth
3
+
4
+ test_plan_id = []
5
+
6
+ it "can get all plans" do
7
+ response = ::PPC::API::Sogou::Plan::all( auth )
8
+ is_success( response )
9
+ end
10
+
11
+ it "can get all plan id" do
12
+ response = ::PPC::API::Sogou::Plan::ids( auth )
13
+ is_success( response )
14
+ end
15
+
16
+ it "can add plan" do
17
+ test_plan = { name: "test_elong", negative: ["test"] }
18
+ response = ::PPC::API::Sogou::Plan::add( auth, test_plan )
19
+ is_success( response )
20
+ test_plan_id << response[:result][0][:id]
21
+ end
22
+
23
+ it "can get plan by id" do
24
+ response = ::PPC::API::Sogou::Plan::get( auth, test_plan_id )
25
+ is_success( response )
26
+ end
27
+
28
+ it 'can update plan' do
29
+ update = { id: test_plan_id[0], name:"test_plan_update"}
30
+ response = ::PPC::API::Sogou::Plan::update( auth, update )
31
+ is_success( response )
32
+ end
33
+
34
+ it "can delete plan" do
35
+ response = ::PPC::API::Sogou::Plan::delete( auth, test_plan_id )
36
+ is_success( response )
37
+ end
38
+
39
+ end
@@ -0,0 +1,51 @@
1
+ describe ::PPC::API::Sogou::Report do
2
+ auth = $sogou_auth
3
+
4
+ param = {}
5
+ param[:type] = 'keyword'
6
+ param[:fields] = %w(impression click cpc cost ctr)
7
+ param[:endDate] = ( Time.now-2*3600*24).to_s[0..9].split('-').join
8
+ param[:startDate] =( Time.now-7*3600*24).to_s[0..9].split('-').join
9
+
10
+
11
+ test_report_id = []
12
+ it "can get report id" do
13
+ response = ::PPC::API::Sogou::Report.get_id( auth, param )
14
+ is_success( response )
15
+ test_report_id << response[:result]
16
+ end
17
+
18
+ it "can get report state" do
19
+ response = ::PPC::API::Sogou::Report.get_state( auth, test_report_id[0] )
20
+ is_success( response )
21
+ end
22
+
23
+ it "can get report url" do
24
+ response = ::PPC::API::Sogou::Report.get_url( auth, test_report_id[0] )
25
+ is_success( response )
26
+ end
27
+
28
+ it "can download one report" do
29
+ report = ::PPC::API::Sogou::Report.download_report( auth, param )
30
+ end
31
+
32
+ end
33
+
34
+ describe "::PPC::API::Sogou::Report Operation interface " do
35
+ auth = $sogou_auth
36
+
37
+ subject{
38
+ ::PPC::API::Sogou::Report
39
+ }
40
+ # opetation report test
41
+ it 'can get report' do
42
+ endDate = ( Time.now-2*3600*24).to_s[0..9].split('-').join
43
+ startDate =( Time.now-27*3600*24).to_s[0..9].split('-').join
44
+
45
+ param = {startDate:startDate, endDate:endDate}
46
+ subject.query_report( auth, param )
47
+ subject.keyword_report( auth, param )
48
+ subject.creative_report( auth,param )
49
+ end
50
+
51
+ end
@@ -0,0 +1,134 @@
1
+ # -*- coding:utf-8 -*-
2
+ # This file was generated by the `rspec --init` command. Conventionally, all
3
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
4
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
5
+ # file to always be loaded, without a need to explicitly require it in any files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, make a
11
+ # separate helper file that requires this one and then use it only in the specs
12
+ # that actually need it.
13
+ #
14
+ # The `.rspec` file also contains a few flags that are not defaults but that
15
+ # users commonly want.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # The settings below are suggested to provide a good initial experience
20
+ # with RSpec, but feel free to customize to your heart's content.
21
+ =begin
22
+ # These two settings work together to allow you to limit a spec run
23
+ # to individual examples or groups you care about by tagging them with
24
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
25
+ # get run.
26
+ config.filter_run :focus
27
+ config.run_all_when_everything_filtered = true
28
+
29
+ # Many RSpec users commonly either run the entire suite or an individual
30
+ # file, and it's useful to allow more verbose output when running an
31
+ # individual spec file.
32
+ if config.files_to_run.one?
33
+ # Use the documentation formatter for detailed output,
34
+ # unless a formatter has already been configured
35
+ # (e.g. via a command-line flag).
36
+ config.default_formatter = 'doc'
37
+ end
38
+
39
+ # Print the 10 slowest examples and example groups at the
40
+ # end of the spec run, to help surface which specs are running
41
+ # particularly slow.
42
+ config.profile_examples = 10
43
+
44
+ # Run specs in random order to surface order dependencies. If you find an
45
+ # order dependency and want to debug it, you can fix the order by providing
46
+ # the seed, which is printed after each run.
47
+ # --seed 1234
48
+ config.order = :random
49
+
50
+ # Seed global randomization in this process using the `--seed` CLI option.
51
+ # Setting this allows you to use `--seed` to deterministically reproduce
52
+ # test failures related to randomization by passing the same `--seed` value
53
+ # as the one that triggered the failure.
54
+ Kernel.srand config.seed
55
+
56
+ # rspec-expectations config goes here. You can use an alternate
57
+ # assertion/expectation library such as wrong or the stdlib/minitest
58
+ # assertions if you prefer.
59
+ config.expect_with :rspec do |expectations|
60
+ # Enable only the newer, non-monkey-patching expect syntax.
61
+ # For more details, see:
62
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
+ expectations.syntax = :expect
64
+ end
65
+
66
+ # rspec-mocks config goes here. You can use an alternate test double
67
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
68
+ config.mock_with :rspec do |mocks|
69
+ # Enable only the newer, non-monkey-patching expect syntax.
70
+ # For more details, see:
71
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
72
+ mocks.syntax = :expect
73
+
74
+ # Prevents you from mocking or stubbing a method that does not exist on
75
+ # a real object. This is generally recommended.
76
+ mocks.verify_partial_doubles = true
77
+ end
78
+ =end
79
+ end
80
+
81
+
82
+ require 'ppc'
83
+
84
+ baidu_username = ''
85
+ baidu_password = ''
86
+ baidu_token = ''
87
+
88
+ qihu_username = ''
89
+ qihu_password = ''
90
+ qihu_token = ''
91
+ qihu_cipherkey = ''
92
+ qihu_cipheriv = ''
93
+ qihu_accessToken = ''
94
+
95
+
96
+ sogou_username = ''
97
+ sogou_password = ''
98
+ sogou_token = ''
99
+
100
+
101
+
102
+ $domain = ''
103
+ $baidu_auth = {
104
+ username: baidu_username,
105
+ password: baidu_password,
106
+ token: baidu_token,
107
+ se: 'baidu'
108
+ }
109
+
110
+ $qihu_auth = {
111
+ username: qihu_username,
112
+ password: qihu_password,
113
+ cipherkey: qihu_cipherkey,
114
+ cipheriv: qihu_cipheriv,
115
+ token: qihu_token,
116
+ se: 'qihu'
117
+ }
118
+
119
+ $sogou_auth = {
120
+ username: sogou_username,
121
+ password: sogou_password,
122
+ token: sogou_token,
123
+ se: 'sogou'
124
+ }
125
+
126
+
127
+
128
+
129
+
130
+
131
+ def is_success( result )
132
+ expect( result[:succ] ).to eq true
133
+ end
134
+