bing_ads_ruby_sdk 1.5.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +21 -5
- data/Rakefile +1 -1
- data/bing_ads_ruby_sdk.gemspec +9 -1
- data/changelog.md +3 -0
- data/lib/Rakefile +4 -0
- data/lib/bing_ads_ruby_sdk/errors/errors.rb +1 -1
- data/lib/bing_ads_ruby_sdk/railtie.rb +13 -0
- data/{tasks → lib/bing_ads_ruby_sdk/tasks}/bing_ads_ruby_sdk.rake +1 -1
- data/lib/bing_ads_ruby_sdk/version.rb +1 -1
- data/lib/bing_ads_ruby_sdk.rb +1 -0
- metadata +6 -85
- data/.circleci/config.yml +0 -54
- data/.github/.keep +0 -0
- data/.github/renovate.json +0 -225
- data/.gitignore +0 -19
- data/.rspec +0 -4
- data/spec/bing_ads_ruby_sdk/api_spec.rb +0 -17
- data/spec/bing_ads_ruby_sdk/errors/error_handler_spec.rb +0 -477
- data/spec/bing_ads_ruby_sdk/errors/errors_spec.rb +0 -13
- data/spec/bing_ads_ruby_sdk/header_spec.rb +0 -60
- data/spec/bing_ads_ruby_sdk/http_client_spec.rb +0 -42
- data/spec/bing_ads_ruby_sdk/oauth2/fs_store_spec.rb +0 -19
- data/spec/bing_ads_ruby_sdk/postprocessors/cast_long_arrays_spec.rb +0 -29
- data/spec/bing_ads_ruby_sdk/postprocessors/snakize_spec.rb +0 -39
- data/spec/bing_ads_ruby_sdk/preprocessors/camelize_spec.rb +0 -39
- data/spec/bing_ads_ruby_sdk/preprocessors/order_spec.rb +0 -130
- data/spec/bing_ads_ruby_sdk/services/bulk_spec.rb +0 -51
- data/spec/bing_ads_ruby_sdk/services/campaign_management_spec.rb +0 -314
- data/spec/bing_ads_ruby_sdk/services/customer_management_spec.rb +0 -96
- data/spec/bing_ads_ruby_sdk_spec.rb +0 -5
- data/spec/examples/1_customer_creation/customer_spec.rb +0 -35
- data/spec/examples/2_with_customer/budget_spec.rb +0 -52
- data/spec/examples/2_with_customer/campaigns_spec.rb +0 -26
- data/spec/examples/2_with_customer/customer_management_spec.rb +0 -188
- data/spec/examples/2_with_customer/uet_tags_spec.rb +0 -42
- data/spec/examples/3_with_uet_tag/conversion_goal_spec.rb +0 -40
- data/spec/examples/3_with_uet_tag/uet_tags_spec.rb +0 -56
- data/spec/examples/4_with_conversion_goal/conversion_goals_spec.rb +0 -76
- data/spec/examples/5_with_campaign/ad_extension_spec.rb +0 -235
- data/spec/examples/5_with_campaign/ad_group_spec.rb +0 -34
- data/spec/examples/5_with_campaign/campaign_criterions_spec.rb +0 -72
- data/spec/examples/5_with_campaign/campaign_spec.rb +0 -70
- data/spec/examples/6_with_ad_group/ad_group_spec.rb +0 -70
- data/spec/examples/6_with_ad_group/ads_spec.rb +0 -110
- data/spec/examples/6_with_ad_group/keywords_spec.rb +0 -105
- data/spec/examples/examples.rb +0 -75
- data/spec/fixtures/bulk/download_campaigns_by_account_ids/standard.xml +0 -23
- data/spec/fixtures/bulk/download_campaigns_by_account_ids/standard_response.xml +0 -11
- data/spec/fixtures/bulk/get_bulk_download_status/standard.xml +0 -14
- data/spec/fixtures/bulk/get_bulk_download_status/standard_response.xml +0 -15
- data/spec/fixtures/campaign_management/add_ad_extensions/standard.xml +0 -21
- data/spec/fixtures/campaign_management/add_ad_extensions/standard_response.xml +0 -17
- data/spec/fixtures/campaign_management/add_conversion_goals/standard.xml +0 -27
- data/spec/fixtures/campaign_management/add_conversion_goals/standard_response.xml +0 -14
- data/spec/fixtures/campaign_management/add_shared_entity/standard.xml +0 -16
- data/spec/fixtures/campaign_management/add_shared_entity/standard_response.xml +0 -13
- data/spec/fixtures/campaign_management/add_uet_tags/standard.xml +0 -19
- data/spec/fixtures/campaign_management/add_uet_tags/standard_response.xml +0 -21
- data/spec/fixtures/campaign_management/get_ad_extension_ids_by_account_id/standard.xml +0 -15
- data/spec/fixtures/campaign_management/get_ad_extension_ids_by_account_id/standard_response.xml +0 -13
- data/spec/fixtures/campaign_management/get_ad_extensions_associations/standard.xml +0 -19
- data/spec/fixtures/campaign_management/get_ad_extensions_associations/standard_response.xml +0 -47
- data/spec/fixtures/campaign_management/get_budgets_by_ids/standard.xml +0 -12
- data/spec/fixtures/campaign_management/get_budgets_by_ids/standard_response.xml +0 -20
- data/spec/fixtures/campaign_management/get_campaigns_by_account_id/standard.xml +0 -14
- data/spec/fixtures/campaign_management/get_campaigns_by_account_id/standard_response.xml +0 -84
- data/spec/fixtures/campaign_management/get_conversion_goals_by_ids/standard.xml +0 -18
- data/spec/fixtures/campaign_management/get_conversion_goals_by_ids/standard_response.xml +0 -61
- data/spec/fixtures/campaign_management/get_shared_entities_by_account_id/standard.xml +0 -14
- data/spec/fixtures/campaign_management/get_shared_entities_by_account_id/standard_response.xml +0 -20
- data/spec/fixtures/campaign_management/get_shared_entity_associations_by_entity_ids/standard.xml +0 -18
- data/spec/fixtures/campaign_management/get_shared_entity_associations_by_entity_ids/standard_response.xml +0 -19
- data/spec/fixtures/campaign_management/get_uet_tags_by_ids/standard.xml +0 -16
- data/spec/fixtures/campaign_management/get_uet_tags_by_ids/standard_response.xml +0 -21
- data/spec/fixtures/campaign_management/set_ad_extensions_associations/standard.xml +0 -21
- data/spec/fixtures/campaign_management/set_ad_extensions_associations/standard_response.xml +0 -11
- data/spec/fixtures/campaign_management/set_shared_entity_associations/standard.xml +0 -21
- data/spec/fixtures/campaign_management/set_shared_entity_associations/standard_response.xml +0 -11
- data/spec/fixtures/campaign_management/update_conversion_goals/standard.xml +0 -27
- data/spec/fixtures/campaign_management/update_conversion_goals/standard_response.xml +0 -11
- data/spec/fixtures/campaign_management/update_uet_tags/standard.xml +0 -20
- data/spec/fixtures/campaign_management/update_uet_tags/standard_response.xml +0 -11
- data/spec/fixtures/customer_management/find_accounts_or_customers_info/standard.xml +0 -15
- data/spec/fixtures/customer_management/find_accounts_or_customers_info/standard_response.xml +0 -21
- data/spec/fixtures/customer_management/get_account/standard.xml +0 -14
- data/spec/fixtures/customer_management/get_account/standard_response.xml +0 -43
- data/spec/fixtures/customer_management/signup_customer/standard.xml +0 -30
- data/spec/fixtures/customer_management/signup_customer/standard_response.xml +0 -15
- data/spec/fixtures/customer_management/update_account/standard.xml +0 -19
- data/spec/fixtures/customer_management/update_account/standard_response.xml +0 -11
- data/spec/spec_helper.rb +0 -33
- data/spec/support/spec_helpers.rb +0 -46
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe BingAdsRubySdk::Preprocessors::Camelize do
|
4
|
-
def action(params)
|
5
|
-
described_class.new(params).call
|
6
|
-
end
|
7
|
-
|
8
|
-
it "changes keys to camelize version" do
|
9
|
-
expect(action({
|
10
|
-
foo: "foo",
|
11
|
-
bar_bar: {
|
12
|
-
baz_baz: "baz"
|
13
|
-
},
|
14
|
-
coucou: [
|
15
|
-
{
|
16
|
-
bisou: 1
|
17
|
-
}
|
18
|
-
]
|
19
|
-
})).to eq({
|
20
|
-
"Foo" => "foo",
|
21
|
-
"BarBar" => {
|
22
|
-
"BazBaz" => "baz"
|
23
|
-
},
|
24
|
-
"Coucou" => [
|
25
|
-
{
|
26
|
-
"Bisou" => 1
|
27
|
-
}
|
28
|
-
]
|
29
|
-
})
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesnt camelize 'long' tag name" do
|
33
|
-
expect(action({
|
34
|
-
long: "1"
|
35
|
-
})).to eq({
|
36
|
-
"long" => "1"
|
37
|
-
})
|
38
|
-
end
|
39
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe BingAdsRubySdk::Preprocessors::Order do
|
4
|
-
def action
|
5
|
-
new_params = described_class.new(wrapper, unordered_params).call
|
6
|
-
expect(new_params.to_json).to eq(ordered_params.to_json)
|
7
|
-
end
|
8
|
-
|
9
|
-
context "nested hashes" do
|
10
|
-
let(:wrapper) do
|
11
|
-
SpecHelpers.wrapper(:customer_management, "SignupCustomer")
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:unordered_params) do
|
15
|
-
{
|
16
|
-
"Account" => {
|
17
|
-
"Name" => "test account",
|
18
|
-
"CurrencyCode" => "EUR",
|
19
|
-
"ParentCustomerId" => "1234"
|
20
|
-
},
|
21
|
-
"Customer" => {
|
22
|
-
"CustomerAddress" => "address",
|
23
|
-
"Industry" => "industry",
|
24
|
-
"MarketCountry" => "country"
|
25
|
-
},
|
26
|
-
"ParentCustomerId" => "1234"
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
let(:ordered_params) do
|
31
|
-
{
|
32
|
-
"Customer" => {
|
33
|
-
"Industry" => "industry",
|
34
|
-
"MarketCountry" => "country",
|
35
|
-
"CustomerAddress" => "address"
|
36
|
-
},
|
37
|
-
"Account" => {
|
38
|
-
"CurrencyCode" => "EUR",
|
39
|
-
"Name" => "test account",
|
40
|
-
"ParentCustomerId" => "1234"
|
41
|
-
},
|
42
|
-
"ParentCustomerId" => "1234"
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
it("orders") { action }
|
47
|
-
end
|
48
|
-
|
49
|
-
context "arrays" do
|
50
|
-
let(:wrapper) do
|
51
|
-
SpecHelpers.wrapper(:campaign_management, "UpdateUetTags")
|
52
|
-
end
|
53
|
-
|
54
|
-
let(:unordered_params) do
|
55
|
-
{
|
56
|
-
"UetTags" => [
|
57
|
-
{
|
58
|
-
"UetTag" => {
|
59
|
-
"Name" => "mofo2",
|
60
|
-
"Description" => nil,
|
61
|
-
"Id" => "26034398"
|
62
|
-
}
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
end
|
67
|
-
|
68
|
-
let(:ordered_params) do
|
69
|
-
{
|
70
|
-
"UetTags" => [
|
71
|
-
{
|
72
|
-
"UetTag" => {
|
73
|
-
"Description" => nil,
|
74
|
-
"Id" => "26034398",
|
75
|
-
"Name" => "mofo2"
|
76
|
-
}
|
77
|
-
}
|
78
|
-
]
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
it("orders") { action }
|
83
|
-
end
|
84
|
-
|
85
|
-
context "abstract types" do
|
86
|
-
let(:wrapper) do
|
87
|
-
SpecHelpers.wrapper(:campaign_management, "AddConversionGoals")
|
88
|
-
end
|
89
|
-
|
90
|
-
let(:unordered_params) do
|
91
|
-
{
|
92
|
-
"ConversionGoals" => [
|
93
|
-
{
|
94
|
-
"EventGoal" => {
|
95
|
-
"ActionExpression" => "contact_form",
|
96
|
-
"ActionOperator" => "Equals",
|
97
|
-
"ConversionWindowInMinutes" => 43200,
|
98
|
-
"CountType" => "Unique",
|
99
|
-
"Name" => "contact_form",
|
100
|
-
"Revenue" => {"Type" => "NoValue"},
|
101
|
-
"Type" => "Event",
|
102
|
-
"TagId" => 26003317
|
103
|
-
}
|
104
|
-
}
|
105
|
-
]
|
106
|
-
}
|
107
|
-
end
|
108
|
-
|
109
|
-
let(:ordered_params) do
|
110
|
-
{
|
111
|
-
"ConversionGoals" => [
|
112
|
-
{
|
113
|
-
"EventGoal" => {
|
114
|
-
"ConversionWindowInMinutes" => 43200,
|
115
|
-
"CountType" => "Unique",
|
116
|
-
"Name" => "contact_form",
|
117
|
-
"Revenue" => {"Type" => "NoValue"},
|
118
|
-
"TagId" => 26003317,
|
119
|
-
"Type" => "Event",
|
120
|
-
"ActionExpression" => "contact_form",
|
121
|
-
"ActionOperator" => "Equals"
|
122
|
-
}
|
123
|
-
}
|
124
|
-
]
|
125
|
-
}
|
126
|
-
end
|
127
|
-
|
128
|
-
it("orders") { action }
|
129
|
-
end
|
130
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
RSpec.describe BingAdsRubySdk::Services::Bulk do
|
2
|
-
let(:service_name) { described_class.service }
|
3
|
-
let(:soap_client) { SpecHelpers.soap_client(service_name) }
|
4
|
-
let(:expected_xml) { SpecHelpers.request_xml_for(service_name, action, filename) }
|
5
|
-
let(:mocked_response) { SpecHelpers.response_xml_for(service_name, action, filename) }
|
6
|
-
|
7
|
-
let(:service) { described_class.new(soap_client) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
expect(BingAdsRubySdk::HttpClient).to receive(:post) do |req|
|
11
|
-
expect(Nokogiri::XML(req.content).to_xml).to eq expected_xml.to_xml
|
12
|
-
mocked_response
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "download_campaigns_by_account_ids" do
|
17
|
-
let(:action) { "download_campaigns_by_account_ids" }
|
18
|
-
let(:filename) { "standard" }
|
19
|
-
|
20
|
-
it "returns expected result" do
|
21
|
-
expect(
|
22
|
-
service.download_campaigns_by_account_ids(
|
23
|
-
account_ids: [{long: 150168726}],
|
24
|
-
data_scope: "EntityData",
|
25
|
-
download_file_type: "Csv",
|
26
|
-
compression_type: "Zip",
|
27
|
-
download_entities: [
|
28
|
-
{download_entity: "Campaigns"}
|
29
|
-
],
|
30
|
-
format_version: "6.0"
|
31
|
-
)
|
32
|
-
).to eq({
|
33
|
-
download_request_id: "618504973441"
|
34
|
-
})
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "get_bulk_download_status" do
|
39
|
-
let(:action) { "get_bulk_download_status" }
|
40
|
-
let(:filename) { "standard" }
|
41
|
-
|
42
|
-
it "returns expected result" do
|
43
|
-
expect(
|
44
|
-
service.get_bulk_download_status(request_id: 618504973441)
|
45
|
-
).to include(
|
46
|
-
request_status: "Completed",
|
47
|
-
result_file_url: "cool_url"
|
48
|
-
)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,314 +0,0 @@
|
|
1
|
-
RSpec.describe BingAdsRubySdk::Services::CampaignManagement do
|
2
|
-
let(:service_name) { described_class.service }
|
3
|
-
let(:soap_client) { SpecHelpers.soap_client(service_name) }
|
4
|
-
let(:expected_xml) { SpecHelpers.request_xml_for(service_name, action, filename) }
|
5
|
-
let(:mocked_response) { SpecHelpers.response_xml_for(service_name, action, filename) }
|
6
|
-
|
7
|
-
let(:service) { described_class.new(soap_client) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
expect(BingAdsRubySdk::HttpClient).to receive(:post) do |req|
|
11
|
-
expect(Nokogiri::XML(req.content).to_xml).to eq expected_xml.to_xml
|
12
|
-
mocked_response
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "get_campaigns_by_account_id" do
|
17
|
-
let(:action) { "get_campaigns_by_account_id" }
|
18
|
-
let(:filename) { "standard" }
|
19
|
-
|
20
|
-
it "returns expected result" do
|
21
|
-
expect(
|
22
|
-
service.get_campaigns_by_account_id(account_id: 150168726)
|
23
|
-
).to contain_exactly(
|
24
|
-
a_hash_including(name: "20200015 - 20200015 - SN - B - Activité - Stations_Service - Geoloc - ETA"),
|
25
|
-
a_hash_including(name: "20200015 - 20200015 - SN - E - Produits - Stations_Service - Geoloc - ETA"),
|
26
|
-
a_hash_including(name: "20200015 - SN - X - Station Service #1 - Geozone_custom - 5KW - V3 - ETA")
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "get_budgets_by_ids" do
|
32
|
-
let(:action) { "get_budgets_by_ids" }
|
33
|
-
let(:filename) { "standard" }
|
34
|
-
|
35
|
-
it "returns expected result" do
|
36
|
-
expect(
|
37
|
-
service.get_budgets_by_ids
|
38
|
-
).to contain_exactly(
|
39
|
-
a_hash_including(name: "budget_DEFAULT")
|
40
|
-
)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "add_uet_tags" do
|
45
|
-
let(:action) { "add_uet_tags" }
|
46
|
-
let(:filename) { "standard" }
|
47
|
-
|
48
|
-
it "returns expected result" do
|
49
|
-
expect(
|
50
|
-
service.add_uet_tags({uet_tags: [{uet_tag: {name: "SDK-test", description: nil}}]})
|
51
|
-
).to include({
|
52
|
-
uet_tags: a_hash_including({
|
53
|
-
uet_tag: a_collection_containing_exactly(
|
54
|
-
a_hash_including(name: "SDK-test")
|
55
|
-
)
|
56
|
-
}),
|
57
|
-
partial_errors: ""
|
58
|
-
})
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "update_uet_tags" do
|
63
|
-
let(:action) { "update_uet_tags" }
|
64
|
-
let(:filename) { "standard" }
|
65
|
-
|
66
|
-
it "returns expected result" do
|
67
|
-
expect(
|
68
|
-
service.update_uet_tags({uet_tags: [{uet_tag: {name: "updated SDK-test", id: 96031109, description: nil}}]})
|
69
|
-
).to eq({
|
70
|
-
partial_errors: ""
|
71
|
-
})
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "get_uet_tags_by_ids" do
|
76
|
-
let(:action) { "get_uet_tags_by_ids" }
|
77
|
-
let(:filename) { "standard" }
|
78
|
-
|
79
|
-
it "returns expected result" do
|
80
|
-
expect(
|
81
|
-
service.get_uet_tags_by_ids(tag_ids: [{long: 96031109}])
|
82
|
-
).to contain_exactly(
|
83
|
-
a_hash_including(name: "updated SDK-test")
|
84
|
-
)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe "add_conversion_goals" do
|
89
|
-
let(:action) { "add_conversion_goals" }
|
90
|
-
let(:filename) { "standard" }
|
91
|
-
|
92
|
-
it "returns expected result" do
|
93
|
-
expect(
|
94
|
-
service.add_conversion_goals(conversion_goals: [{
|
95
|
-
event_goal: {
|
96
|
-
action_expression: "contact_form",
|
97
|
-
action_operator: "Equals",
|
98
|
-
conversion_window_in_minutes: 43200,
|
99
|
-
count_type: "Unique",
|
100
|
-
name: "sdk test",
|
101
|
-
revenue: {type: "NoValue"},
|
102
|
-
type: "Event",
|
103
|
-
tag_id: 96031109
|
104
|
-
}
|
105
|
-
}])
|
106
|
-
).to eq({
|
107
|
-
conversion_goal_ids: [46068449],
|
108
|
-
partial_errors: ""
|
109
|
-
})
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe "update_conversion_goals" do
|
114
|
-
let(:action) { "update_conversion_goals" }
|
115
|
-
let(:filename) { "standard" }
|
116
|
-
|
117
|
-
it "returns expected result" do
|
118
|
-
expect(
|
119
|
-
service.update_conversion_goals(conversion_goals: [{
|
120
|
-
event_goal: {
|
121
|
-
id: 46068449,
|
122
|
-
action_expression: "contact_form",
|
123
|
-
action_operator: "Equals",
|
124
|
-
conversion_window_in_minutes: 43200,
|
125
|
-
count_type: "Unique",
|
126
|
-
name: "updated sdk test",
|
127
|
-
revenue: {type: "NoValue"},
|
128
|
-
tag_id: 96031109
|
129
|
-
}
|
130
|
-
}])
|
131
|
-
).to eq({
|
132
|
-
partial_errors: ""
|
133
|
-
})
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe "get_conversion_goals_by_ids" do
|
138
|
-
let(:action) { "get_conversion_goals_by_ids" }
|
139
|
-
let(:filename) { "standard" }
|
140
|
-
|
141
|
-
it "returns expected result" do
|
142
|
-
expect(
|
143
|
-
service.get_conversion_goals_by_ids(
|
144
|
-
conversion_goal_types: "Event",
|
145
|
-
conversion_goal_ids: [{long: 46068449}, {long: 46068448}]
|
146
|
-
)
|
147
|
-
).to contain_exactly(
|
148
|
-
a_hash_including(name: "updated sdk test"),
|
149
|
-
a_hash_including(name: "random")
|
150
|
-
)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
describe "add_ad_extensions" do
|
155
|
-
let(:action) { "add_ad_extensions" }
|
156
|
-
let(:filename) { "standard" }
|
157
|
-
|
158
|
-
it "returns expected result" do
|
159
|
-
expect(
|
160
|
-
service.add_ad_extensions(
|
161
|
-
account_id: 150168726,
|
162
|
-
ad_extensions: [
|
163
|
-
{
|
164
|
-
call_ad_extension: {
|
165
|
-
scheduling: {},
|
166
|
-
country_code: "NZ",
|
167
|
-
phone_number: "0123456699"
|
168
|
-
}
|
169
|
-
}
|
170
|
-
]
|
171
|
-
)
|
172
|
-
).to include({
|
173
|
-
ad_extension_identities: a_hash_including({
|
174
|
-
ad_extension_identity: a_collection_containing_exactly(
|
175
|
-
a_hash_including(id: "8177660966625")
|
176
|
-
)
|
177
|
-
}),
|
178
|
-
nested_partial_errors: ""
|
179
|
-
})
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
describe "get_ad_extension_ids_by_account_id" do
|
184
|
-
let(:action) { "get_ad_extension_ids_by_account_id" }
|
185
|
-
let(:filename) { "standard" }
|
186
|
-
|
187
|
-
it "returns expected result" do
|
188
|
-
expect(
|
189
|
-
service.get_ad_extension_ids_by_account_id(
|
190
|
-
account_id: 150168726,
|
191
|
-
ad_extension_type: "CallAdExtension SitelinkAdExtension CalloutAdExtension"
|
192
|
-
)
|
193
|
-
).to eq([
|
194
|
-
8177660966625
|
195
|
-
])
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
describe "set_ad_extensions_associations" do
|
200
|
-
let(:action) { "set_ad_extensions_associations" }
|
201
|
-
let(:filename) { "standard" }
|
202
|
-
|
203
|
-
it "returns expected result" do
|
204
|
-
expect(
|
205
|
-
service.set_ad_extensions_associations(
|
206
|
-
account_id: 150168726,
|
207
|
-
ad_extension_id_to_entity_id_associations: [{
|
208
|
-
ad_extension_id_to_entity_id_association: {
|
209
|
-
ad_extension_id: 8177660966942,
|
210
|
-
entity_id: 349704437
|
211
|
-
}
|
212
|
-
}],
|
213
|
-
association_type: "Campaign"
|
214
|
-
)
|
215
|
-
).to eq({
|
216
|
-
partial_errors: ""
|
217
|
-
})
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
describe "get_ad_extensions_associations" do
|
222
|
-
let(:action) { "get_ad_extensions_associations" }
|
223
|
-
let(:filename) { "standard" }
|
224
|
-
|
225
|
-
it "returns expected result" do
|
226
|
-
expect(
|
227
|
-
service.get_ad_extensions_associations(
|
228
|
-
account_id: 150168726,
|
229
|
-
association_type: "Campaign",
|
230
|
-
ad_extension_type: "CalloutAdExtension",
|
231
|
-
entity_ids: [{long: 349704437}]
|
232
|
-
)
|
233
|
-
).to contain_exactly(
|
234
|
-
a_hash_including(
|
235
|
-
ad_extension: a_hash_including(id: "8177650858590", text: "Informations Et Contact")
|
236
|
-
),
|
237
|
-
a_hash_including(
|
238
|
-
ad_extension: a_hash_including(id: "8177660966942", text: "CalloutText")
|
239
|
-
)
|
240
|
-
)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
describe "add_shared_entity" do
|
245
|
-
let(:action) { "add_shared_entity" }
|
246
|
-
let(:filename) { "standard" }
|
247
|
-
|
248
|
-
it "returns expected result" do
|
249
|
-
expect(
|
250
|
-
service.add_shared_entity(
|
251
|
-
negative_keyword_list: {
|
252
|
-
name: "sdk list"
|
253
|
-
}
|
254
|
-
)
|
255
|
-
).to eq({
|
256
|
-
list_item_ids: "",
|
257
|
-
partial_errors: "",
|
258
|
-
shared_entity_id: "229798145242911"
|
259
|
-
})
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
describe "get_shared_entities_by_account_id" do
|
264
|
-
let(:action) { "get_shared_entities_by_account_id" }
|
265
|
-
let(:filename) { "standard" }
|
266
|
-
|
267
|
-
it "returns expected result" do
|
268
|
-
expect(
|
269
|
-
service.get_shared_entities_by_account_id(
|
270
|
-
shared_entity_type: "NegativeKeywordList"
|
271
|
-
)
|
272
|
-
).to contain_exactly(
|
273
|
-
a_hash_including(id: "229798145242911", name: "sdk list")
|
274
|
-
)
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
describe "get_shared_entity_associations_by_entity_ids" do
|
279
|
-
let(:action) { "get_shared_entity_associations_by_entity_ids" }
|
280
|
-
let(:filename) { "standard" }
|
281
|
-
|
282
|
-
it "returns expected result" do
|
283
|
-
expect(
|
284
|
-
service.get_shared_entity_associations_by_entity_ids({
|
285
|
-
entity_ids: [{long: 349704435}],
|
286
|
-
entity_type: "Campaign",
|
287
|
-
shared_entity_type: "NegativeKeywordList"
|
288
|
-
})
|
289
|
-
).to eq([
|
290
|
-
{entity_id: "349704435", entity_type: "Campaign", shared_entity_id: "223200992903993", shared_entity_type: "NegativeKeywordList"}
|
291
|
-
])
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
describe "set_shared_entity_associations" do
|
296
|
-
let(:action) { "set_shared_entity_associations" }
|
297
|
-
let(:filename) { "standard" }
|
298
|
-
|
299
|
-
it "returns expected result" do
|
300
|
-
expect(
|
301
|
-
service.set_shared_entity_associations(
|
302
|
-
associations: [{
|
303
|
-
shared_entity_association: {
|
304
|
-
entity_id: "349704435",
|
305
|
-
entity_type: "Account",
|
306
|
-
shared_entity_id: "223200992903993",
|
307
|
-
shared_entity_type: "PlacementExclusionList"
|
308
|
-
}
|
309
|
-
}]
|
310
|
-
)
|
311
|
-
).to eq({partial_errors: ""})
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
RSpec.describe BingAdsRubySdk::Services::CustomerManagement do
|
2
|
-
let(:service_name) { described_class.service }
|
3
|
-
let(:soap_client) { SpecHelpers.soap_client(service_name) }
|
4
|
-
let(:expected_xml) { SpecHelpers.request_xml_for(service_name, action, filename) }
|
5
|
-
let(:mocked_response) { SpecHelpers.response_xml_for(service_name, action, filename) }
|
6
|
-
|
7
|
-
let(:service) { described_class.new(soap_client) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
expect(BingAdsRubySdk::HttpClient).to receive(:post) do |req|
|
11
|
-
expect(Nokogiri::XML(req.content).to_xml).to eq expected_xml.to_xml
|
12
|
-
mocked_response
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "signup_customer" do
|
17
|
-
let(:action) { "signup_customer" }
|
18
|
-
let(:filename) { "standard" }
|
19
|
-
|
20
|
-
it "returns expected result" do
|
21
|
-
expect(
|
22
|
-
service.signup_customer(
|
23
|
-
parent_customer_id: 9876,
|
24
|
-
customer: {
|
25
|
-
industry: "NA",
|
26
|
-
market_country: "FR",
|
27
|
-
market_language: "French",
|
28
|
-
name: "sdk customer",
|
29
|
-
customer_address: {
|
30
|
-
city: "Nice",
|
31
|
-
country_code: "FR",
|
32
|
-
line1: "127 bd risso",
|
33
|
-
postal_code: "06000"
|
34
|
-
}
|
35
|
-
},
|
36
|
-
# Note that the structure of this type is slightly different to other types, in accord with the Bing WSDL
|
37
|
-
account: {
|
38
|
-
"@type" => "AdvertiserAccount",
|
39
|
-
:currency_code => "EUR",
|
40
|
-
:name => "SDK account"
|
41
|
-
}
|
42
|
-
)
|
43
|
-
).to include(
|
44
|
-
customer_id: "1234",
|
45
|
-
account_id: "5678"
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "get_account" do
|
51
|
-
let(:action) { "get_account" }
|
52
|
-
let(:filename) { "standard" }
|
53
|
-
|
54
|
-
it "returns expected result" do
|
55
|
-
expect(
|
56
|
-
service.get_account(account_id: 5678)
|
57
|
-
).to include(
|
58
|
-
account: a_hash_including(id: "5678", name: "SDKTEST")
|
59
|
-
)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "update_account" do
|
64
|
-
let(:action) { "update_account" }
|
65
|
-
let(:filename) { "standard" }
|
66
|
-
|
67
|
-
it "returns expected result" do
|
68
|
-
expect(
|
69
|
-
service.update_account(
|
70
|
-
account: {
|
71
|
-
"@type" => "AdvertiserAccount",
|
72
|
-
:id => 5678,
|
73
|
-
:time_stamp => "AAAAAE496a4=",
|
74
|
-
:currency_code => "EUR",
|
75
|
-
:name => "SDKTEST updated"
|
76
|
-
}
|
77
|
-
)
|
78
|
-
).to eq(
|
79
|
-
last_modified_time: "2019-01-18T13:16:38.827"
|
80
|
-
)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "find_accounts_or_customers_info" do
|
85
|
-
let(:action) { "find_accounts_or_customers_info" }
|
86
|
-
let(:filename) { "standard" }
|
87
|
-
|
88
|
-
it "returns expected result" do
|
89
|
-
expect(
|
90
|
-
service.find_accounts_or_customers_info(filter: "SDKTEST", top_n: 1)
|
91
|
-
).to contain_exactly(
|
92
|
-
a_hash_including(customer_name: "SDKTEST updated", account_id: "5678")
|
93
|
-
)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require_relative "../examples"
|
2
|
-
|
3
|
-
RSpec.describe "CustomerManagement service" do
|
4
|
-
include_context "use api"
|
5
|
-
|
6
|
-
it "creates customer" do
|
7
|
-
created_customer = api.customer_management.signup_customer(
|
8
|
-
customer: {
|
9
|
-
customer_address: {
|
10
|
-
city: "Paris",
|
11
|
-
postal_code: 75_001,
|
12
|
-
line1: "1 rue de Rivoli",
|
13
|
-
country_code: "FR"
|
14
|
-
},
|
15
|
-
industry: "Entertainment",
|
16
|
-
name: "Test Customer #{random}"
|
17
|
-
},
|
18
|
-
account: {
|
19
|
-
"@type" => "AdvertiserAccount",
|
20
|
-
:name => "Test Account #{random}",
|
21
|
-
:currency_code => "USD"
|
22
|
-
},
|
23
|
-
parent_customer_id: Examples.parent_customer_id
|
24
|
-
)
|
25
|
-
expect(created_customer).to include(
|
26
|
-
customer_id: a_kind_of(String),
|
27
|
-
customer_number: a_kind_of(String),
|
28
|
-
account_id: a_kind_of(String),
|
29
|
-
account_number: a_kind_of(String),
|
30
|
-
create_time: a_kind_of(String)
|
31
|
-
)
|
32
|
-
|
33
|
-
puts "You can now fill in examples.rb with customer_id: #{created_customer[:customer_id]} and account_id: #{created_customer[:account_id]}"
|
34
|
-
end
|
35
|
-
end
|