soapy_cake 2.1.4 → 2.1.5
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.
- checksums.yaml +4 -4
- data/lib/soapy_cake/admin.rb +4 -4
- data/lib/soapy_cake/admin_addedit.rb +13 -13
- data/lib/soapy_cake/admin_batched.rb +2 -2
- data/lib/soapy_cake/admin_track.rb +3 -3
- data/lib/soapy_cake/campaigns.rb +2 -2
- data/lib/soapy_cake/request.rb +1 -1
- data/lib/soapy_cake/response_value.rb +1 -1
- data/lib/soapy_cake/version.rb +1 -1
- data/spec/integration/soapy_cake/admin_addedit_spec.rb +4 -4
- data/spec/integration/soapy_cake/campaigns_spec.rb +1 -1
- data/spec/lib/soapy_cake/admin_addedit_spec.rb +2 -2
- data/spec/lib/soapy_cake/admin_batched_spec.rb +8 -8
- data/spec/spec_helper.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da190b758b6c0f5af1430e5936f15513bf9b5683
|
4
|
+
data.tar.gz: 47aba6b6c5ecd4f47991ad65aacca3169f112ce9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7e5093f06cd2050420e75aa46da62899bdde5e5b2f6c6597365b1e47ce1428aca4ce567a2f332d8aa59fbb6171fe4e0cc49312bfb3c288de4b93247c982ecea
|
7
|
+
data.tar.gz: b690df62a8de310a3d7b82888bece55842a5a99896b195e2cefef944ae1e63d350636615bc5a7670db092f1c78de4597531a9ad658bc0c8029ad93e6c149fe81
|
data/lib/soapy_cake/admin.rb
CHANGED
@@ -80,14 +80,14 @@ module SoapyCake
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def caps(opts)
|
83
|
-
require_params(opts, %i
|
83
|
+
require_params(opts, %i[start_date end_date])
|
84
84
|
opts = translate_values(opts)
|
85
85
|
|
86
86
|
run Request.new(:admin, :reports, :caps, opts)
|
87
87
|
end
|
88
88
|
|
89
89
|
def exchange_rates(opts)
|
90
|
-
require_params(opts, %i
|
90
|
+
require_params(opts, %i[start_date end_date])
|
91
91
|
|
92
92
|
run Request.new(:admin, :get, :exchange_rates, opts)
|
93
93
|
end
|
@@ -109,7 +109,7 @@ module SoapyCake
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def add_blacklist(opts)
|
112
|
-
require_params(opts, %i
|
112
|
+
require_params(opts, %i[blacklist_date])
|
113
113
|
|
114
114
|
blacklist_date = opts[:blacklist_date].to_date
|
115
115
|
# CAKE applies the blacklisting at 00:00 of the specified day, so add one more day.
|
@@ -129,7 +129,7 @@ module SoapyCake
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def remove_blacklist(opts = {})
|
132
|
-
require_params(opts, %i
|
132
|
+
require_params(opts, %i[blacklist_id])
|
133
133
|
run Request.new(:admin, :addedit, :remove_blacklist, opts)
|
134
134
|
end
|
135
135
|
|
@@ -51,25 +51,25 @@ module SoapyCake
|
|
51
51
|
tags_modification_type: 'do_not_change'
|
52
52
|
}.freeze
|
53
53
|
|
54
|
-
REQUIRED_NEW_OFFER_PARAMS = %i
|
54
|
+
REQUIRED_NEW_OFFER_PARAMS = %i[
|
55
55
|
hidden offer_status_id offer_type_id currency_id ssl click_cookie_days
|
56
56
|
impression_cookie_days redirect_404 enable_view_thru_conversions
|
57
57
|
click_trumps_impression disable_click_deduplication last_touch
|
58
58
|
enable_transaction_id_deduplication postbacks_only fire_global_pixel
|
59
59
|
fire_pixel_on_non_paid_conversions offer_link thankyou_link from_lines
|
60
60
|
subject_lines
|
61
|
-
|
61
|
+
].freeze
|
62
62
|
|
63
|
-
REQUIRED_OFFER_PARAMS = %i
|
63
|
+
REQUIRED_OFFER_PARAMS = %i[
|
64
64
|
advertiser_id vertical_id postback_url_ms_delay offer_contract_hidden
|
65
65
|
price_format_id received received_percentage payout tags
|
66
|
-
|
66
|
+
].freeze
|
67
67
|
|
68
|
-
REQUIRED_OFFER_CONTRACT_PARAMS = %i
|
68
|
+
REQUIRED_OFFER_CONTRACT_PARAMS = %i[
|
69
69
|
offer_id offer_contract_id offer_contract_name price_format_id payout received
|
70
70
|
received_percentage offer_link thankyou_link offer_contract_hidden
|
71
71
|
offer_contract_is_default use_fallback_targeting
|
72
|
-
|
72
|
+
].freeze
|
73
73
|
|
74
74
|
def add_offer(opts)
|
75
75
|
require_params(opts, REQUIRED_NEW_OFFER_PARAMS)
|
@@ -84,7 +84,7 @@ module SoapyCake
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def edit_contact(opts)
|
87
|
-
require_params(opts, %i
|
87
|
+
require_params(opts, %i[entity_id contact_id contact_email_address])
|
88
88
|
|
89
89
|
run Request.new(:admin, :addedit, :contact, opts)
|
90
90
|
end
|
@@ -94,7 +94,7 @@ module SoapyCake
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def edit_geo_targets(opts)
|
97
|
-
require_params(opts, %i
|
97
|
+
require_params(opts, %i[offer_contract_id allow_countries])
|
98
98
|
|
99
99
|
opts = if opts[:allow_countries]
|
100
100
|
geo_targets_allow_options(opts)
|
@@ -109,7 +109,7 @@ module SoapyCake
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def geo_targets_allow_options(opts)
|
112
|
-
require_params(opts, %i
|
112
|
+
require_params(opts, %i[countries])
|
113
113
|
opts = opts.dup
|
114
114
|
countries = Array(opts[:countries])
|
115
115
|
opts[:countries] = countries.join(',')
|
@@ -140,7 +140,7 @@ module SoapyCake
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def update_caps(opts)
|
143
|
-
require_params(opts, %i
|
143
|
+
require_params(opts, %i[cap_type_id cap_interval_id cap_amount send_alert_only])
|
144
144
|
|
145
145
|
opts = translate_values(opts)
|
146
146
|
|
@@ -148,7 +148,7 @@ module SoapyCake
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def remove_caps(opts)
|
151
|
-
require_params(opts, %i
|
151
|
+
require_params(opts, %i[cap_type_id])
|
152
152
|
|
153
153
|
opts = translate_values(opts)
|
154
154
|
|
@@ -165,7 +165,7 @@ module SoapyCake
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def edit_affiliate(opts)
|
168
|
-
require_params(opts, %i
|
168
|
+
require_params(opts, %i[affiliate_id vat_tax_required])
|
169
169
|
|
170
170
|
run Request.new(:admin, :addedit, :affiliate, opts)
|
171
171
|
end
|
@@ -177,7 +177,7 @@ module SoapyCake
|
|
177
177
|
private
|
178
178
|
|
179
179
|
def addedit_offer_tier(add_edit_option, opts)
|
180
|
-
require_params(opts, %i
|
180
|
+
require_params(opts, %i[offer_id tier_id price_format_id offer_contract_id status_id])
|
181
181
|
|
182
182
|
opts = opts.merge(redirect_offer_contract_id: -1, add_edit_option: add_edit_option)
|
183
183
|
opts = translate_values(opts)
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module SoapyCake
|
4
4
|
class AdminBatched
|
5
|
-
ALLOWED_METHODS = %i
|
5
|
+
ALLOWED_METHODS = %i[
|
6
6
|
advertisers affiliates campaigns offers creatives clicks
|
7
7
|
conversions events caps exchange_rates
|
8
|
-
|
8
|
+
].freeze
|
9
9
|
|
10
10
|
def initialize(opts = {})
|
11
11
|
@opts = opts
|
@@ -16,16 +16,16 @@ module SoapyCake
|
|
16
16
|
}.freeze
|
17
17
|
|
18
18
|
def mass_conversion_insert(opts)
|
19
|
-
require_params(opts, %i
|
19
|
+
require_params(opts, %i[
|
20
20
|
conversion_date affiliate_id sub_affiliate
|
21
21
|
campaign_id creative_id total_to_insert
|
22
|
-
)
|
22
|
+
])
|
23
23
|
|
24
24
|
run Request.new(:admin, :track, :mass_conversion_insert, opts)
|
25
25
|
end
|
26
26
|
|
27
27
|
def update_conversion(opts)
|
28
|
-
require_params(opts, %i
|
28
|
+
require_params(opts, %i[offer_id payout])
|
29
29
|
|
30
30
|
run Request.new(:admin, :track, :update_conversion, CONVERSION_DEFAULTS.merge(opts))
|
31
31
|
end
|
data/lib/soapy_cake/campaigns.rb
CHANGED
@@ -6,7 +6,7 @@ module SoapyCake
|
|
6
6
|
|
7
7
|
# TODO: Figure out what `static_suppression` is for and whether it needs to
|
8
8
|
# be in the list.
|
9
|
-
ALL_PARAMS = %i
|
9
|
+
ALL_PARAMS = %i[
|
10
10
|
account_status_id affiliate_id auto_disposition_delay_hours campaign_id
|
11
11
|
clear_session_on_conversion currency_id display_link_type_id
|
12
12
|
expiration_date expiration_date_modification_type media_type_id
|
@@ -14,7 +14,7 @@ module SoapyCake
|
|
14
14
|
payout_update_option pixel_html postback_delay_ms postback_url
|
15
15
|
redirect_404 redirect_domain redirect_offer_contract_id review test_link
|
16
16
|
third_party_name unique_key_hash use_offer_contract_payout
|
17
|
-
|
17
|
+
].freeze
|
18
18
|
|
19
19
|
NO_CHANGE_VALUES = {
|
20
20
|
account_status_id: 0,
|
data/lib/soapy_cake/request.rb
CHANGED
@@ -5,7 +5,7 @@ module SoapyCake
|
|
5
5
|
attr_reader :key, :value
|
6
6
|
|
7
7
|
# Known string ids that should not be parsed as integers
|
8
|
-
STRING_IDS = %w
|
8
|
+
STRING_IDS = %w[tax_id transaction_id sub_id].freeze
|
9
9
|
|
10
10
|
def initialize(key, value, time_converter)
|
11
11
|
@key = key.to_s
|
data/lib/soapy_cake/version.rb
CHANGED
@@ -102,7 +102,7 @@ RSpec.describe SoapyCake::AdminAddedit do
|
|
102
102
|
received_percentage: false,
|
103
103
|
payout: 1.5,
|
104
104
|
|
105
|
-
tags: %w
|
105
|
+
tags: %w[some tags],
|
106
106
|
offer_name: 'Test Offer',
|
107
107
|
offer_description: 'TEST1',
|
108
108
|
restrictions: 'TEST2',
|
@@ -110,7 +110,7 @@ RSpec.describe SoapyCake::AdminAddedit do
|
|
110
110
|
testing_instructions: 'TEST4'
|
111
111
|
)
|
112
112
|
|
113
|
-
%i
|
113
|
+
%i[creative_id offer_contract_id offer_id].each do |key|
|
114
114
|
expect(result[key]).to be_positive
|
115
115
|
end
|
116
116
|
end
|
@@ -152,14 +152,14 @@ RSpec.describe SoapyCake::AdminAddedit do
|
|
152
152
|
it 'creates geo targetings', :vcr do
|
153
153
|
result = admin_addedit.edit_geo_targets(
|
154
154
|
offer_contract_id: offer_contract_id,
|
155
|
-
countries: %w
|
155
|
+
countries: %w[DE FR],
|
156
156
|
allow_countries: true
|
157
157
|
)
|
158
158
|
expect(result).to include(success: true, row_count: '2')
|
159
159
|
|
160
160
|
result = admin_addedit.edit_geo_targets(
|
161
161
|
offer_contract_id: offer_contract_id,
|
162
|
-
countries: %w
|
162
|
+
countries: %w[AT CH],
|
163
163
|
redirects: {
|
164
164
|
'AT' => redirect_offer_contract_id,
|
165
165
|
'CH' => redirect_offer_contract_id
|
@@ -85,7 +85,7 @@ RSpec.describe SoapyCake::Campaigns, :vcr do
|
|
85
85
|
let(:campaign_id) { 23733 }
|
86
86
|
|
87
87
|
it 'updates a campaign' do
|
88
|
-
%w
|
88
|
+
%w[foo bar].each do |name|
|
89
89
|
client.patch(campaign_id, third_party_name: name)
|
90
90
|
campaign = client.get(campaign_id: campaign_id).first
|
91
91
|
expect(campaign.fetch(:third_party_name)).to eq(name)
|
@@ -90,7 +90,7 @@ RSpec.describe SoapyCake::AdminAddedit do
|
|
90
90
|
{
|
91
91
|
offer_contract_id: 1,
|
92
92
|
allow_countries: true,
|
93
|
-
countries: %w
|
93
|
+
countries: %w[DE]
|
94
94
|
}
|
95
95
|
end
|
96
96
|
|
@@ -124,7 +124,7 @@ RSpec.describe SoapyCake::AdminAddedit do
|
|
124
124
|
{
|
125
125
|
offer_contract_id: 1,
|
126
126
|
allow_countries: true,
|
127
|
-
countries: %w
|
127
|
+
countries: %w[DE]
|
128
128
|
}
|
129
129
|
end
|
130
130
|
|
@@ -13,21 +13,21 @@ RSpec.describe SoapyCake::AdminBatched do
|
|
13
13
|
|
14
14
|
it 'returns an enumerator and uses batched CAKE calls' do
|
15
15
|
expect(admin).to receive(:offers)
|
16
|
-
.with(advertiser: 1, start_at_row: 1, row_limit: 2).and_return(%i
|
16
|
+
.with(advertiser: 1, start_at_row: 1, row_limit: 2).and_return(%i[a b].to_enum)
|
17
17
|
expect(admin).to receive(:offers)
|
18
|
-
.with(advertiser: 1, start_at_row: 3, row_limit: 2).and_return(%i
|
18
|
+
.with(advertiser: 1, start_at_row: 3, row_limit: 2).and_return(%i[c].to_enum)
|
19
19
|
|
20
20
|
result = admin_batched.offers(advertiser: 1)
|
21
21
|
|
22
22
|
expect(result).to be_a(Enumerator)
|
23
|
-
expect(result.to_a).to eq(%i
|
23
|
+
expect(result.to_a).to eq(%i[a b c])
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'can use a custom limit' do
|
27
27
|
expect(admin).to receive(:offers)
|
28
|
-
.with(advertiser: 1, start_at_row: 1, row_limit: 100).and_return(%i
|
28
|
+
.with(advertiser: 1, start_at_row: 1, row_limit: 100).and_return(%i[a b].to_enum)
|
29
29
|
|
30
|
-
expect(admin_batched.offers({ advertiser: 1 }, 100).to_a).to eq(%i
|
30
|
+
expect(admin_batched.offers({ advertiser: 1 }, 100).to_a).to eq(%i[a b])
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'SoapyCake Batched with XMLResponse set' do
|
@@ -39,16 +39,16 @@ RSpec.describe SoapyCake::AdminBatched do
|
|
39
39
|
|
40
40
|
it 'returns all affiliates in batched mode' do
|
41
41
|
expect(admin).to receive(:affiliates)
|
42
|
-
.with(start_at_row: 1, row_limit: 10).and_return(%i
|
42
|
+
.with(start_at_row: 1, row_limit: 10).and_return(%i[a].to_enum)
|
43
43
|
expect(admin).to receive(:affiliates)
|
44
|
-
.with(start_at_row: 11, row_limit: 10).and_return(%i
|
44
|
+
.with(start_at_row: 11, row_limit: 10).and_return(%i[b].to_enum)
|
45
45
|
expect(admin).to receive(:affiliates)
|
46
46
|
.with(start_at_row: 21, row_limit: 10).and_return([].to_enum)
|
47
47
|
|
48
48
|
result = admin_batched.affiliates({}, 10)
|
49
49
|
|
50
50
|
expect(result).to be_a(Enumerator)
|
51
|
-
expect(result.to_a).to eq(%i
|
51
|
+
expect(result.to_a).to eq(%i[a b])
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
data/spec/spec_helper.rb
CHANGED
@@ -53,7 +53,7 @@ VCR.configure do |c|
|
|
53
53
|
c.hook_into :webmock
|
54
54
|
c.filter_sensitive_data('cake-api-key') { ENV['CAKE_API_KEY'] }
|
55
55
|
c.filter_sensitive_data('cake-partner-domain.com') { ENV['CAKE_DOMAIN'] }
|
56
|
-
c.default_cassette_options = { match_requests_on: %i
|
56
|
+
c.default_cassette_options = { match_requests_on: %i[method uri body] }
|
57
57
|
|
58
58
|
# allow codeclimate-test-reporter to phone home
|
59
59
|
c.ignore_hosts 'codeclimate.com'
|