soapy_cake 1.2.0 → 1.3.0
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 -0
- data/lib/soapy_cake/admin_addedit.rb +24 -3
- data/lib/soapy_cake/const.rb +45 -35
- data/lib/soapy_cake/version.rb +1 -1
- data/spec/lib/soapy_cake/addedit_integration_spec.rb +13 -13
- data/spec/lib/soapy_cake/admin_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30ab4d58dc592b76ef9f222cd5af99dd196779e2
|
4
|
+
data.tar.gz: 150b73a83a589c38b0f993a976604940c510d09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fe7cdc3926b6eaaeb41a6ee1a3b13f542c96c814b28408aae5013bb2cb96c138e48b4dc11242c057cd8d9feb2dee47ee6813bc092485e97c31e0720636f6913
|
7
|
+
data.tar.gz: 44da349ae941c4ce26efd61abd5669c0d2abbecc8c4d73013e9b57a4cdac44242c344b83239163f0b3d8933af1e4f848bf150c03b5ada3a35832bf26e03de166
|
data/lib/soapy_cake/admin.rb
CHANGED
@@ -33,7 +33,9 @@ module SoapyCake
|
|
33
33
|
def update_caps(opts = {})
|
34
34
|
require_params(opts, %i(cap_type_id cap_interval_id cap_amount send_alert_only))
|
35
35
|
|
36
|
-
opts
|
36
|
+
translate_values!(opts, %i(cap_type_id cap_interval_id))
|
37
|
+
|
38
|
+
opts[:cap_amount] = -1 if opts[:cap_interval_id] == const_lookup(:cap_interval_id, :disabled)
|
37
39
|
|
38
40
|
run Request.new(:admin, :addedit, :caps, opts)
|
39
41
|
end
|
@@ -46,11 +48,26 @@ module SoapyCake
|
|
46
48
|
add_edit_option: 'add'
|
47
49
|
)
|
48
50
|
|
51
|
+
opts[:status_id] = const_lookup(:offer_status_id, opts[:status_id]) if opts.key?(:status_id)
|
52
|
+
translate_values!(opts, %i(price_format_id))
|
53
|
+
|
49
54
|
run Request.new(:admin, :addedit, :offer_tiers, opts)
|
50
55
|
end
|
51
56
|
|
52
57
|
private
|
53
58
|
|
59
|
+
def translate_values!(opts, params)
|
60
|
+
params.each do |type|
|
61
|
+
opts[type] = const_lookup(type, opts[type]) if opts.key?(type)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def const_lookup(type, key)
|
66
|
+
Const::CONSTS[type].fetch(key) do
|
67
|
+
fail ArgumentError, "#{key} is not a valid value for #{type}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
54
71
|
def addedit_offer(opts)
|
55
72
|
require_params(opts, %i(
|
56
73
|
advertiser_id vertical_id postback_url_ms_delay offer_contract_hidden
|
@@ -61,6 +78,8 @@ module SoapyCake
|
|
61
78
|
opts[k] = 'off' if v == false
|
62
79
|
end
|
63
80
|
|
81
|
+
translate_values!(opts, %i(currency_id offer_status_id offer_type_id price_format_id))
|
82
|
+
|
64
83
|
opts.reverse_merge!(
|
65
84
|
offer_name: '',
|
66
85
|
third_party_name: '',
|
@@ -81,8 +100,8 @@ module SoapyCake
|
|
81
100
|
postback_url: '',
|
82
101
|
fire_global_pixel: 'no_change',
|
83
102
|
fire_pixel_on_nonpaid_conversions: 'no_change',
|
84
|
-
conversion_cap_behavior:
|
85
|
-
conversion_behavior_on_redirect:
|
103
|
+
conversion_cap_behavior: const_lookup(:conversion_behaviour_id, :system),
|
104
|
+
conversion_behavior_on_redirect: const_lookup(:conversion_behaviour_id, :system),
|
86
105
|
expiration_date: Date.today + (365 * 100),
|
87
106
|
expiration_date_modification_type: 'do_not_change',
|
88
107
|
offer_contract_name: '',
|
@@ -109,6 +128,8 @@ module SoapyCake
|
|
109
128
|
received_percentage offer_link thankyou_link offer_contract_hidden
|
110
129
|
offer_contract_is_default use_fallback_targeting))
|
111
130
|
|
131
|
+
translate_values!(opts, %i(price_format_id))
|
132
|
+
|
112
133
|
run Request.new(:admin, :addedit, :offer_contract, opts)
|
113
134
|
end
|
114
135
|
end
|
data/lib/soapy_cake/const.rb
CHANGED
@@ -1,39 +1,49 @@
|
|
1
1
|
module SoapyCake
|
2
2
|
module Const
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
3
|
+
CONSTS = {
|
4
|
+
offer_status_id: {
|
5
|
+
public: 1,
|
6
|
+
private: 2,
|
7
|
+
apply_to_run: 3,
|
8
|
+
inactive: 4,
|
9
|
+
},
|
10
|
+
offer_type_id: {
|
11
|
+
hosted: 1,
|
12
|
+
host_n_post: 2,
|
13
|
+
third_party: 3,
|
14
|
+
},
|
15
|
+
currency_id: {
|
16
|
+
usd: 1,
|
17
|
+
eur: 2,
|
18
|
+
gbd: 3,
|
19
|
+
aud: 4,
|
20
|
+
cad: 5,
|
21
|
+
},
|
22
|
+
price_format_id: {
|
23
|
+
cpa: 1,
|
24
|
+
cpc: 2,
|
25
|
+
cpm: 3,
|
26
|
+
fixed: 4,
|
27
|
+
revshare: 5,
|
28
|
+
},
|
29
|
+
conversion_behaviour_id: {
|
30
|
+
system: 0,
|
31
|
+
adv_off: 1,
|
32
|
+
adv_no_aff: 2,
|
33
|
+
ignore: 3,
|
34
|
+
no_adv_aff: 4,
|
35
|
+
no_adv_no_aff: 5,
|
36
|
+
},
|
37
|
+
cap_type_id: {
|
38
|
+
click: 1,
|
39
|
+
conversion: 2,
|
40
|
+
},
|
41
|
+
cap_interval_id: {
|
42
|
+
disabled: 0,
|
43
|
+
daily: 1,
|
44
|
+
weekly: 2,
|
45
|
+
monthly: 3,
|
46
|
+
}
|
47
|
+
}
|
38
48
|
end
|
39
49
|
end
|
data/lib/soapy_cake/version.rb
CHANGED
@@ -13,9 +13,9 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
13
13
|
it 'creates an offer', :vcr do
|
14
14
|
result = subject.add_offer(
|
15
15
|
hidden: false,
|
16
|
-
offer_status_id:
|
17
|
-
offer_type_id:
|
18
|
-
currency_id:
|
16
|
+
offer_status_id: :public,
|
17
|
+
offer_type_id: :third_party,
|
18
|
+
currency_id: :eur,
|
19
19
|
ssl: false,
|
20
20
|
click_cookie_days: 30,
|
21
21
|
impression_cookie_days: 30,
|
@@ -37,7 +37,7 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
37
37
|
vertical_id: vertical_id,
|
38
38
|
postback_url_ms_delay: 60,
|
39
39
|
offer_contract_hidden: false,
|
40
|
-
price_format_id:
|
40
|
+
price_format_id: :cpa,
|
41
41
|
received: 2.0,
|
42
42
|
received_percentage: false,
|
43
43
|
payout: 1.5,
|
@@ -65,7 +65,7 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
65
65
|
vertical_id: vertical_id,
|
66
66
|
postback_url_ms_delay: 50,
|
67
67
|
offer_contract_hidden: false,
|
68
|
-
price_format_id:
|
68
|
+
price_format_id: :cpa,
|
69
69
|
received: 2.0,
|
70
70
|
received_percentage: false,
|
71
71
|
payout: 1.5,
|
@@ -95,7 +95,7 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
95
95
|
result = subject.add_offer_contract(
|
96
96
|
offer_id: offer_id,
|
97
97
|
offer_contract_name: 'Test Contract',
|
98
|
-
price_format_id:
|
98
|
+
price_format_id: :cpa,
|
99
99
|
received: 3.2,
|
100
100
|
received_percentage: false,
|
101
101
|
payout: 2.5,
|
@@ -114,7 +114,7 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
114
114
|
offer_id: offer_id,
|
115
115
|
offer_contract_id: offer_contract_id,
|
116
116
|
offer_contract_name: 'Test Contract',
|
117
|
-
price_format_id:
|
117
|
+
price_format_id: :cpa,
|
118
118
|
received: 3.2,
|
119
119
|
received_percentage: false,
|
120
120
|
payout: 2.5,
|
@@ -147,8 +147,8 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
147
147
|
it 'updates a cap for an offer contract', :vcr do
|
148
148
|
result = subject.update_caps(
|
149
149
|
offer_contract_id: offer_contract_id,
|
150
|
-
cap_type_id:
|
151
|
-
cap_interval_id:
|
150
|
+
cap_type_id: :conversion,
|
151
|
+
cap_interval_id: :daily,
|
152
152
|
cap_amount: 42,
|
153
153
|
send_alert_only: false
|
154
154
|
)
|
@@ -159,8 +159,8 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
159
159
|
it 'removes a cap for an offer contract', :vcr do
|
160
160
|
result = subject.update_caps(
|
161
161
|
offer_contract_id: offer_contract_id,
|
162
|
-
cap_type_id:
|
163
|
-
cap_interval_id:
|
162
|
+
cap_type_id: :conversion,
|
163
|
+
cap_interval_id: :disabled,
|
164
164
|
cap_amount: 42,
|
165
165
|
send_alert_only: false
|
166
166
|
)
|
@@ -175,8 +175,8 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
175
175
|
offer_id: offer_id,
|
176
176
|
offer_contract_id: offer_contract_id,
|
177
177
|
tier_id: tier_id,
|
178
|
-
price_format_id:
|
179
|
-
status_id:
|
178
|
+
price_format_id: :cpa,
|
179
|
+
status_id: :public
|
180
180
|
)
|
181
181
|
|
182
182
|
expect(result[:message]).to eq('Offer Tier Added')
|
@@ -125,6 +125,12 @@ RSpec.describe SoapyCake::Admin do
|
|
125
125
|
describe 'get service' do
|
126
126
|
let(:service) { :get }
|
127
127
|
|
128
|
+
describe '#verticals' do
|
129
|
+
let(:method) { :verticals }
|
130
|
+
let(:cake_opts) { {} }
|
131
|
+
it_behaves_like 'a cake admin method'
|
132
|
+
end
|
133
|
+
|
128
134
|
describe '#currencies' do
|
129
135
|
let(:method) { :currencies }
|
130
136
|
let(:cake_opts) { {} }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soapy_cake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.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: 2015-02-
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|