soapy_bing 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +1 -0
- data/README.md +18 -18
- data/Rakefile +1 -0
- data/lib/soapy_bing.rb +5 -1
- data/lib/soapy_bing/account.rb +1 -0
- data/lib/soapy_bing/accounts.rb +13 -17
- data/lib/soapy_bing/ads.rb +18 -41
- data/lib/soapy_bing/ads/campaign_performance_report.rb +49 -0
- data/lib/soapy_bing/ads/campaigns.rb +106 -0
- data/lib/soapy_bing/ads/parsers/bulk_csv_parser.rb +34 -0
- data/lib/soapy_bing/ads/parsers/report_csv_parser.rb +45 -0
- data/lib/soapy_bing/ads/report.rb +93 -0
- data/lib/soapy_bing/campaign_management.rb +21 -0
- data/lib/soapy_bing/country_codes.rb +17 -0
- data/lib/soapy_bing/country_codes.yml +727 -0
- data/lib/soapy_bing/customer.rb +1 -0
- data/lib/soapy_bing/helpers.rb +1 -1
- data/lib/soapy_bing/helpers/zip_downloader.rb +1 -0
- data/lib/soapy_bing/oauth_credentials.rb +1 -0
- data/lib/soapy_bing/param_guard.rb +1 -0
- data/lib/soapy_bing/service.rb +69 -0
- data/lib/soapy_bing/service_operation.rb +62 -0
- data/lib/soapy_bing/version.rb +2 -1
- data/lib/soapy_bing/wsdl/ad_insight.wsdl +1 -0
- data/lib/soapy_bing/wsdl/bulk.wsdl +1 -0
- data/lib/soapy_bing/wsdl/campaign_management.wsdl +1 -0
- data/lib/soapy_bing/wsdl/customer_billing.wsdl +1 -0
- data/lib/soapy_bing/wsdl/customer_management.wsdl +1 -0
- data/lib/soapy_bing/wsdl/reporting.wsdl +1 -0
- data/lib/tasks/console.rake +1 -0
- data/lib/tasks/coverage.rake +1 -0
- data/lib/tasks/spec.rake +1 -0
- data/lib/tasks/upate_wsdl_files.rake +23 -0
- data/lib/tasks/update_country_codes.rake +24 -0
- data/soapy_bing.gemspec +2 -1
- data/spec/fixtures/ads/campaign_performance_report.csv +37 -0
- data/spec/fixtures/ads/campaign_performance_report.json +170 -0
- data/spec/fixtures/ads/campaigns_by_account_id.csv +7 -0
- data/spec/fixtures/{bulk/campaigns.json → ads/campaigns_by_account_id.json} +496 -240
- data/spec/fixtures/ads/campaigns_by_campaign_ids.csv +5 -0
- data/spec/fixtures/ads/campaigns_by_campaign_ids.json +910 -0
- data/spec/fixtures/vcr_cassettes/SoapyBing_Accounts/_list/returns_a_list_of_SoapyBing_Account_objects.yml +27 -27
- data/spec/fixtures/vcr_cassettes/SoapyBing_Ads/_campaigns/by_account_id/returns_parsed_rows.yml +301 -0
- data/spec/fixtures/vcr_cassettes/SoapyBing_Ads/_campaigns/by_campaign_ids/returns_parsed_rows.yml +300 -0
- data/spec/fixtures/vcr_cassettes/SoapyBing_CampaignManagement/_get_geo_locations/returns_a_list_of_geo_locations_hashes.yml +154 -0
- data/spec/fixtures/vcr_cassettes/campaign_performance_report/with_pending_status.yml +65 -94
- data/spec/fixtures/vcr_cassettes/campaign_performance_report/with_successful_empty_response.yml +511 -0
- data/spec/fixtures/vcr_cassettes/campaign_performance_report/with_successful_response.yml +384 -0
- data/spec/integration/soapy_bing/accounts_spec.rb +1 -0
- data/spec/integration/soapy_bing/ads_campaigns_spec.rb +85 -0
- data/spec/integration/soapy_bing/campaign_management_spec.rb +22 -0
- data/spec/integration/soapy_bing/oauth_credentials_spec.rb +1 -0
- data/spec/simplecov_setup.rb +1 -0
- data/spec/soapy_bing/account_spec.rb +6 -2
- data/spec/soapy_bing/accounts_spec.rb +47 -0
- data/spec/soapy_bing/ads/campaign_performance_report_spec.rb +79 -0
- data/spec/soapy_bing/ads/campaigns_spec.rb +99 -0
- data/spec/soapy_bing/ads/{bulk/parsers/csv_parser_spec.rb → parsers/bulk_csv_parser_spec.rb} +5 -4
- data/spec/soapy_bing/ads/{reports/parsers/csv_parser_spec.rb → parsers/report_csv_parser_spec.rb} +6 -4
- data/spec/soapy_bing/country_codes_spec.rb +39 -0
- data/spec/soapy_bing/helpers/zip_downloader_spec.rb +2 -0
- data/spec/soapy_bing/oauth_credentials_spec.rb +6 -2
- data/spec/soapy_bing/param_guard_spec.rb +2 -0
- data/spec/soapy_bing/service_spec.rb +56 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/dotenv.rb +1 -0
- data/spec/support/vcr.rb +75 -6
- metadata +74 -118
- data/lib/soapy_bing/ads/bulk.rb +0 -3
- data/lib/soapy_bing/ads/bulk/campaigns.rb +0 -65
- data/lib/soapy_bing/ads/bulk/parsers.rb +0 -2
- data/lib/soapy_bing/ads/bulk/parsers/csv_parser.rb +0 -35
- data/lib/soapy_bing/ads/reports.rb +0 -4
- data/lib/soapy_bing/ads/reports/base.rb +0 -74
- data/lib/soapy_bing/ads/reports/campaign_performance_report.rb +0 -24
- data/lib/soapy_bing/ads/reports/parsers.rb +0 -2
- data/lib/soapy_bing/ads/reports/parsers/csv_parser.rb +0 -46
- data/lib/soapy_bing/helpers/class_name.rb +0 -10
- data/lib/soapy_bing/soap.rb +0 -4
- data/lib/soapy_bing/soap/request.rb +0 -10
- data/lib/soapy_bing/soap/request/base.rb +0 -38
- data/lib/soapy_bing/soap/request/download_campaigns_by_account_ids_request.rb +0 -17
- data/lib/soapy_bing/soap/request/get_accounts_info_request.rb +0 -17
- data/lib/soapy_bing/soap/request/get_ad_groups_by_campaign_id_request.rb +0 -17
- data/lib/soapy_bing/soap/request/get_ads_by_ad_group_id_request.rb +0 -17
- data/lib/soapy_bing/soap/request/get_bulk_download_status_request.rb +0 -17
- data/lib/soapy_bing/soap/request/get_targets_by_campaign_ids_request.rb +0 -17
- data/lib/soapy_bing/soap/request/poll_generate_report_request.rb +0 -34
- data/lib/soapy_bing/soap/request/submit_generate_report_request.rb +0 -17
- data/lib/soapy_bing/soap/response.rb +0 -14
- data/lib/soapy_bing/soap/response/base.rb +0 -17
- data/lib/soapy_bing/soap/response/download_campaigns_by_account_ids_response.rb +0 -12
- data/lib/soapy_bing/soap/response/get_accounts_info_response.rb +0 -12
- data/lib/soapy_bing/soap/response/get_ad_groups_by_campaign_id_response.rb +0 -12
- data/lib/soapy_bing/soap/response/get_ads_by_ad_group_id_response.rb +0 -12
- data/lib/soapy_bing/soap/response/get_bulk_download_status_response.rb +0 -17
- data/lib/soapy_bing/soap/response/get_targets_by_campaign_ids_response.rb +0 -12
- data/lib/soapy_bing/soap/response/payload.rb +0 -28
- data/lib/soapy_bing/soap/response/poll_generate_report_response.rb +0 -14
- data/lib/soapy_bing/soap/response/report_status.rb +0 -34
- data/lib/soapy_bing/soap/response/submit_generate_report_response.rb +0 -12
- data/lib/soapy_bing/soap/template_renderer.rb +0 -22
- data/lib/soapy_bing/soap/templates/download_campaigns_by_account_ids.xml.erb +0 -22
- data/lib/soapy_bing/soap/templates/get_accounts_info.xml.erb +0 -12
- data/lib/soapy_bing/soap/templates/get_ad_groups_by_campaign_id.xml.erb +0 -15
- data/lib/soapy_bing/soap/templates/get_ads_by_ad_group_id.xml.erb +0 -15
- data/lib/soapy_bing/soap/templates/get_bulk_download_status.xml.erb +0 -15
- data/lib/soapy_bing/soap/templates/get_targets_by_campaign_ids.xml.erb +0 -20
- data/lib/soapy_bing/soap/templates/poll_generate_report.xml.erb +0 -18
- data/lib/soapy_bing/soap/templates/submit_generate_report.xml.erb +0 -46
- data/spec/fixtures/bulk/campaigns.csv +0 -8
- data/spec/fixtures/get_ad_groups_by_campaign_id.json +0 -587
- data/spec/fixtures/get_ads_by_ad_group_id.json +0 -218
- data/spec/fixtures/get_targets_by_campaign_ids.json +0 -81
- data/spec/fixtures/reports/campaign_performance_report.csv +0 -37
- data/spec/fixtures/reports/campaign_performance_report.json +0 -146
- data/spec/fixtures/soap_templates/simple.xml.erb +0 -2
- data/spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_ad_groups_by_campaign_id/1_1_1.yml +0 -150
- data/spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_ads_by_ad_group_id/1_2_1.yml +0 -141
- data/spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_targets_by_campaign_ids/1_3_1.yml +0 -111
- data/spec/fixtures/vcr_cassettes/SoapyBing_Ads_Bulk_Campaigns/_result_file_url/returns_result_file_url.yml +0 -216
- data/spec/fixtures/vcr_cassettes/campaign_performance_report/with_successful_status.yml +0 -284
- data/spec/integration/soapy_bing/ads/bulk/campaigns_spec.rb +0 -35
- data/spec/integration/soapy_bing/ads/reports/campaign_performance_report_spec.rb +0 -40
- data/spec/integration/soapy_bing/ads_spec.rb +0 -32
- data/spec/soapy_bing/ads/reports/campaign_performance_report_spec.rb +0 -42
- data/spec/soapy_bing/ads_spec.rb +0 -33
- data/spec/soapy_bing/helpers/class_name_spec.rb +0 -15
- data/spec/soapy_bing/soap/request/base_spec.rb +0 -55
- data/spec/soapy_bing/soap/request/poll_generate_report_request_spec.rb +0 -60
- data/spec/soapy_bing/soap/response/base_spec.rb +0 -13
- data/spec/soapy_bing/soap/response/get_bulk_download_status_response_spec.rb +0 -60
- data/spec/soapy_bing/soap/response/payload_spec.rb +0 -48
- data/spec/soapy_bing/soap/response/poll_generate_report_response_spec.rb +0 -26
- data/spec/soapy_bing/soap/response/report_status_spec.rb +0 -92
- data/spec/soapy_bing/soap/response/submit_generate_report_response_spec.rb +0 -20
- data/spec/soapy_bing/soap/template_renderer_spec.rb +0 -25
@@ -1,284 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://login.live.com/oauth20_token.srf
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: client_id=bing-ads-oauth-client-id&client_secret=bing-ads-oauth-client-secret&grant_type=refresh_token&refresh_token=bing-ads-oauth-refresh-token
|
9
|
-
headers:
|
10
|
-
Accept-Encoding:
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
Accept:
|
13
|
-
- "*/*"
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Cache-Control:
|
22
|
-
- no-store
|
23
|
-
Pragma:
|
24
|
-
- no-cache
|
25
|
-
Content-Length:
|
26
|
-
- '1317'
|
27
|
-
Content-Type:
|
28
|
-
- application/json
|
29
|
-
Server:
|
30
|
-
- Microsoft-IIS/8.5
|
31
|
-
X-Content-Type-Options:
|
32
|
-
- nosniff
|
33
|
-
Date:
|
34
|
-
- Fri, 13 Nov 2015 14:23:33 GMT
|
35
|
-
Connection:
|
36
|
-
- close
|
37
|
-
body:
|
38
|
-
encoding: UTF-8
|
39
|
-
string: '{"token_type":"bearer","expires_in":3600,"scope":"bingads.manage","access_token":"bing-ads-oauth-authentication-token","refresh_token":"bing-ads-oauth-refresh-token","user_id":"bing-ads-oauth-user-id"}'
|
40
|
-
http_version:
|
41
|
-
recorded_at: Fri, 13 Nov 2015 14:23:34 GMT
|
42
|
-
- request:
|
43
|
-
method: post
|
44
|
-
uri: https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V9/ReportingService.svc
|
45
|
-
body:
|
46
|
-
encoding: UTF-8
|
47
|
-
string: |
|
48
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
49
|
-
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
50
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
51
|
-
xmlns:tns="https://bingads.microsoft.com/Reporting/v9"
|
52
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
53
|
-
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
54
|
-
<env:Header>
|
55
|
-
<tns:CustomerAccountId>bing-ads-account-id</tns:CustomerAccountId>
|
56
|
-
<tns:CustomerId>bing-ads-customer-id</tns:CustomerId>
|
57
|
-
<tns:DeveloperToken>bing-ads-developer-token</tns:DeveloperToken>
|
58
|
-
<tns:AuthenticationToken>bing-ads-oauth-authentication-token</tns:AuthenticationToken>
|
59
|
-
</env:Header>
|
60
|
-
<env:Body>
|
61
|
-
<tns:SubmitGenerateReportRequest>
|
62
|
-
<tns:ReportRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:type="tns:CampaignPerformanceReportRequest">
|
63
|
-
<tns:Format>Csv</tns:Format>
|
64
|
-
<tns:Language>English</tns:Language>
|
65
|
-
<tns:ReportName>MyReport</tns:ReportName>
|
66
|
-
<tns:ReturnOnlyCompleteData>false</tns:ReturnOnlyCompleteData>
|
67
|
-
<tns:Aggregation>HourOfDay</tns:Aggregation>
|
68
|
-
<tns:Columns>
|
69
|
-
<tns:CampaignPerformanceReportColumn>TimePeriod</tns:CampaignPerformanceReportColumn>
|
70
|
-
<tns:CampaignPerformanceReportColumn>Impressions</tns:CampaignPerformanceReportColumn>
|
71
|
-
<tns:CampaignPerformanceReportColumn>Clicks</tns:CampaignPerformanceReportColumn>
|
72
|
-
<tns:CampaignPerformanceReportColumn>Spend</tns:CampaignPerformanceReportColumn>
|
73
|
-
</tns:Columns>
|
74
|
-
<tns:Scope>
|
75
|
-
<tns:AccountIds>
|
76
|
-
<arr:long>bing-ads-account-id</arr:long>
|
77
|
-
</tns:AccountIds>
|
78
|
-
</tns:Scope>
|
79
|
-
<tns:Time>
|
80
|
-
<tns:CustomDateRangeEnd>
|
81
|
-
<tns:Day>14</tns:Day>
|
82
|
-
<tns:Month>10</tns:Month>
|
83
|
-
<tns:Year>2015</tns:Year>
|
84
|
-
</tns:CustomDateRangeEnd>
|
85
|
-
<tns:CustomDateRangeStart>
|
86
|
-
<tns:Day>14</tns:Day>
|
87
|
-
<tns:Month>10</tns:Month>
|
88
|
-
<tns:Year>2015</tns:Year>
|
89
|
-
</tns:CustomDateRangeStart>
|
90
|
-
</tns:Time>
|
91
|
-
</tns:ReportRequest>
|
92
|
-
</tns:SubmitGenerateReportRequest>
|
93
|
-
</env:Body>
|
94
|
-
</env:Envelope>
|
95
|
-
headers:
|
96
|
-
Content-Type:
|
97
|
-
- text/xml;charset=UTF-8
|
98
|
-
Soapaction:
|
99
|
-
- SubmitGenerateReport
|
100
|
-
response:
|
101
|
-
status:
|
102
|
-
code: 200
|
103
|
-
message: OK
|
104
|
-
headers:
|
105
|
-
Content-Length:
|
106
|
-
- '396'
|
107
|
-
Content-Type:
|
108
|
-
- text/xml; charset=utf-8
|
109
|
-
Server:
|
110
|
-
- Microsoft-IIS/8.0
|
111
|
-
X-Powered-By:
|
112
|
-
- ASP.NET
|
113
|
-
Date:
|
114
|
-
- Fri, 13 Nov 2015 14:23:35 GMT
|
115
|
-
body:
|
116
|
-
encoding: UTF-8
|
117
|
-
string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId
|
118
|
-
xmlns:h="https://bingads.microsoft.com/Reporting/v9">bing-ads-report-tracking-id</h:TrackingId></s:Header><s:Body><SubmitGenerateReportResponse
|
119
|
-
xmlns="https://bingads.microsoft.com/Reporting/v9"><ReportRequestId>bing-ads-report-request-id</ReportRequestId></SubmitGenerateReportResponse></s:Body></s:Envelope>
|
120
|
-
http_version:
|
121
|
-
recorded_at: Fri, 13 Nov 2015 14:23:35 GMT
|
122
|
-
- request:
|
123
|
-
method: post
|
124
|
-
uri: https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V9/ReportingService.svc
|
125
|
-
body:
|
126
|
-
encoding: UTF-8
|
127
|
-
string: |
|
128
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
129
|
-
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
130
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
131
|
-
xmlns:tns="https://bingads.microsoft.com/Reporting/v9"
|
132
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
133
|
-
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
134
|
-
<env:Header>
|
135
|
-
<tns:CustomerAccountId>bing-ads-account-id</tns:CustomerAccountId>
|
136
|
-
<tns:CustomerId>bing-ads-customer-id</tns:CustomerId>
|
137
|
-
<tns:DeveloperToken>bing-ads-developer-token</tns:DeveloperToken>
|
138
|
-
<tns:AuthenticationToken>bing-ads-oauth-authentication-token</tns:AuthenticationToken>
|
139
|
-
</env:Header>
|
140
|
-
<env:Body>
|
141
|
-
<tns:PollGenerateReportRequest>
|
142
|
-
<tns:ReportRequestId xsi:nil="false">bing-ads-report-request-id</tns:ReportRequestId>
|
143
|
-
</tns:PollGenerateReportRequest>
|
144
|
-
</env:Body>
|
145
|
-
</env:Envelope>
|
146
|
-
headers:
|
147
|
-
Content-Type:
|
148
|
-
- text/xml;charset=UTF-8
|
149
|
-
Soapaction:
|
150
|
-
- PollGenerateReport
|
151
|
-
response:
|
152
|
-
status:
|
153
|
-
code: 200
|
154
|
-
message: OK
|
155
|
-
headers:
|
156
|
-
Content-Length:
|
157
|
-
- '493'
|
158
|
-
Content-Type:
|
159
|
-
- text/xml; charset=utf-8
|
160
|
-
Server:
|
161
|
-
- Microsoft-IIS/8.0
|
162
|
-
X-Powered-By:
|
163
|
-
- ASP.NET
|
164
|
-
Date:
|
165
|
-
- Fri, 13 Nov 2015 14:23:36 GMT
|
166
|
-
body:
|
167
|
-
encoding: UTF-8
|
168
|
-
string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId
|
169
|
-
xmlns:h="https://bingads.microsoft.com/Reporting/v9">bing-ads-report-tracking-id</h:TrackingId></s:Header><s:Body><PollGenerateReportResponse
|
170
|
-
xmlns="https://bingads.microsoft.com/Reporting/v9"><ReportRequestStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ReportDownloadUrl
|
171
|
-
i:nil="true"/><Status>Pending</Status></ReportRequestStatus></PollGenerateReportResponse></s:Body></s:Envelope>
|
172
|
-
http_version:
|
173
|
-
recorded_at: Fri, 13 Nov 2015 14:23:36 GMT
|
174
|
-
- request:
|
175
|
-
method: post
|
176
|
-
uri: https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V9/ReportingService.svc
|
177
|
-
body:
|
178
|
-
encoding: UTF-8
|
179
|
-
string: |
|
180
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
181
|
-
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
182
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
183
|
-
xmlns:tns="https://bingads.microsoft.com/Reporting/v9"
|
184
|
-
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
185
|
-
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
186
|
-
<env:Header>
|
187
|
-
<tns:CustomerAccountId>bing-ads-account-id</tns:CustomerAccountId>
|
188
|
-
<tns:CustomerId>bing-ads-customer-id</tns:CustomerId>
|
189
|
-
<tns:DeveloperToken>bing-ads-developer-token</tns:DeveloperToken>
|
190
|
-
<tns:AuthenticationToken>bing-ads-oauth-authentication-token</tns:AuthenticationToken>
|
191
|
-
</env:Header>
|
192
|
-
<env:Body>
|
193
|
-
<tns:PollGenerateReportRequest>
|
194
|
-
<tns:ReportRequestId xsi:nil="false">bing-ads-report-request-id</tns:ReportRequestId>
|
195
|
-
</tns:PollGenerateReportRequest>
|
196
|
-
</env:Body>
|
197
|
-
</env:Envelope>
|
198
|
-
headers:
|
199
|
-
Content-Type:
|
200
|
-
- text/xml;charset=UTF-8
|
201
|
-
Soapaction:
|
202
|
-
- PollGenerateReport
|
203
|
-
response:
|
204
|
-
status:
|
205
|
-
code: 200
|
206
|
-
message: OK
|
207
|
-
headers:
|
208
|
-
Content-Length:
|
209
|
-
- '937'
|
210
|
-
Content-Type:
|
211
|
-
- text/xml; charset=utf-8
|
212
|
-
Server:
|
213
|
-
- Microsoft-IIS/8.0
|
214
|
-
X-Powered-By:
|
215
|
-
- ASP.NET
|
216
|
-
Date:
|
217
|
-
- Fri, 13 Nov 2015 14:23:42 GMT
|
218
|
-
body:
|
219
|
-
encoding: UTF-8
|
220
|
-
string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId
|
221
|
-
xmlns:h="https://bingads.microsoft.com/Reporting/v9">bing-ads-report-tracking-id</h:TrackingId></s:Header><s:Body><PollGenerateReportResponse
|
222
|
-
xmlns="https://bingads.microsoft.com/Reporting/v9"><ReportRequestStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ReportDownloadUrl>https://download.api.bingads.microsoft.com/ReportDownload/Download.aspx?q=bing-ads-report-download-id</ReportDownloadUrl><Status>Success</Status></ReportRequestStatus></PollGenerateReportResponse></s:Body></s:Envelope>
|
223
|
-
http_version:
|
224
|
-
recorded_at: Fri, 13 Nov 2015 14:23:42 GMT
|
225
|
-
- request:
|
226
|
-
method: get
|
227
|
-
uri: https://download.api.bingads.microsoft.com/ReportDownload/Download.aspx?q=bing-ads-report-download-id
|
228
|
-
body:
|
229
|
-
encoding: US-ASCII
|
230
|
-
string: ''
|
231
|
-
headers:
|
232
|
-
Accept-Encoding:
|
233
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
234
|
-
Accept:
|
235
|
-
- "*/*"
|
236
|
-
User-Agent:
|
237
|
-
- Ruby
|
238
|
-
response:
|
239
|
-
status:
|
240
|
-
code: 200
|
241
|
-
message: OK
|
242
|
-
headers:
|
243
|
-
Cache-Control:
|
244
|
-
- private
|
245
|
-
Content-Length:
|
246
|
-
- '875'
|
247
|
-
Content-Type:
|
248
|
-
- application/x-zip-compressed
|
249
|
-
Server:
|
250
|
-
- Microsoft-IIS/8.0
|
251
|
-
Content-Disposition:
|
252
|
-
- attachment; filename="MyReport.zip"
|
253
|
-
X-Aspnet-Version:
|
254
|
-
- 4.0.30319
|
255
|
-
X-Powered-By:
|
256
|
-
- ASP.NET
|
257
|
-
Date:
|
258
|
-
- Fri, 13 Nov 2015 14:23:43 GMT
|
259
|
-
body:
|
260
|
-
encoding: ASCII-8BIT
|
261
|
-
string: !binary |-
|
262
|
-
UEsDBBQAAAAIAPCYb0c2Z8CWHQIAAPkDAAAUAE8AMzAwMDAwMDYyNjA5ODY2
|
263
|
-
Ny5jc3ZOVS4ATlVDWBQAMwAwADAAMAAwADAAMAA2ADIANgAwADkAOAA2ADYA
|
264
|
-
NwAuAGMAcwB2AHVwGQABF2t/LTMwMDAwMDA2MjYwOTg2NjcuY3N2hFNLjtQw
|
265
|
-
EN0jcQcrK5CQ21X+JrvWIGAkGhCMWLAL3e4mIt1uJelBvUNwC24wZ2CBxNyE
|
266
|
-
C3AFXOWMxAoWieP3/F69sp3f339Ur+MxDZN40e5jI1bnMq3u37sjrjoiQC3A
|
267
|
-
LFCBJYow8S4dMvG2Hbp0Ggl93o6TuEj7Yx+nuBHL67br2/d9FI/bc3aABTh2
|
268
|
-
ENgY1Sgllivx4Onq6uE/xc/Safives663O2GuGunLh0aFoq0FZv2/NeSJ10/
|
269
|
-
xWxI0Ks0xcPUtb24PKzn0jns1DZiGk6RVenT2Ag0+TvPyPLlNrdTPaou98ch
|
270
|
-
jmMuNebZRd+tP9LHm2M8bEip8kT7WucBbF3nwaN0vH1AlHW0AgwS5azUgSgk
|
271
|
-
CrwnCr3Ng/WyRqLICaE2eQiGRDpIxyKCQHMpq8kcjQSKXJGBd5Yh9gSpPBGO
|
272
|
-
9CWcIYWTWZhxXmQphWWVNI7gQEVJg4SCBE5EIYBQepREdgY1A5pB0AzCDCKD
|
273
|
-
qmaQmyUUAsNBMcypgHsPnMFyl0BtektvrZGTy1CMaG2tiTH8hlq6Upfdy35a
|
274
|
-
zo76jir7gYUKhZoTBKYUU4q6RJShhOCeMXA/XBe99Nw48nl6FvvAB2Sl5e3D
|
275
|
-
ciieU2PxNRI5B5ZdKLfB8UqvpSq3QfMxG96R0rqvpZ1v4+3XX5+/3X75ecO/
|
276
|
-
xapbD2lMW/qLhnzV+S+QYtn3Yuh2H6ZR5Osah+u4kaL6AwAA//8DAFBLAQIt
|
277
|
-
ABQAAAAIAPCYb0c2Z8CWHQIAAPkDAAAUAHUAAAAAAAAAAAAAAAAAAAAzMDAw
|
278
|
-
MDAwNjI2MDk4NjY3LmNzdk5VMABOVUNYFAAAADMAMAAwADAAMAAwADAANgAy
|
279
|
-
ADYAMAA5ADgANgA2ADcALgBjAHMAdgAKACAAAAAAAAEAGAD8qUTvGyDRAfyp
|
280
|
-
RO8bINEBN3BD7xsg0QF1cBkAARdrfy0zMDAwMDAwNjI2MDk4NjY3LmNzdlBL
|
281
|
-
BQYAAAAAAQABALcAAACeAgAAAAA=
|
282
|
-
http_version:
|
283
|
-
recorded_at: Fri, 13 Nov 2015 14:23:43 GMT
|
284
|
-
recorded_with: VCR 3.0.0
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe SoapyBing::Ads::Bulk::Campaigns do
|
3
|
-
let(:service) { SoapyBing::Ads.new }
|
4
|
-
subject(:bulk_campaigns) { service.bulk_campaigns }
|
5
|
-
|
6
|
-
describe '#rows' do
|
7
|
-
let(:test_csv) { <<~CSV }
|
8
|
-
a,b,c
|
9
|
-
1,2,3
|
10
|
-
x,,z
|
11
|
-
CSV
|
12
|
-
let(:zip_downloader) do
|
13
|
-
instance_double(SoapyBing::Helpers::ZipDownloader, read: test_csv)
|
14
|
-
end
|
15
|
-
it 'returns an array of rows as hashes' do
|
16
|
-
expect(SoapyBing::Helpers::ZipDownloader).to receive(:new).and_return(zip_downloader)
|
17
|
-
expect(bulk_campaigns).to receive(:result_file_url)
|
18
|
-
expect(bulk_campaigns.rows).to eq(
|
19
|
-
[
|
20
|
-
{ 'a' => '1', 'b' => '2', 'c' => '3' },
|
21
|
-
{ 'a' => 'x', 'b' => nil, 'c' => 'z' }
|
22
|
-
]
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#result_file_url', :vcr do
|
28
|
-
let(:result_file_url_template) do
|
29
|
-
%r{https://bingadsappsstorageprod\.blob\.core\.windows\.net/bulkdownloadresultfiles/DownloadHierarchy.*\.zip\?.*} # rubocop:disable Metrics/LineLength
|
30
|
-
end
|
31
|
-
it 'returns result file url' do
|
32
|
-
expect(bulk_campaigns.result_file_url).to match(result_file_url_template)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
RSpec.describe SoapyBing::Ads::Reports::CampaignPerformanceReport do
|
5
|
-
let(:service) { SoapyBing::Ads.new }
|
6
|
-
let(:report) do
|
7
|
-
service.campaign_performance_report(
|
8
|
-
date_start: '2015-10-14',
|
9
|
-
date_end: '2015-10-14',
|
10
|
-
# CampaignName is considered to be a sensitive data, lets not record it
|
11
|
-
settings: { columns: %w(TimePeriod Impressions Clicks Spend) }
|
12
|
-
)
|
13
|
-
end
|
14
|
-
let(:payload_fixture_path) do
|
15
|
-
File.join('spec', 'fixtures', 'reports', 'campaign_performance_report.json')
|
16
|
-
end
|
17
|
-
let(:fixtured_payload) { JSON.load(File.read(payload_fixture_path)) }
|
18
|
-
|
19
|
-
describe '#rows' do
|
20
|
-
subject(:rows) { report.rows }
|
21
|
-
|
22
|
-
context 'when there is a successfull response during polling', :integration do
|
23
|
-
it 'responds with report rows',
|
24
|
-
vcr: { cassette_name: 'campaign_performance_report/with_successful_status' } do
|
25
|
-
expect(rows).to eq fixtured_payload
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'when there is only pending responses during polling', :integration do
|
30
|
-
before { stub_const('SoapyBing::Soap::Request::PollGenerateReportRequest::POLLING_TRIES', 1) }
|
31
|
-
|
32
|
-
it 'throws exception PollingTimeoutError',
|
33
|
-
vcr: { cassette_name: 'campaign_performance_report/with_pending_status' } do
|
34
|
-
expect { rows }.to raise_error(
|
35
|
-
SoapyBing::Soap::Request::PollGenerateReportRequest::PollingTimeoutError
|
36
|
-
)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe SoapyBing::Ads do
|
3
|
-
let(:campaign_id) { 91834220 }
|
4
|
-
let(:ad_group_id) { 4464286758 }
|
5
|
-
let(:fixture_payload) { JSON.load(File.read(File.join('spec', 'fixtures', fixture_file))) }
|
6
|
-
|
7
|
-
subject(:instance) { described_class.new }
|
8
|
-
|
9
|
-
describe '#get_ad_groups_by_campaign_id', :vcr do
|
10
|
-
let(:fixture_file) { 'get_ad_groups_by_campaign_id.json' }
|
11
|
-
|
12
|
-
subject(:ad_groups) { instance.get_ad_groups_by_campaign_id(campaign_id) }
|
13
|
-
|
14
|
-
it { expect(ad_groups).to eq(fixture_payload) }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#get_ads_by_ad_group_id', :vcr do
|
18
|
-
let(:fixture_file) { 'get_ads_by_ad_group_id.json' }
|
19
|
-
|
20
|
-
subject(:ads) { instance.get_ads_by_ad_group_id(ad_group_id) }
|
21
|
-
|
22
|
-
it { expect(ads).to eq(fixture_payload) }
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#get_targets_by_campaign_ids', :vcr do
|
26
|
-
let(:fixture_file) { 'get_targets_by_campaign_ids.json' }
|
27
|
-
|
28
|
-
subject(:targets) { instance.get_targets_by_campaign_ids([campaign_id]) }
|
29
|
-
|
30
|
-
it { expect(targets).to eq(fixture_payload) }
|
31
|
-
end
|
32
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'date'
|
3
|
-
|
4
|
-
RSpec.describe SoapyBing::Ads::Reports::CampaignPerformanceReport do
|
5
|
-
let(:report_options) { { oauth_credentials: nil, account: nil } }
|
6
|
-
subject(:report) { described_class.new report_options }
|
7
|
-
|
8
|
-
describe '#initialize' do
|
9
|
-
let(:wrong_date) { 'wrong_date' }
|
10
|
-
|
11
|
-
context 'when there is a wrong date format' do
|
12
|
-
before { report_options.merge!(date_start: wrong_date) }
|
13
|
-
|
14
|
-
let(:start_date) { 'wrong_date' }
|
15
|
-
it 'throws exception' do
|
16
|
-
expect { report }.to raise_error(ArgumentError, 'invalid date')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#date_range' do
|
22
|
-
let(:date_start) { '2011-01-01' }
|
23
|
-
let(:date_end) { '2015-12-31' }
|
24
|
-
before { report_options.merge!(date_start: date_start, date_end: date_end) }
|
25
|
-
|
26
|
-
it 'is instance of Range' do
|
27
|
-
expect(report.date_range).to be_an_instance_of Range
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'begin' do
|
31
|
-
it 'keeps initialized value' do
|
32
|
-
expect(report.date_range.begin).to eq Date.parse(date_start)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'end' do
|
37
|
-
it 'keeps initialized value' do
|
38
|
-
expect(report.date_range.end).to eq Date.parse(date_end)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/spec/soapy_bing/ads_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
RSpec.describe SoapyBing::Ads do
|
3
|
-
let(:oauth) do
|
4
|
-
{ client_id: 'foo', client_secret: 'bar', refresh_token: 'baz' }
|
5
|
-
end
|
6
|
-
let(:account) do
|
7
|
-
{ developer_token: 'foo', account_id: 'baz', customer_id: 'qux' }
|
8
|
-
end
|
9
|
-
subject(:ads) { described_class.new(oauth: oauth, account: account) }
|
10
|
-
|
11
|
-
describe '#oauth_credentials' do
|
12
|
-
it 'is instance of SoapyBing::OauthCredentials' do
|
13
|
-
expect(ads.oauth_credentials).to be_an_instance_of SoapyBing::OauthCredentials
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#account' do
|
18
|
-
it 'is instance of SoapyBing::Account' do
|
19
|
-
expect(ads.account).to be_an_instance_of SoapyBing::Account
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#campaign_performance_report' do
|
24
|
-
subject(:report) do
|
25
|
-
described_class
|
26
|
-
.new(oauth: oauth, account: account)
|
27
|
-
.campaign_performance_report(date_start: '2015-01-01', date_end: '2015-01-01')
|
28
|
-
end
|
29
|
-
it 'is instance of SoapyBing::Ads::Reports::CampaignPerformanceReport' do
|
30
|
-
expect(report).to be_an_instance_of SoapyBing::Ads::Reports::CampaignPerformanceReport
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|