bing_ads_ruby_sdk 1.3.0 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,14 @@
1
1
  RSpec.describe BingAdsRubySdk::Header do
2
2
  let(:oauth_store) { double(:oauth_store) }
3
- let(:subject) { described_class.new(developer_token: '123abc', client_id: '1a-2b-3c', store: oauth_store) }
3
+ let(:client_secret) { 'pa$$w0rd' }
4
+ let(:subject) do
5
+ described_class.new(
6
+ developer_token: '123abc',
7
+ client_id: '1a-2b-3c',
8
+ client_secret: client_secret,
9
+ store: oauth_store,
10
+ )
11
+ end
4
12
  let(:auth_handler) do
5
13
  double(:auth_handler, fetch_or_refresh: 'yes/we/can')
6
14
  end
@@ -9,6 +17,7 @@ RSpec.describe BingAdsRubySdk::Header do
9
17
  expect(::BingAdsRubySdk::OAuth2::AuthorizationHandler).to receive(:new).with(
10
18
  developer_token: '123abc',
11
19
  client_id: '1a-2b-3c',
20
+ client_secret: client_secret,
12
21
  store: oauth_store
13
22
  ).and_return auth_handler
14
23
  end
@@ -19,10 +28,23 @@ RSpec.describe BingAdsRubySdk::Header do
19
28
  "AuthenticationToken" => 'yes/we/can',
20
29
  "DeveloperToken" => '123abc',
21
30
  "CustomerId" => nil,
22
- "CustomerAccountId" => nil
31
+ "CustomerAccountId" => nil,
32
+ "ClientSecret" => client_secret
23
33
  )
24
34
  end
25
35
 
36
+ context "without client_secret" do
37
+ let(:client_secret) { nil }
38
+ it do
39
+ expect(subject.content).to eq(
40
+ "AuthenticationToken" => 'yes/we/can',
41
+ "DeveloperToken" => '123abc',
42
+ "CustomerId" => nil,
43
+ "CustomerAccountId" => nil
44
+ )
45
+ end
46
+ end
47
+
26
48
  it 'sets customer' do
27
49
  subject.set_customer(customer_id: 777, account_id: 666 )
28
50
 
@@ -30,7 +52,8 @@ RSpec.describe BingAdsRubySdk::Header do
30
52
  "AuthenticationToken" => 'yes/we/can',
31
53
  "DeveloperToken" => '123abc',
32
54
  "CustomerId" => 777,
33
- "CustomerAccountId" => 666
55
+ "CustomerAccountId" => 666,
56
+ "ClientSecret" => client_secret
34
57
  )
35
58
  end
36
59
  end
@@ -285,4 +285,23 @@ RSpec.describe BingAdsRubySdk::Services::CampaignManagement do
285
285
  ])
286
286
  end
287
287
  end
288
+
289
+ describe "set_shared_entity_associations" do
290
+ let(:action) { 'set_shared_entity_associations' }
291
+ let(:filename) { 'standard' }
292
+
293
+ it "returns expected result" do
294
+ expect(
295
+ service.set_shared_entity_associations(
296
+ associations: [{
297
+ shared_entity_association: {
298
+ entity_id: "349704435",
299
+ entity_type: "Account",
300
+ shared_entity_id: "223200992903993",
301
+ shared_entity_type: "PlacementExclusionList"
302
+ },
303
+ }]
304
+ )).to eq({ partial_errors: "" })
305
+ end
306
+ end
288
307
  end
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soap:Envelope xmlns:ns0="https://bingads.microsoft.com/CampaignManagement/v13" xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns2="http://schemas.datacontract.org/2004/07/System.Collections.Generic" xmlns:ns3="http://schemas.datacontract.org/2004/07/System" xmlns:ns4="https://adapi.microsoft.com" xmlns:ns5="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <soap:Header>
4
+ <ns0:AuthenticationToken>***FILTERED***</ns0:AuthenticationToken>
5
+ <ns0:DeveloperToken>***FILTERED***</ns0:DeveloperToken>
6
+ <ns0:CustomerId>***FILTERED***</ns0:CustomerId>
7
+ <ns0:CustomerAccountId>***FILTERED***</ns0:CustomerAccountId>
8
+ </soap:Header>
9
+ <soap:Body>
10
+ <ns0:SetSharedEntityAssociationsRequest>
11
+ <ns0:Associations>
12
+ <ns0:SharedEntityAssociation>
13
+ <ns0:EntityId>349704435</ns0:EntityId>
14
+ <ns0:EntityType>Account</ns0:EntityType>
15
+ <ns0:SharedEntityId>223200992903993</ns0:SharedEntityId>
16
+ <ns0:SharedEntityType>PlacementExclusionList</ns0:SharedEntityType>
17
+ </ns0:SharedEntityAssociation>
18
+ </ns0:Associations>
19
+ </ns0:SetSharedEntityAssociationsRequest>
20
+ </soap:Body>
21
+ </soap:Envelope>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0"?>
2
+ <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
3
+ <s:Header>
4
+ <h:TrackingId xmlns:h="https://bingads.microsoft.com/CampaignManagement/v13">29921349-7ed0-43e9-b9d8-15246bee3651</h:TrackingId>
5
+ </s:Header>
6
+ <s:Body>
7
+ <SetSharedEntityAssociationsResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v13">
8
+ <PartialErrors xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>
9
+ </SetSharedEntityAssociationsResponse>
10
+ </s:Body>
11
+ </s:Envelope>
@@ -2,16 +2,18 @@ require 'dotenv/load'
2
2
 
3
3
  namespace :bing_token do
4
4
  desc "Gets and stores Bing OAuth token in file"
5
- task :get, [:filename, :bing_developer_token, :bing_client_id] do |task, args|
5
+ task :get, [:filename, :bing_developer_token, :bing_client_id, :bing_client_secret] do |task, args|
6
6
 
7
7
  filename = args[:filename] || ENV.fetch('BING_STORE_FILENAME')
8
8
  developer_token = args[:bing_developer_token] || ENV.fetch('BING_DEVELOPER_TOKEN')
9
9
  bing_client_id = args[:bing_client_id] || ENV.fetch('BING_CLIENT_ID')
10
+ bing_client_secret = args[:bing_client_secret] || ENV.fetch('BING_CLIENT_SECRET', nil)
10
11
 
11
12
  store = ::BingAdsRubySdk::OAuth2::FsStore.new(filename)
12
13
  auth = BingAdsRubySdk::OAuth2::AuthorizationHandler.new(
13
14
  developer_token: developer_token,
14
15
  client_id: bing_client_id,
16
+ client_secret: bing_client_secret,
15
17
  store: store
16
18
  )
17
19
  puts "Go to #{auth.code_url}",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bing_ads_ruby_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Effilab
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-15 00:00:00.000000000 Z
12
+ date: 2021-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: signet
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.8.1
20
+ version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.8.1
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: excon
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -306,6 +306,8 @@ files:
306
306
  - spec/fixtures/campaign_management/get_uet_tags_by_ids/standard_response.xml
307
307
  - spec/fixtures/campaign_management/set_ad_extensions_associations/standard.xml
308
308
  - spec/fixtures/campaign_management/set_ad_extensions_associations/standard_response.xml
309
+ - spec/fixtures/campaign_management/set_shared_entity_associations/standard.xml
310
+ - spec/fixtures/campaign_management/set_shared_entity_associations/standard_response.xml
309
311
  - spec/fixtures/campaign_management/update_conversion_goals/standard.xml
310
312
  - spec/fixtures/campaign_management/update_conversion_goals/standard_response.xml
311
313
  - spec/fixtures/campaign_management/update_uet_tags/standard.xml
@@ -405,6 +407,8 @@ test_files:
405
407
  - spec/fixtures/campaign_management/get_uet_tags_by_ids/standard_response.xml
406
408
  - spec/fixtures/campaign_management/set_ad_extensions_associations/standard.xml
407
409
  - spec/fixtures/campaign_management/set_ad_extensions_associations/standard_response.xml
410
+ - spec/fixtures/campaign_management/set_shared_entity_associations/standard.xml
411
+ - spec/fixtures/campaign_management/set_shared_entity_associations/standard_response.xml
408
412
  - spec/fixtures/campaign_management/update_conversion_goals/standard.xml
409
413
  - spec/fixtures/campaign_management/update_conversion_goals/standard_response.xml
410
414
  - spec/fixtures/campaign_management/update_uet_tags/standard.xml