soapy_bing 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/lib/soapy_bing/ads/bulk/campaigns.rb +61 -0
  4. data/lib/soapy_bing/ads/bulk/parsers/csv_parser.rb +35 -0
  5. data/lib/soapy_bing/ads/bulk/parsers.rb +2 -0
  6. data/lib/soapy_bing/ads/bulk.rb +3 -0
  7. data/lib/soapy_bing/ads/reports/base.rb +1 -19
  8. data/lib/soapy_bing/ads.rb +9 -0
  9. data/lib/soapy_bing/helpers/zip_downloader.rb +26 -0
  10. data/lib/soapy_bing/helpers.rb +1 -1
  11. data/lib/soapy_bing/soap/request/download_campaigns_by_account_ids_request.rb +17 -0
  12. data/lib/soapy_bing/soap/request/get_bulk_download_status_request.rb +17 -0
  13. data/lib/soapy_bing/soap/request.rb +2 -0
  14. data/lib/soapy_bing/soap/response/download_campaigns_by_account_ids_response.rb +12 -0
  15. data/lib/soapy_bing/soap/response/get_accounts_info_response.rb +1 -1
  16. data/lib/soapy_bing/soap/response/get_ad_groups_by_campaign_id_response.rb +1 -1
  17. data/lib/soapy_bing/soap/response/get_ads_by_ad_group_id_response.rb +1 -1
  18. data/lib/soapy_bing/soap/response/get_bulk_download_status_response.rb +12 -0
  19. data/lib/soapy_bing/soap/response/get_targets_by_campaign_ids_response.rb +1 -1
  20. data/lib/soapy_bing/soap/response/payload.rb +13 -1
  21. data/lib/soapy_bing/soap/response/report_status.rb +1 -1
  22. data/lib/soapy_bing/soap/response/submit_generate_report_response.rb +1 -1
  23. data/lib/soapy_bing/soap/response.rb +2 -0
  24. data/lib/soapy_bing/soap/template_renderer.rb +1 -1
  25. data/lib/soapy_bing/soap/templates/download_campaigns_by_account_ids.xml.erb +22 -0
  26. data/lib/soapy_bing/soap/templates/{get_accounts_info.erb.xml → get_accounts_info.xml.erb} +0 -0
  27. data/lib/soapy_bing/soap/templates/{get_ad_groups_by_campaign_id.erb.xml → get_ad_groups_by_campaign_id.xml.erb} +0 -0
  28. data/lib/soapy_bing/soap/templates/{get_ads_by_ad_group_id.erb.xml → get_ads_by_ad_group_id.xml.erb} +0 -0
  29. data/lib/soapy_bing/soap/templates/get_bulk_download_status.xml.erb +15 -0
  30. data/lib/soapy_bing/soap/templates/{get_targets_by_campaign_ids.erb.xml → get_targets_by_campaign_ids.xml.erb} +0 -0
  31. data/lib/soapy_bing/soap/templates/{poll_generate_report.erb.xml → poll_generate_report.xml.erb} +0 -0
  32. data/lib/soapy_bing/soap/templates/{submit_generate_report.erb.xml → submit_generate_report.xml.erb} +0 -0
  33. data/lib/soapy_bing/version.rb +1 -1
  34. data/spec/fixtures/bulk/campaigns.csv +8 -0
  35. data/spec/fixtures/bulk/campaigns.json +1108 -0
  36. data/spec/fixtures/helpers/hello.zip +0 -0
  37. data/spec/fixtures/soap_templates/{simple.erb.xml → simple.xml.erb} +0 -0
  38. data/spec/fixtures/vcr_cassettes/SoapyBing_Ads_Bulk_Campaigns/_result_file_url/returns_result_file_url.yml +216 -0
  39. data/spec/integration/soapy_bing/ads/bulk/campaigns_spec.rb +35 -0
  40. data/spec/soapy_bing/ads/bulk/parsers/csv_parser_spec.rb +22 -0
  41. data/spec/soapy_bing/helpers/zip_downloader_spec.rb +16 -0
  42. data/spec/soapy_bing/soap/response/payload_spec.rb +26 -4
  43. data/spec/soapy_bing/soap/template_renderer_spec.rb +2 -2
  44. metadata +35 -13
  45. data/lib/soapy_bing/helpers/ssl_version.rb +0 -18
  46. data/spec/soapy_bing/helpers/ssl_version_spec.rb +0 -26
Binary file
@@ -0,0 +1,216 @@
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
+ - '1509'
27
+ Content-Type:
28
+ - application/json
29
+ Server:
30
+ - Microsoft-IIS/8.5
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Strict-Transport-Security:
34
+ - max-age=31536000
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ Date:
38
+ - Fri, 09 Sep 2016 14:46:46 GMT
39
+ Connection:
40
+ - close
41
+ body:
42
+ encoding: UTF-8
43
+ 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"}'
44
+ http_version:
45
+ recorded_at: Fri, 09 Sep 2016 14:46:47 GMT
46
+ - request:
47
+ method: post
48
+ uri: https://bulk.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V10/BulkService.svc
49
+ body:
50
+ encoding: UTF-8
51
+ string: |
52
+ <?xml version="1.0" encoding="UTF-8"?>
53
+ <s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
54
+ <s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
55
+ <Action mustUnderstand="1">DownloadCampaignsByAccountIds</Action>
56
+ <AuthenticationToken i:nil="false">bing-ads-oauth-authentication-token</AuthenticationToken>
57
+ <CustomerAccountId i:nil="false">bing-ads-account-id</CustomerAccountId>
58
+ <CustomerId i:nil="false">bing-ads-customer-id</CustomerId>
59
+ <DeveloperToken i:nil="false">bing-ads-developer-token</DeveloperToken>
60
+ </s:Header>
61
+ <s:Body>
62
+ <DownloadCampaignsByAccountIdsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
63
+ <AccountIds i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
64
+ <a1:long>bing-ads-account-id</a1:long>
65
+ </AccountIds>
66
+ <CompressionType i:nil="false">Zip</CompressionType>
67
+ <DataScope>EntityData</DataScope>
68
+ <DownloadFileType i:nil="false">Csv</DownloadFileType>
69
+ <Entities>CampaignTargets Ads</Entities>
70
+ <FormatVersion i:nil="false">4.0</FormatVersion>
71
+ </DownloadCampaignsByAccountIdsRequest>
72
+ </s:Body>
73
+ </s:Envelope>
74
+ headers:
75
+ Content-Type:
76
+ - text/xml;charset=UTF-8
77
+ Soapaction:
78
+ - DownloadCampaignsByAccountIds
79
+ response:
80
+ status:
81
+ code: 200
82
+ message: OK
83
+ headers:
84
+ Cache-Control:
85
+ - private
86
+ Content-Length:
87
+ - '431'
88
+ Content-Type:
89
+ - text/xml; charset=utf-8
90
+ Server:
91
+ - Microsoft-IIS/8.0
92
+ X-Aspnet-Version:
93
+ - 4.0.30319
94
+ X-Powered-By:
95
+ - ASP.NET
96
+ Date:
97
+ - Fri, 09 Sep 2016 14:46:48 GMT
98
+ body:
99
+ encoding: UTF-8
100
+ string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId
101
+ xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">bing-ads-report-tracking-id</h:TrackingId></s:Header><s:Body><DownloadCampaignsByAccountIdsResponse
102
+ xmlns="https://bingads.microsoft.com/CampaignManagement/v10"><DownloadRequestId>154890307</DownloadRequestId></DownloadCampaignsByAccountIdsResponse></s:Body></s:Envelope>
103
+ http_version:
104
+ recorded_at: Fri, 09 Sep 2016 14:46:48 GMT
105
+ - request:
106
+ method: post
107
+ uri: https://bulk.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V10/BulkService.svc
108
+ body:
109
+ encoding: UTF-8
110
+ string: |
111
+ <?xml version="1.0" encoding="UTF-8"?>
112
+ <s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
113
+ <s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
114
+ <Action mustUnderstand="1">GetBulkDownloadStatus</Action>
115
+ <AuthenticationToken i:nil="false">bing-ads-oauth-authentication-token</AuthenticationToken>
116
+ <CustomerAccountId i:nil="false">bing-ads-account-id</CustomerAccountId>
117
+ <CustomerId i:nil="false">bing-ads-customer-id</CustomerId>
118
+ <DeveloperToken i:nil="false">bing-ads-developer-token</DeveloperToken>
119
+ </s:Header>
120
+ <s:Body>
121
+ <GetBulkDownloadStatusRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
122
+ <RequestId i:nil="false">154890307</RequestId>
123
+ </GetBulkDownloadStatusRequest>
124
+ </s:Body>
125
+ </s:Envelope>
126
+ headers:
127
+ Content-Type:
128
+ - text/xml;charset=UTF-8
129
+ Soapaction:
130
+ - GetBulkDownloadStatus
131
+ response:
132
+ status:
133
+ code: 200
134
+ message: OK
135
+ headers:
136
+ Cache-Control:
137
+ - private
138
+ Content-Length:
139
+ - '754'
140
+ Content-Type:
141
+ - text/xml; charset=utf-8
142
+ Server:
143
+ - Microsoft-IIS/8.5
144
+ X-Aspnet-Version:
145
+ - 4.0.30319
146
+ X-Powered-By:
147
+ - ASP.NET
148
+ Date:
149
+ - Fri, 09 Sep 2016 14:46:49 GMT
150
+ body:
151
+ encoding: UTF-8
152
+ string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId
153
+ xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">bing-ads-report-tracking-id</h:TrackingId></s:Header><s:Body><GetBulkDownloadStatusResponse
154
+ xmlns="https://bingads.microsoft.com/CampaignManagement/v10"><Errors i:nil="true"
155
+ xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/><ForwardCompatibilityMap
156
+ xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic"
157
+ xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/><PercentComplete>1</PercentComplete><RequestStatus>InProgress</RequestStatus><ResultFileUrl
158
+ i:nil="true" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/></GetBulkDownloadStatusResponse></s:Body></s:Envelope>
159
+ http_version:
160
+ recorded_at: Fri, 09 Sep 2016 14:46:50 GMT
161
+ - request:
162
+ method: post
163
+ uri: https://bulk.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V10/BulkService.svc
164
+ body:
165
+ encoding: UTF-8
166
+ string: |
167
+ <?xml version="1.0" encoding="UTF-8"?>
168
+ <s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
169
+ <s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
170
+ <Action mustUnderstand="1">GetBulkDownloadStatus</Action>
171
+ <AuthenticationToken i:nil="false">bing-ads-oauth-authentication-token</AuthenticationToken>
172
+ <CustomerAccountId i:nil="false">bing-ads-account-id</CustomerAccountId>
173
+ <CustomerId i:nil="false">bing-ads-customer-id</CustomerId>
174
+ <DeveloperToken i:nil="false">bing-ads-developer-token</DeveloperToken>
175
+ </s:Header>
176
+ <s:Body>
177
+ <GetBulkDownloadStatusRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v10">
178
+ <RequestId i:nil="false">154890307</RequestId>
179
+ </GetBulkDownloadStatusRequest>
180
+ </s:Body>
181
+ </s:Envelope>
182
+ headers:
183
+ Content-Type:
184
+ - text/xml;charset=UTF-8
185
+ Soapaction:
186
+ - GetBulkDownloadStatus
187
+ response:
188
+ status:
189
+ code: 200
190
+ message: OK
191
+ headers:
192
+ Cache-Control:
193
+ - private
194
+ Content-Length:
195
+ - '1004'
196
+ Content-Type:
197
+ - text/xml; charset=utf-8
198
+ Server:
199
+ - Microsoft-IIS/8.5
200
+ X-Aspnet-Version:
201
+ - 4.0.30319
202
+ X-Powered-By:
203
+ - ASP.NET
204
+ Date:
205
+ - Fri, 09 Sep 2016 14:46:53 GMT
206
+ body:
207
+ encoding: UTF-8
208
+ string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId
209
+ xmlns:h="https://bingads.microsoft.com/CampaignManagement/v10">bing-ads-report-tracking-id</h:TrackingId></s:Header><s:Body><GetBulkDownloadStatusResponse
210
+ xmlns="https://bingads.microsoft.com/CampaignManagement/v10"><Errors i:nil="true"
211
+ xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/><ForwardCompatibilityMap
212
+ xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic"
213
+ xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/><PercentComplete>100</PercentComplete><RequestStatus>Completed</RequestStatus><ResultFileUrl>https://bingadsappsstorageprod.blob.core.windows.net/bulkdownloadresultfiles/DownloadHierarchy-154890307-58bad0ef-83d5-4362-a951-e07d57b2bd2b.zip?sv=2014-02-14&amp;sr=b&amp;sig=tStnHwvyqAAJqitslN%2BuRYxlMXB2UYFYepPVJzT1sJg%3D&amp;st=2016-09-09T14%3A41%3A53Z&amp;se=2016-09-09T15%3A06%3A53Z&amp;sp=rl</ResultFileUrl></GetBulkDownloadStatusResponse></s:Body></s:Envelope>
214
+ http_version:
215
+ recorded_at: Fri, 09 Sep 2016 14:46:53 GMT
216
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,35 @@
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
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+
4
+ RSpec.describe SoapyBing::Ads::Bulk::Parsers::CSVParser do
5
+ describe '#rows' do
6
+ subject(:rows) { described_class.new(csv_data).rows }
7
+
8
+ let(:csv_fixture_path) do
9
+ File.join('spec', 'fixtures', 'bulk', 'campaigns.csv')
10
+ end
11
+ let(:csv_data) { File.read(csv_fixture_path) }
12
+
13
+ let(:json_fixture_path) do
14
+ File.join('spec', 'fixtures', 'bulk', 'campaigns.json')
15
+ end
16
+ let(:json_data) { JSON.load(File.read(json_fixture_path)) }
17
+
18
+ it 'responds with array of Hashes' do
19
+ expect(rows).to eq json_data
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe SoapyBing::Helpers::ZipDownloader do
3
+ describe '#read' do
4
+ let(:hello_zip_file_path) { File.join('spec', 'fixtures', 'helpers', 'hello.zip') }
5
+ let(:hello_response) do
6
+ instance_double(HTTParty::Response, body: File.read(hello_zip_file_path))
7
+ end
8
+ let(:download_url) { 'https://example.com/file.zip' }
9
+ subject(:instance) { described_class.new(download_url) }
10
+
11
+ it 'unzips and reads file content' do
12
+ expect(HTTParty).to receive(:get).with(download_url).and_return(hello_response)
13
+ expect(instance.read).to eq("Hello World\n")
14
+ end
15
+ end
16
+ end
@@ -3,19 +3,41 @@ RSpec.describe SoapyBing::Soap::Response::Payload do
3
3
  before do
4
4
  stub_const(
5
5
  'MyCustomResponse',
6
- Class
7
- .new
8
- .include(described_class)
6
+ Class.new(SoapyBing::Soap::Response::Base).include(described_class)
9
7
  )
10
8
  end
11
9
 
12
- subject(:response) { MyCustomResponse.new }
10
+ let(:body) { {} }
11
+ subject(:response) { MyCustomResponse.new(body) }
13
12
 
14
13
  describe '#payload' do
15
14
  it 'memoize #extract_payload value' do
16
15
  expect(response).to receive(:extract_payload).once.and_return(true)
17
16
  2.times { response.payload }
18
17
  end
18
+
19
+ context 'faulty response' do
20
+ let(:body) do
21
+ {
22
+ 'Envelope' => {
23
+ 'Body' => {
24
+ 'Fault' => {
25
+ 'FaultCode' => '123',
26
+ 'FaultMessage' => 'Fault Test'
27
+ }
28
+ }
29
+ }
30
+ }
31
+ end
32
+ let(:expected_error_message) do
33
+ '{"FaultCode"=>"123", "FaultMessage"=>"Fault Test"}'
34
+ end
35
+ it 'raises a Fault exception with fault message' do
36
+ expect { response.payload }.to raise_error(
37
+ SoapyBing::Soap::Response::Payload::Fault, expected_error_message
38
+ )
39
+ end
40
+ end
19
41
  end
20
42
 
21
43
  describe '#extract_payload' do
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe SoapyBing::Soap::TemplateRenderer do
3
3
  describe '::TEMPLATE_PATH' do
4
- let(:files) { Dir.glob(File.join(described_class::TEMPLATE_PATH, '*.erb.xml')) }
4
+ let(:files) { Dir.glob(File.join(described_class::TEMPLATE_PATH, '*.xml.erb')) }
5
5
 
6
- it 'points to folder with *.erb.xml files' do
6
+ it 'points to folder with *.xml.erb files' do
7
7
  expect(files.size).to be > 1
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soapy_bing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-19 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -197,6 +197,10 @@ files:
197
197
  - lib/soapy_bing/account.rb
198
198
  - lib/soapy_bing/accounts.rb
199
199
  - lib/soapy_bing/ads.rb
200
+ - lib/soapy_bing/ads/bulk.rb
201
+ - lib/soapy_bing/ads/bulk/campaigns.rb
202
+ - lib/soapy_bing/ads/bulk/parsers.rb
203
+ - lib/soapy_bing/ads/bulk/parsers/csv_parser.rb
200
204
  - lib/soapy_bing/ads/reports.rb
201
205
  - lib/soapy_bing/ads/reports/base.rb
202
206
  - lib/soapy_bing/ads/reports/campaign_performance_report.rb
@@ -205,64 +209,76 @@ files:
205
209
  - lib/soapy_bing/customer.rb
206
210
  - lib/soapy_bing/helpers.rb
207
211
  - lib/soapy_bing/helpers/class_name.rb
208
- - lib/soapy_bing/helpers/ssl_version.rb
212
+ - lib/soapy_bing/helpers/zip_downloader.rb
209
213
  - lib/soapy_bing/oauth_credentials.rb
210
214
  - lib/soapy_bing/param_guard.rb
211
215
  - lib/soapy_bing/soap.rb
212
216
  - lib/soapy_bing/soap/request.rb
213
217
  - lib/soapy_bing/soap/request/base.rb
218
+ - lib/soapy_bing/soap/request/download_campaigns_by_account_ids_request.rb
214
219
  - lib/soapy_bing/soap/request/get_accounts_info_request.rb
215
220
  - lib/soapy_bing/soap/request/get_ad_groups_by_campaign_id_request.rb
216
221
  - lib/soapy_bing/soap/request/get_ads_by_ad_group_id_request.rb
222
+ - lib/soapy_bing/soap/request/get_bulk_download_status_request.rb
217
223
  - lib/soapy_bing/soap/request/get_targets_by_campaign_ids_request.rb
218
224
  - lib/soapy_bing/soap/request/poll_generate_report_request.rb
219
225
  - lib/soapy_bing/soap/request/submit_generate_report_request.rb
220
226
  - lib/soapy_bing/soap/response.rb
221
227
  - lib/soapy_bing/soap/response/base.rb
228
+ - lib/soapy_bing/soap/response/download_campaigns_by_account_ids_response.rb
222
229
  - lib/soapy_bing/soap/response/get_accounts_info_response.rb
223
230
  - lib/soapy_bing/soap/response/get_ad_groups_by_campaign_id_response.rb
224
231
  - lib/soapy_bing/soap/response/get_ads_by_ad_group_id_response.rb
232
+ - lib/soapy_bing/soap/response/get_bulk_download_status_response.rb
225
233
  - lib/soapy_bing/soap/response/get_targets_by_campaign_ids_response.rb
226
234
  - lib/soapy_bing/soap/response/payload.rb
227
235
  - lib/soapy_bing/soap/response/poll_generate_report_response.rb
228
236
  - lib/soapy_bing/soap/response/report_status.rb
229
237
  - lib/soapy_bing/soap/response/submit_generate_report_response.rb
230
238
  - lib/soapy_bing/soap/template_renderer.rb
231
- - lib/soapy_bing/soap/templates/get_accounts_info.erb.xml
232
- - lib/soapy_bing/soap/templates/get_ad_groups_by_campaign_id.erb.xml
233
- - lib/soapy_bing/soap/templates/get_ads_by_ad_group_id.erb.xml
234
- - lib/soapy_bing/soap/templates/get_targets_by_campaign_ids.erb.xml
235
- - lib/soapy_bing/soap/templates/poll_generate_report.erb.xml
236
- - lib/soapy_bing/soap/templates/submit_generate_report.erb.xml
239
+ - lib/soapy_bing/soap/templates/download_campaigns_by_account_ids.xml.erb
240
+ - lib/soapy_bing/soap/templates/get_accounts_info.xml.erb
241
+ - lib/soapy_bing/soap/templates/get_ad_groups_by_campaign_id.xml.erb
242
+ - lib/soapy_bing/soap/templates/get_ads_by_ad_group_id.xml.erb
243
+ - lib/soapy_bing/soap/templates/get_bulk_download_status.xml.erb
244
+ - lib/soapy_bing/soap/templates/get_targets_by_campaign_ids.xml.erb
245
+ - lib/soapy_bing/soap/templates/poll_generate_report.xml.erb
246
+ - lib/soapy_bing/soap/templates/submit_generate_report.xml.erb
237
247
  - lib/soapy_bing/version.rb
238
248
  - lib/tasks/console.rake
239
249
  - lib/tasks/coverage.rake
240
250
  - lib/tasks/spec.rake
241
251
  - soapy_bing.gemspec
252
+ - spec/fixtures/bulk/campaigns.csv
253
+ - spec/fixtures/bulk/campaigns.json
242
254
  - spec/fixtures/get_ad_groups_by_campaign_id.json
243
255
  - spec/fixtures/get_ads_by_ad_group_id.json
244
256
  - spec/fixtures/get_targets_by_campaign_ids.json
257
+ - spec/fixtures/helpers/hello.zip
245
258
  - spec/fixtures/reports/campaign_performance_report.csv
246
259
  - spec/fixtures/reports/campaign_performance_report.json
247
- - spec/fixtures/soap_templates/simple.erb.xml
260
+ - spec/fixtures/soap_templates/simple.xml.erb
248
261
  - spec/fixtures/vcr_cassettes/SoapyBing_Accounts/_list/returns_a_list_of_SoapyBing_Account_objects.yml
249
262
  - spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_ad_groups_by_campaign_id/1_1_1.yml
250
263
  - spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_ads_by_ad_group_id/1_2_1.yml
251
264
  - spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_targets_by_campaign_ids/1_3_1.yml
265
+ - spec/fixtures/vcr_cassettes/SoapyBing_Ads_Bulk_Campaigns/_result_file_url/returns_result_file_url.yml
252
266
  - spec/fixtures/vcr_cassettes/campaign_performance_report/with_pending_status.yml
253
267
  - spec/fixtures/vcr_cassettes/campaign_performance_report/with_successful_status.yml
254
268
  - spec/fixtures/vcr_cassettes/oauth_credentials/access_token/with_successful_status.yml
255
269
  - spec/integration/soapy_bing/accounts_spec.rb
270
+ - spec/integration/soapy_bing/ads/bulk/campaigns_spec.rb
256
271
  - spec/integration/soapy_bing/ads/reports/campaign_performance_report_spec.rb
257
272
  - spec/integration/soapy_bing/ads_spec.rb
258
273
  - spec/integration/soapy_bing/oauth_credentials_spec.rb
259
274
  - spec/simplecov_setup.rb
260
275
  - spec/soapy_bing/account_spec.rb
276
+ - spec/soapy_bing/ads/bulk/parsers/csv_parser_spec.rb
261
277
  - spec/soapy_bing/ads/reports/campaign_performance_report_spec.rb
262
278
  - spec/soapy_bing/ads/reports/parsers/csv_parser_spec.rb
263
279
  - spec/soapy_bing/ads_spec.rb
264
280
  - spec/soapy_bing/helpers/class_name_spec.rb
265
- - spec/soapy_bing/helpers/ssl_version_spec.rb
281
+ - spec/soapy_bing/helpers/zip_downloader_spec.rb
266
282
  - spec/soapy_bing/oauth_credentials_spec.rb
267
283
  - spec/soapy_bing/param_guard_spec.rb
268
284
  - spec/soapy_bing/soap/request/base_spec.rb
@@ -301,30 +317,36 @@ signing_key:
301
317
  specification_version: 4
302
318
  summary: Simple client for the Bing Ads APIs
303
319
  test_files:
320
+ - spec/fixtures/bulk/campaigns.csv
321
+ - spec/fixtures/bulk/campaigns.json
304
322
  - spec/fixtures/get_ad_groups_by_campaign_id.json
305
323
  - spec/fixtures/get_ads_by_ad_group_id.json
306
324
  - spec/fixtures/get_targets_by_campaign_ids.json
325
+ - spec/fixtures/helpers/hello.zip
307
326
  - spec/fixtures/reports/campaign_performance_report.csv
308
327
  - spec/fixtures/reports/campaign_performance_report.json
309
- - spec/fixtures/soap_templates/simple.erb.xml
328
+ - spec/fixtures/soap_templates/simple.xml.erb
310
329
  - spec/fixtures/vcr_cassettes/SoapyBing_Accounts/_list/returns_a_list_of_SoapyBing_Account_objects.yml
311
330
  - spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_ad_groups_by_campaign_id/1_1_1.yml
312
331
  - spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_ads_by_ad_group_id/1_2_1.yml
313
332
  - spec/fixtures/vcr_cassettes/SoapyBing_Ads/_get_targets_by_campaign_ids/1_3_1.yml
333
+ - spec/fixtures/vcr_cassettes/SoapyBing_Ads_Bulk_Campaigns/_result_file_url/returns_result_file_url.yml
314
334
  - spec/fixtures/vcr_cassettes/campaign_performance_report/with_pending_status.yml
315
335
  - spec/fixtures/vcr_cassettes/campaign_performance_report/with_successful_status.yml
316
336
  - spec/fixtures/vcr_cassettes/oauth_credentials/access_token/with_successful_status.yml
317
337
  - spec/integration/soapy_bing/accounts_spec.rb
338
+ - spec/integration/soapy_bing/ads/bulk/campaigns_spec.rb
318
339
  - spec/integration/soapy_bing/ads/reports/campaign_performance_report_spec.rb
319
340
  - spec/integration/soapy_bing/ads_spec.rb
320
341
  - spec/integration/soapy_bing/oauth_credentials_spec.rb
321
342
  - spec/simplecov_setup.rb
322
343
  - spec/soapy_bing/account_spec.rb
344
+ - spec/soapy_bing/ads/bulk/parsers/csv_parser_spec.rb
323
345
  - spec/soapy_bing/ads/reports/campaign_performance_report_spec.rb
324
346
  - spec/soapy_bing/ads/reports/parsers/csv_parser_spec.rb
325
347
  - spec/soapy_bing/ads_spec.rb
326
348
  - spec/soapy_bing/helpers/class_name_spec.rb
327
- - spec/soapy_bing/helpers/ssl_version_spec.rb
349
+ - spec/soapy_bing/helpers/zip_downloader_spec.rb
328
350
  - spec/soapy_bing/oauth_credentials_spec.rb
329
351
  - spec/soapy_bing/param_guard_spec.rb
330
352
  - spec/soapy_bing/soap/request/base_spec.rb
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'openssl'
3
-
4
- module SoapyBing
5
- module Helpers
6
- module SSLVersion
7
- DEFAULT_SSL_VERSION = :TLSv1
8
-
9
- def ssl_version
10
- if OpenSSL::SSL::SSLContext::METHODS.include? DEFAULT_SSL_VERSION
11
- DEFAULT_SSL_VERSION
12
- else
13
- OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version]
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- RSpec.describe SoapyBing::Helpers::SSLVersion do
3
- describe '#ssl_version' do
4
- subject(:ssl_version) do
5
- stub_const('MyClass', Class.new.include(described_class)).new.ssl_version
6
- end
7
-
8
- context 'when DEFAULT_SSL_VERSION is available' do
9
- before do
10
- stub_const('OpenSSL::SSL::SSLContext::METHODS', [described_class::DEFAULT_SSL_VERSION])
11
- end
12
-
13
- it 'responds with DEFAULT_SSL_VERSION' do
14
- expect(ssl_version).to be MyClass::DEFAULT_SSL_VERSION
15
- end
16
- end
17
-
18
- context 'when DEFAULT_SSL_VERSION is not available' do
19
- before { stub_const('OpenSSL::SSL::SSLContext::METHODS', []) }
20
-
21
- it 'responds with OpenSSL default version' do
22
- expect(ssl_version).to be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version]
23
- end
24
- end
25
- end
26
- end