sem4r 0.1.1

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.
Files changed (187) hide show
  1. data/LICENSE +22 -0
  2. data/README.rdoc +74 -0
  3. data/Rakefile +126 -0
  4. data/VERSION.yml +5 -0
  5. data/bin/sem +34 -0
  6. data/config/sem4r.example.yml +51 -0
  7. data/examples_blog/2009-11-29-hello-world.rb +12 -0
  8. data/examples_blog/2009-12-12-create-campaign.rb +29 -0
  9. data/examples_blog/2010-02-06-constants-scope.rb +8 -0
  10. data/examples_blog/2010-02-07-ad-parameters.rb +47 -0
  11. data/examples_sem4r/01_get_account.rb +37 -0
  12. data/examples_sem4r/02_get_info.rb +32 -0
  13. data/examples_sem4r/03_list_ad.rb +47 -0
  14. data/examples_sem4r/04_list_keywords.rb +54 -0
  15. data/examples_sem4r/05_request_report.rb +51 -0
  16. data/examples_sem4r/05_request_report_2010.rb +40 -0
  17. data/examples_sem4r/06_create_campaigns.rb +86 -0
  18. data/examples_sem4r/07_create_campaigns_block.rb +99 -0
  19. data/examples_sem4r/07_create_campaigns_simple.rb +65 -0
  20. data/examples_sem4r/08_ad_params.rb +70 -0
  21. data/examples_sem4r/09_targeting_idea.rb +59 -0
  22. data/examples_sem4r/10_get_location.rb +28 -0
  23. data/examples_sem4r/11_submit_bulk_job.rb +82 -0
  24. data/examples_sem4r/12_list_bulk_job.rb +29 -0
  25. data/examples_sem4r/30_prune_empty_adgroup.rb +50 -0
  26. data/examples_sem4r/31_empty_accounts.rb +40 -0
  27. data/examples_sem4r/example_helper.rb +115 -0
  28. data/lib/sem4r/account.rb +349 -0
  29. data/lib/sem4r/ad_extension_override/ad_extension_override_service.rb +30 -0
  30. data/lib/sem4r/ad_group/ad_group.rb +340 -0
  31. data/lib/sem4r/ad_group/ad_group_bids.rb +170 -0
  32. data/lib/sem4r/ad_group/ad_group_service.rb +75 -0
  33. data/lib/sem4r/ad_group/mobile_ad_image.rb +33 -0
  34. data/lib/sem4r/ad_group_ad/ad_group_ad.rb +98 -0
  35. data/lib/sem4r/ad_group_ad/ad_group_ad_operations.rb +38 -0
  36. data/lib/sem4r/ad_group_ad/ad_group_ad_service.rb +56 -0
  37. data/lib/sem4r/ad_group_ad/ad_group_mobile_ad.rb +137 -0
  38. data/lib/sem4r/ad_group_ad/ad_group_text_ad.rb +98 -0
  39. data/lib/sem4r/ad_group_criterion/ad_group_criterion.rb +144 -0
  40. data/lib/sem4r/ad_group_criterion/ad_group_criterion_bids.rb +115 -0
  41. data/lib/sem4r/ad_group_criterion/ad_group_criterion_operations.rb +35 -0
  42. data/lib/sem4r/ad_group_criterion/ad_group_criterion_service.rb +58 -0
  43. data/lib/sem4r/ad_group_criterion/criterion.rb +67 -0
  44. data/lib/sem4r/ad_group_criterion/criterion_keyword.rb +80 -0
  45. data/lib/sem4r/ad_group_criterion/criterion_placement.rb +66 -0
  46. data/lib/sem4r/ad_param/ad_param.rb +96 -0
  47. data/lib/sem4r/ad_param/ad_param_operation.rb +34 -0
  48. data/lib/sem4r/ad_param/ad_param_service.rb +59 -0
  49. data/lib/sem4r/adwords.rb +242 -0
  50. data/lib/sem4r/api_counters.rb +7 -0
  51. data/lib/sem4r/base.rb +43 -0
  52. data/lib/sem4r/bulk_mutate_job/bulk_mutate_job.rb +108 -0
  53. data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_selector.rb +56 -0
  54. data/lib/sem4r/bulk_mutate_job/bulk_mutate_job_service.rb +57 -0
  55. data/lib/sem4r/bulk_mutate_job/job_operations.rb +35 -0
  56. data/lib/sem4r/campaign/campaign.rb +193 -0
  57. data/lib/sem4r/campaign/campaign_service.rb +91 -0
  58. data/lib/sem4r/campaign_criterion/campaign_criterion_service.rb +30 -0
  59. data/lib/sem4r/campaign_target/campaign_target_service.rb +30 -0
  60. data/lib/sem4r/cli/cli_command.rb +101 -0
  61. data/lib/sem4r/cli/cli_commands.rb +60 -0
  62. data/lib/sem4r/cli/cli_common_args.rb +293 -0
  63. data/lib/sem4r/cli/cli_download_report.rb +81 -0
  64. data/lib/sem4r/cli/cli_helpers.rb +57 -0
  65. data/lib/sem4r/cli/cli_ideas.rb +100 -0
  66. data/lib/sem4r/cli/cli_list_ads.rb +74 -0
  67. data/lib/sem4r/cli/cli_list_keywords.rb +76 -0
  68. data/lib/sem4r/cli/cli_request_report.rb +104 -0
  69. data/lib/sem4r/cli/cli_sem.rb +64 -0
  70. data/lib/sem4r/common/operation.rb +78 -0
  71. data/lib/sem4r/credentials.rb +86 -0
  72. data/lib/sem4r/extensions.rb +62 -0
  73. data/lib/sem4r/geo_location/geo_location_service.rb +59 -0
  74. data/lib/sem4r/info/info_service.rb +115 -0
  75. data/lib/sem4r/report_definition/report_definition.rb +104 -0
  76. data/lib/sem4r/report_definition/report_definition_operation.rb +34 -0
  77. data/lib/sem4r/report_definition/report_definition_selector.rb +31 -0
  78. data/lib/sem4r/report_definition/report_definition_service.rb +55 -0
  79. data/lib/sem4r/sem4r_error.rb +28 -0
  80. data/lib/sem4r/services/service.rb +74 -0
  81. data/lib/sem4r/services/soap_call.rb +100 -0
  82. data/lib/sem4r/services/soap_connector.rb +284 -0
  83. data/lib/sem4r/services/soap_error.rb +38 -0
  84. data/lib/sem4r/services/soap_message_v13.rb +129 -0
  85. data/lib/sem4r/services/soap_message_v2009.rb +170 -0
  86. data/lib/sem4r/soap_attributes.rb +141 -0
  87. data/lib/sem4r/targeting_idea/targeting_idea.rb +158 -0
  88. data/lib/sem4r/targeting_idea/targeting_idea_selector.rb +200 -0
  89. data/lib/sem4r/targeting_idea/targeting_idea_service.rb +51 -0
  90. data/lib/sem4r/v13_account/account_service.rb +54 -0
  91. data/lib/sem4r/v13_account/billing_address.rb +67 -0
  92. data/lib/sem4r/v13_report/report.rb +185 -0
  93. data/lib/sem4r/v13_report/report_job.rb +51 -0
  94. data/lib/sem4r/v13_report/report_service.rb +89 -0
  95. data/lib/sem4r/v13_traffic_estimator/traffic_estimator_service.rb +30 -0
  96. data/lib/sem4r.rb +142 -0
  97. data/lib/sem4r_cli.rb +40 -0
  98. data/sem4r.gemspec +247 -0
  99. data/spec/aggregates_spec_helper.rb +59 -0
  100. data/spec/fixtures/sem4r.example.yml +26 -0
  101. data/spec/fixtures/services/ad_group/get-first-req.xml +28 -0
  102. data/spec/fixtures/services/ad_group/get-first-res.xml +91 -0
  103. data/spec/fixtures/services/ad_group/get-manual-cpm-bids-req.xml +106 -0
  104. data/spec/fixtures/services/ad_group/get-manual-cpm-bids-res.xml +75 -0
  105. data/spec/fixtures/services/ad_group/mutate_add-req.xml +52 -0
  106. data/spec/fixtures/services/ad_group/mutate_add-res.xml +33 -0
  107. data/spec/fixtures/services/ad_group_ad/get_mobile_ad-req.xml +28 -0
  108. data/spec/fixtures/services/ad_group_ad/get_mobile_ad-res.xml +194 -0
  109. data/spec/fixtures/services/ad_group_ad/get_text_ad-req.xml +29 -0
  110. data/spec/fixtures/services/ad_group_ad/get_text_ad-res.xml +55 -0
  111. data/spec/fixtures/services/ad_group_ad/mutate_add_mobile_ad-req.xml +50 -0
  112. data/spec/fixtures/services/ad_group_ad/mutate_add_mobile_ad-res.xml +42 -0
  113. data/spec/fixtures/services/ad_group_ad/mutate_add_text_ad-req.xml +37 -0
  114. data/spec/fixtures/services/ad_group_ad/mutate_add_text_ad-res.xml +32 -0
  115. data/spec/fixtures/services/ad_group_ad/mutate_add_two_criterions-req.xml +83 -0
  116. data/spec/fixtures/services/ad_group_ad/mutate_add_two_criterions-res.xml +95 -0
  117. data/spec/fixtures/services/ad_group_criterion/get-req.xml +28 -0
  118. data/spec/fixtures/services/ad_group_criterion/get-res.xml +242 -0
  119. data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_keyword-req.xml +48 -0
  120. data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_keyword-res.xml +47 -0
  121. data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_placement-req.xml +35 -0
  122. data/spec/fixtures/services/ad_group_criterion/mutate_add_criterion_placement-res.xml +32 -0
  123. data/spec/fixtures/services/ad_group_criterion/mutate_add_negative_keyword-req.xml +37 -0
  124. data/spec/fixtures/services/ad_group_criterion/mutate_add_negative_keyword-res.xml +51 -0
  125. data/spec/fixtures/services/ad_param/mutate_set-req.xml +43 -0
  126. data/spec/fixtures/services/ad_param/mutate_set-res.xml +29 -0
  127. data/spec/fixtures/services/bulk_mutate_job/get-req.xml +36 -0
  128. data/spec/fixtures/services/bulk_mutate_job/get-res.xml +54 -0
  129. data/spec/fixtures/services/bulk_mutate_job/mutate-req.xml +69 -0
  130. data/spec/fixtures/services/bulk_mutate_job/mutate-res.xml +48 -0
  131. data/spec/fixtures/services/campaign/get-req.xml +37 -0
  132. data/spec/fixtures/services/campaign/get-res.xml +1986 -0
  133. data/spec/fixtures/services/campaign/mutate_add-req.xml +37 -0
  134. data/spec/fixtures/services/campaign/mutate_add-res.xml +42 -0
  135. data/spec/fixtures/services/error.xml +28 -0
  136. data/spec/fixtures/services/info/get_unit_count-req.xml +30 -0
  137. data/spec/fixtures/services/info/get_unit_count-res.xml +29 -0
  138. data/spec/fixtures/services/report_definition/mutate_add-req.xml +24 -0
  139. data/spec/fixtures/services/report_definition/mutate_add-req_orig.xml +45 -0
  140. data/spec/fixtures/services/targeting_idea/get-req-all-options.xml +57 -0
  141. data/spec/fixtures/services/targeting_idea/get-req.xml +60 -0
  142. data/spec/fixtures/services/targeting_idea/get-res.xml +3601 -0
  143. data/spec/fixtures/services/v13_account/get_account_info-req.xml +23 -0
  144. data/spec/fixtures/services/v13_account/get_account_info-res.xml +54 -0
  145. data/spec/fixtures/services/v13_account/get_client_accounts-req.xml +22 -0
  146. data/spec/fixtures/services/v13_account/get_client_accounts-res.xml +37 -0
  147. data/spec/fixtures/services/v13_report/get_all_jobs-req.xml +21 -0
  148. data/spec/fixtures/services/v13_report/get_all_jobs-res.xml +109 -0
  149. data/spec/fixtures/services/v13_report/schedule_report_job-req.xml +56 -0
  150. data/spec/fixtures/services/v13_report/schedule_report_job-res.xml +24 -0
  151. data/spec/sem4r/account_spec.rb +86 -0
  152. data/spec/sem4r/ad_group/ad_group_bids_spec.rb +67 -0
  153. data/spec/sem4r/ad_group/ad_group_service_spec.rb +66 -0
  154. data/spec/sem4r/ad_group/ad_group_spec.rb +212 -0
  155. data/spec/sem4r/ad_group_ad/ad_group_ad_operation_spec.rb +88 -0
  156. data/spec/sem4r/ad_group_ad/ad_group_ad_service_spec.rb +55 -0
  157. data/spec/sem4r/ad_group_ad/ad_group_ad_spec.rb +173 -0
  158. data/spec/sem4r/ad_group_criterion/ad_group_criterion_bids_spec.rb +60 -0
  159. data/spec/sem4r/ad_group_criterion/ad_group_criterion_service_spec.rb +55 -0
  160. data/spec/sem4r/ad_group_criterion/ad_group_criterion_spec.rb +103 -0
  161. data/spec/sem4r/ad_group_criterion/criterion_spec.rb +85 -0
  162. data/spec/sem4r/ad_param/ad_param_service_spec.rb +55 -0
  163. data/spec/sem4r/ad_param/ad_param_spec.rb +59 -0
  164. data/spec/sem4r/adwords_spec.rb +110 -0
  165. data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_service_spec.rb +63 -0
  166. data/spec/sem4r/bulk_mutate_job/bulk_mutate_job_spec.rb +69 -0
  167. data/spec/sem4r/bulk_mutate_job/job_operation_spec.rb +48 -0
  168. data/spec/sem4r/campaign/campaign_service_spec.rb +66 -0
  169. data/spec/sem4r/campaign/campaign_spec.rb +105 -0
  170. data/spec/sem4r/cli/cli_spec.rb +71 -0
  171. data/spec/sem4r/credentials_spec.rb +65 -0
  172. data/spec/sem4r/report_definition/report_definition_service_spec.rb +44 -0
  173. data/spec/sem4r/report_definition/report_definition_spec.rb +105 -0
  174. data/spec/sem4r/rexml_parsing_spec.rb +103 -0
  175. data/spec/sem4r/services/service_spec.rb +36 -0
  176. data/spec/sem4r/services/soap_call_spec.rb +115 -0
  177. data/spec/sem4r/services/soap_message_v13_spec.rb +54 -0
  178. data/spec/sem4r/soap_attributes_spec.rb +116 -0
  179. data/spec/sem4r/targeting_idea/targeting_idea_selector_spec.rb +120 -0
  180. data/spec/sem4r/targeting_idea/targeting_idea_service_spec.rb +44 -0
  181. data/spec/sem4r/targeting_idea/targeting_idea_spec.rb +53 -0
  182. data/spec/sem4r/v13_account/account_service_spec.rb +60 -0
  183. data/spec/sem4r/v13_report/report_service_spec.rb +104 -0
  184. data/spec/sem4r/v13_report/report_spec.rb +79 -0
  185. data/spec/sem4r_spec_helper.rb +353 -0
  186. data/spec/spec_helper.rb +12 -0
  187. metadata +375 -0
@@ -0,0 +1,23 @@
1
+ <!-- Post to 'https://sandbox.google.com/api/adwords/v13/AccountService' -->
2
+ <?xml version='1.0' encoding='UTF-8'?>
3
+ <env:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
4
+ <env:Header>
5
+ <email env:mustUnderstand='0'>
6
+ ***censured***
7
+ </email>
8
+ <password env:mustUnderstand='0'>
9
+ ***censured***
10
+ </password>
11
+ <useragent env:mustUnderstand='0'>
12
+ Sem4r Adwords Ruby Client Library (http://github.com/sem4r/sem4r)
13
+ </useragent>
14
+ <developerToken env:mustUnderstand='0'>
15
+ ***censured***
16
+ </developerToken>
17
+ </env:Header>
18
+ <env:Body>
19
+ <getAccountInfo xmlns='https://adwords.google.com/api/adwords/v13'>
20
+ </getAccountInfo>
21
+ </env:Body>
22
+ </env:Envelope>
23
+
@@ -0,0 +1,54 @@
1
+ <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
2
+ <soapenv:Header>
3
+ <responseTime soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
4
+ 216
5
+ </responseTime>
6
+ <operations soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
7
+ 1
8
+ </operations>
9
+ <units soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
10
+ 1
11
+ </units>
12
+ <requestId soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
13
+ 4165822e5178dc87b412f132b8003e68
14
+ </requestId>
15
+ </soapenv:Header>
16
+ <soapenv:Body>
17
+ <getAccountInfoResponse xmlns='https://adwords.google.com/api/adwords/v13'>
18
+ <getAccountInfoReturn>
19
+ <billingAddress>
20
+ <addressLine1>1600 Amphitheatre Parkway</addressLine1>
21
+ <addressLine2>Building #42</addressLine2>
22
+ <city>Mountain View</city>
23
+ <companyName>Some Company</companyName>
24
+ <countryCode>US</countryCode>
25
+ <emailAddress>Some@email</emailAddress>
26
+ <faxNumber>4085551213</faxNumber>
27
+ <name>Some contact</name>
28
+ <phoneNumber>4085551212</phoneNumber>
29
+ <postalCode>94043</postalCode>
30
+ <state>CA</state>
31
+ </billingAddress>
32
+ <currencyCode>EUR</currencyCode>
33
+ <customerId>0</customerId>
34
+ <defaultNetworkTargeting>
35
+ <networkTypes>GoogleSearch</networkTypes>
36
+ <networkTypes>SearchNetwork</networkTypes>
37
+ <networkTypes>ContentNetwork</networkTypes>
38
+ </defaultNetworkTargeting>
39
+ <descriptiveName/>
40
+ <emailPromotionsPreferences>
41
+ <accountPerformanceEnabled>false</accountPerformanceEnabled>
42
+ <disapprovedAdsEnabled>false</disapprovedAdsEnabled>
43
+ <marketResearchEnabled>false</marketResearchEnabled>
44
+ <newsletterEnabled>false</newsletterEnabled>
45
+ <promotionsEnabled>false</promotionsEnabled>
46
+ </emailPromotionsPreferences>
47
+ <languagePreference>en_US</languagePreference>
48
+ <timeZoneEffectiveDate>1264864627000</timeZoneEffectiveDate>
49
+ <timeZoneId>America/Los_Angeles</timeZoneId>
50
+ </getAccountInfoReturn>
51
+ </getAccountInfoResponse>
52
+ </soapenv:Body>
53
+ </soapenv:Envelope>
54
+ <!-- end -->
@@ -0,0 +1,22 @@
1
+ <!-- Post to 'https://sandbox.google.com/api/adwords/v13/AccountService' -->
2
+ <?xml version='1.0' encoding='UTF-8'?>
3
+ <env:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
4
+ <env:Header>
5
+ <email env:mustUnderstand='0'>
6
+ ***censured***
7
+ </email>
8
+ <password env:mustUnderstand='0'>
9
+ ***censured***
10
+ </password>
11
+ <useragent env:mustUnderstand='0'>
12
+ Sem4r Adwords Ruby Client Library (http://github.com/sem4r/sem4r)
13
+ </useragent>
14
+ <developerToken env:mustUnderstand='0'>
15
+ ***censured***
16
+ </developerToken>
17
+ </env:Header>
18
+ <env:Body>
19
+ <getClientAccounts xmlns='https://adwords.google.com/api/adwords/v13'>
20
+ </getClientAccounts>
21
+ </env:Body>
22
+ </env:Envelope>
@@ -0,0 +1,37 @@
1
+ <!-- response -->
2
+ <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
3
+ <soapenv:Header>
4
+ <responseTime soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
5
+ 29
6
+ </responseTime>
7
+ <operations soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
8
+ 5
9
+ </operations>
10
+ <units soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
11
+ 5
12
+ </units>
13
+ <requestId soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
14
+ 8c1431a7eac54e895c44aa3ed1d78f2a
15
+ </requestId>
16
+ </soapenv:Header>
17
+ <soapenv:Body>
18
+ <getClientAccountsResponse xmlns='https://adwords.google.com/api/adwords/v13'>
19
+ <getClientAccountsReturn>
20
+ client_1+sem4ruby@gmail.com
21
+ </getClientAccountsReturn>
22
+ <getClientAccountsReturn>
23
+ client_2+sem4ruby@gmail.com
24
+ </getClientAccountsReturn>
25
+ <getClientAccountsReturn>
26
+ client_3+sem4ruby@gmail.com
27
+ </getClientAccountsReturn>
28
+ <getClientAccountsReturn>
29
+ client_4+sem4ruby@gmail.com
30
+ </getClientAccountsReturn>
31
+ <getClientAccountsReturn>
32
+ client_5+sem4ruby@gmail.com
33
+ </getClientAccountsReturn>
34
+ </getClientAccountsResponse>
35
+ </soapenv:Body>
36
+ </soapenv:Envelope>
37
+ <!-- end -->
@@ -0,0 +1,21 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <env:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
3
+ <env:Header>
4
+ <email env:mustUnderstand='0'>
5
+ ***censured***
6
+ </email>
7
+ <password env:mustUnderstand='0'>
8
+ ***censured***
9
+ </password>
10
+ <useragent env:mustUnderstand='0'>
11
+ Sem4r Adwords Ruby Client Library (http://github.com/sem4r/sem4r)
12
+ </useragent>
13
+ <developerToken env:mustUnderstand='0'>
14
+ ***censured***
15
+ </developerToken>
16
+ </env:Header>
17
+ <env:Body>
18
+ <getAllJobs xmlns:n1='https://adwords.google.com/api/adwords/v13'>
19
+ </getAllJobs>
20
+ </env:Body>
21
+ </env:Envelope>
@@ -0,0 +1,109 @@
1
+ <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
2
+ <soapenv:Header>
3
+ <responseTime soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
4
+ 177
5
+ </responseTime>
6
+ <operations soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
7
+ 4
8
+ </operations>
9
+ <units soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
10
+ 4
11
+ </units>
12
+ <requestId soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
13
+ 2bb61a7678fae599cf1b5f6da43bd2fe
14
+ </requestId>
15
+ </soapenv:Header>
16
+ <soapenv:Body>
17
+ <getAllJobsResponse xmlns=''>
18
+
19
+ <ns1:getAllJobsReturn xsi:type='ns1:DefinedReportJob' xmlns:ns1='https://adwords.google.com/api/adwords/v13'>
20
+ <ns1:clientEmails xsi:nil='true'/>
21
+ <ns1:crossClient>false</ns1:crossClient>
22
+ <ns1:endDay>2010-02-19-08:00</ns1:endDay>
23
+ <ns1:id>11</ns1:id>
24
+ <ns1:name>report [11]</ns1:name>
25
+ <ns1:startDay>2010-02-19-08:00</ns1:startDay>
26
+ <ns1:status>Pending</ns1:status>
27
+ <ns1:includeZeroImpression>false</ns1:includeZeroImpression>
28
+ <ns1:selectedReportType xsi:nil='true'/>
29
+ </ns1:getAllJobsReturn>
30
+
31
+ <ns2:getAllJobsReturn xsi:type='ns2:DefinedReportJob' xmlns:ns2='https://adwords.google.com/api/adwords/v13'>
32
+ <ns2:clientEmails xsi:nil='true'/>
33
+ <ns2:crossClient>
34
+ false
35
+ </ns2:crossClient>
36
+ <ns2:endDay>
37
+ 2010-02-19-08:00
38
+ </ns2:endDay>
39
+ <ns2:id>
40
+ 22
41
+ </ns2:id>
42
+ <ns2:name>
43
+ report [22]
44
+ </ns2:name>
45
+ <ns2:startDay>
46
+ 2010-02-19-08:00
47
+ </ns2:startDay>
48
+ <ns2:status>
49
+ InProgress
50
+ </ns2:status>
51
+ <ns2:includeZeroImpression>
52
+ false
53
+ </ns2:includeZeroImpression>
54
+ <ns2:selectedReportType xsi:nil='true'/>
55
+ </ns2:getAllJobsReturn>
56
+ <ns3:getAllJobsReturn xsi:type='ns3:DefinedReportJob' xmlns:ns3='https://adwords.google.com/api/adwords/v13'>
57
+ <ns3:clientEmails xsi:nil='true'/>
58
+ <ns3:crossClient>
59
+ false
60
+ </ns3:crossClient>
61
+ <ns3:endDay>
62
+ 2010-02-19-08:00
63
+ </ns3:endDay>
64
+ <ns3:id>
65
+ 33
66
+ </ns3:id>
67
+ <ns3:name>
68
+ report [33]
69
+ </ns3:name>
70
+ <ns3:startDay>
71
+ 2010-02-19-08:00
72
+ </ns3:startDay>
73
+ <ns3:status>
74
+ Completed
75
+ </ns3:status>
76
+ <ns3:includeZeroImpression>
77
+ false
78
+ </ns3:includeZeroImpression>
79
+ <ns3:selectedReportType xsi:nil='true'/>
80
+ </ns3:getAllJobsReturn>
81
+ <ns4:getAllJobsReturn xsi:type='ns4:DefinedReportJob' xmlns:ns4='https://adwords.google.com/api/adwords/v13'>
82
+ <ns4:clientEmails xsi:nil='true'/>
83
+ <ns4:crossClient>
84
+ false
85
+ </ns4:crossClient>
86
+ <ns4:endDay>
87
+ 2010-02-19-08:00
88
+ </ns4:endDay>
89
+ <ns4:id>
90
+ 44
91
+ </ns4:id>
92
+ <ns4:name>
93
+ report [44]
94
+ </ns4:name>
95
+ <ns4:startDay>
96
+ 2010-02-19-08:00
97
+ </ns4:startDay>
98
+ <ns4:status>
99
+ Failed
100
+ </ns4:status>
101
+ <ns4:includeZeroImpression>
102
+ false
103
+ </ns4:includeZeroImpression>
104
+ <ns4:selectedReportType xsi:nil='true'/>
105
+ </ns4:getAllJobsReturn>
106
+ </getAllJobsResponse>
107
+ </soapenv:Body>
108
+ </soapenv:Envelope>
109
+ <!-- end -->
@@ -0,0 +1,56 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <env:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
3
+ <env:Header>
4
+ <email env:mustUnderstand='0'>
5
+ ***censured***
6
+ </email>
7
+ <password env:mustUnderstand='0'>
8
+ ***censured***
9
+ </password>
10
+ <useragent env:mustUnderstand='0'>
11
+ Sem4r Adwords Ruby Client Library (http://github.com/sem4r/sem4r)
12
+ </useragent>
13
+ <developerToken env:mustUnderstand='0'>
14
+ ***censured***
15
+ </developerToken>
16
+ </env:Header>
17
+ <env:Body>
18
+ <scheduleReportJob xmlns='https://adwords.google.com/api/adwords/v13'>
19
+ <job xsi:type='DefinedReportJob'>
20
+ <name>
21
+ Test Report
22
+ </name>
23
+ <selectedReportType>
24
+ Structure
25
+ </selectedReportType>
26
+ <startDay>
27
+ 2009-01-01
28
+ </startDay>
29
+ <endDay>
30
+ 2009-01-31
31
+ </endDay>
32
+ <aggregationTypes>
33
+ Keyword
34
+ </aggregationTypes>
35
+ <crossClient>
36
+ false
37
+ </crossClient>
38
+ <includeZeroImpression>
39
+ false
40
+ </includeZeroImpression>
41
+ <selectedColumns>
42
+ Campaign
43
+ </selectedColumns>
44
+ <selectedColumns>
45
+ AdGroup
46
+ </selectedColumns>
47
+ <selectedColumns>
48
+ Keyword
49
+ </selectedColumns>
50
+ <selectedColumns>
51
+ KeywordTypeDisplay
52
+ </selectedColumns>
53
+ </job>
54
+ </scheduleReportJob>
55
+ </env:Body>
56
+ </env:Envelope>
@@ -0,0 +1,24 @@
1
+ <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
2
+ <soapenv:Header>
3
+ <responseTime soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
4
+ 179
5
+ </responseTime>
6
+ <operations soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
7
+ 1
8
+ </operations>
9
+ <units soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
10
+ 1000
11
+ </units>
12
+ <requestId soapenv:actor='http://schemas.xmlsoap.org/soap/actor/next' soapenv:mustUnderstand='0' xmlns='https://adwords.google.com/api/adwords/v13'>
13
+ 717dfc407ebec45aca45368512f5b3e8
14
+ </requestId>
15
+ </soapenv:Header>
16
+ <soapenv:Body>
17
+ <scheduleReportJobResponse xmlns='https://adwords.google.com/api/adwords/v13'>
18
+ <scheduleReportJobReturn>
19
+ 211096915759
20
+ </scheduleReportJobReturn>
21
+ </scheduleReportJobResponse>
22
+ </soapenv:Body>
23
+ </soapenv:Envelope>
24
+ <!-- end -->
@@ -0,0 +1,86 @@
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+ # -------------------------------------------------------------------------
24
+
25
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
26
+
27
+
28
+ describe Account do
29
+
30
+ include Sem4rSpecHelper
31
+
32
+ before do
33
+ services = stub("services")
34
+ stub_service_account(services)
35
+ stub_service_info(services)
36
+ stub_service_campaign(services)
37
+ stub_service_report(services)
38
+ @adwords = stub_adwords(services)
39
+ @credentials = stub_credentials
40
+
41
+ @account = Account.new(@adwords, @credentials)
42
+ end
43
+
44
+ describe "account management" do
45
+
46
+ it "should retrieve info" do
47
+ @account.currency_code.should == "EUR"
48
+ end
49
+
50
+ it "should retrieve cost" do
51
+ @account.year_unit_cost("UNIT_COUNT").should == 100
52
+ end
53
+
54
+ end
55
+
56
+ describe "campaign management" do
57
+
58
+ it "should add an Campaign with method 'campaign' + block" do
59
+ @account.campaign do
60
+ name "campaign"
61
+ end
62
+ @account.campaigns.length.should == 1
63
+ campaign = @account.campaigns.first
64
+ campaign.id.should == 10
65
+ campaign.name.should == "campaign"
66
+ end
67
+
68
+ it "should add an Campaign with method 'campaign' + param" do
69
+ @account.campaign "campaign"
70
+
71
+ @account.campaigns.length.should == 1
72
+ campaign = @account.campaigns.first
73
+ campaign.id.should == 10
74
+ campaign.name.should == "campaign"
75
+ end
76
+
77
+ end
78
+
79
+ describe "reports management" do
80
+
81
+ it "should show reports " do
82
+ @account.should have(4).reports
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,67 @@
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+ # -------------------------------------------------------------------------
24
+
25
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
26
+
27
+ describe AdGroupBids do
28
+ include Sem4rSpecHelper
29
+
30
+ describe ManualCPCAdGroupBids do
31
+
32
+ it "should accept accessor" do
33
+ bids = ManualCPCAdGroupBids.new
34
+ bids.keyword_max_cpc 20000000
35
+ bids.site_max_cpc 30000000
36
+ bids.keyword_max_cpc.should == 20000000
37
+ bids.site_max_cpc.should == 30000000
38
+ end
39
+
40
+ it "should accept a block" do
41
+ bids = ManualCPCAdGroupBids.new do
42
+ keyword_max_cpc 20000000
43
+ site_max_cpc 30000000
44
+ end
45
+
46
+ bids.keyword_max_cpc.should == 20000000
47
+ bids.site_max_cpc.should == 30000000
48
+ end
49
+
50
+ it "should build xml (input for google)" do
51
+ bids = ManualCPCAdGroupBids.new
52
+ bids.keyword_max_cpc 20000000
53
+ bids.site_max_cpc 30000000
54
+ expected_xml = read_model("//bids", "services", "ad_group", "mutate_add-req.xml")
55
+ bids.to_xml.should xml_equivalent(expected_xml)
56
+ end
57
+
58
+ it "should parse xml (produced by google)" do
59
+ el = read_model("//bids", "services", "ad_group", "get-first-res.xml")
60
+ bids = AdGroupBids.from_element(el)
61
+ bids.keyword_max_cpc.should == 20000000
62
+ bids.site_max_cpc.should == 30000000
63
+ end
64
+
65
+ end
66
+
67
+ end
@@ -0,0 +1,66 @@
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+ # -------------------------------------------------------------------------
24
+
25
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
26
+
27
+ describe AdGroupService do
28
+ include Sem4rSpecHelper
29
+
30
+ before do
31
+ @credentials = stub_credentials
32
+ end
33
+
34
+ it "should define 'all'" do
35
+ response_xml = read_xml_file("services", "ad_group", "get-first-res.xml")
36
+ connector = mock("connector")
37
+ connector.should_receive(:send).and_return(response_xml)
38
+ service = AdGroupService.new(connector)
39
+ soap_message = service.all( @credentials, "campaign_id" )
40
+ els = REXML::XPath.match( soap_message.response, "//getResponse")
41
+ els.should_not be_empty
42
+ end
43
+
44
+ it "should define 'create'" do
45
+ @credentials.should_receive(:mutable?).and_return(true)
46
+ response_xml = read_xml_file("services", "ad_group", "mutate_add-res.xml")
47
+ connector = mock("connector")
48
+ connector.should_receive(:send).and_return(response_xml)
49
+ service = AdGroupService.new(connector)
50
+ soap_message = service.create( @credentials, "xml" )
51
+ els = REXML::XPath.match( soap_message.response, "//mutateResponse")
52
+ els.should_not be_empty
53
+ end
54
+
55
+ it "should define 'delete'" do
56
+ @credentials.should_receive(:mutable?).and_return(true)
57
+ response_xml = read_xml_file("services", "ad_group", "mutate_add-res.xml")
58
+ connector = mock("connector")
59
+ connector.should_receive(:send).and_return(response_xml)
60
+ service = AdGroupService.new(connector)
61
+ soap_message = service.delete( @credentials, "id" )
62
+ els = REXML::XPath.match( soap_message.response, "//mutateResponse")
63
+ els.should_not be_empty
64
+ end
65
+
66
+ end