soapy_cake 1.3.6 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/api_versions.yml +1 -1
- data/lib/soapy_cake/admin_addedit.rb +21 -3
- data/lib/soapy_cake/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/geo_targeting/creates_geo_targetings.yml +59 -6
- data/spec/lib/soapy_cake/addedit_integration_spec.rb +26 -2
- data/spec/spec_helper.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd9650087f25d594328017d9adf7455f3d6b3763
|
4
|
+
data.tar.gz: 91a2b6a9eef7ee1b47d2389a7468e43de79b191f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6eb4e5f4cba2ce09552f8f37671ee22fa4cb64522dadcae33156894a81fa3eea5a1b9aaf03cc241b09811b59ba03cc14ae4eb5d4b02df80c3626ed1364a3e97
|
7
|
+
data.tar.gz: 7e2c571cf58d813ca780dfd56272f41aca615e04b97f7e1d8e1a20bdc820b82a78003c13efb0379b0d04f3217f44d71961b1df074171df5afd838e28ad44d5c7
|
data/api_versions.yml
CHANGED
@@ -21,11 +21,29 @@ module SoapyCake
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def add_geo_targets(opts = {})
|
24
|
-
require_params(opts, %i(offer_contract_id
|
24
|
+
require_params(opts, %i(offer_contract_id allow_countries))
|
25
|
+
|
26
|
+
if opts[:allow_countries]
|
27
|
+
require_params(opts, %i(countries))
|
28
|
+
countries = Array(opts[:countries])
|
29
|
+
opts[:countries] = countries.join(',')
|
30
|
+
opts[:redirect_offer_contract_ids] = ([0] * countries.count).join(',')
|
31
|
+
else
|
32
|
+
unless opts[:redirects].is_a?(Hash) && opts[:redirects].keys.count > 0
|
33
|
+
fail Error, "Parameter 'redirects' must be a COUNTRY=>REDIRECT_OFFER_CONTRACT_ID hash!"
|
34
|
+
end
|
35
|
+
|
36
|
+
opts[:countries] = opts[:redirects].keys.join(',')
|
37
|
+
opts[:redirect_offer_contract_ids] = opts[:redirects].values.join(',')
|
38
|
+
opts.delete(:redirects)
|
39
|
+
end
|
25
40
|
|
26
|
-
opts
|
41
|
+
opts.merge!(
|
42
|
+
add_edit_option: 'add',
|
43
|
+
set_targeting_to_geo: true
|
44
|
+
)
|
27
45
|
|
28
|
-
run Request.new(:admin, :addedit, :geo_targets, opts
|
46
|
+
run Request.new(:admin, :addedit, :geo_targets, opts)
|
29
47
|
end
|
30
48
|
|
31
49
|
def add_offer_contract(opts = {})
|
data/lib/soapy_cake/version.rb
CHANGED
data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/geo_targeting/creates_geo_targetings.yml
CHANGED
@@ -2,20 +2,73 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://cake-partner-domain.com/api/
|
5
|
+
uri: https://cake-partner-domain.com/api/2/addedit.asmx
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: |
|
9
9
|
<?xml version="1.0"?>
|
10
|
-
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/
|
10
|
+
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/2/">
|
11
11
|
<env:Header/>
|
12
12
|
<env:Body>
|
13
13
|
<cake:GeoTargets>
|
14
14
|
<cake:api_key>cake-api-key</cake:api_key>
|
15
15
|
<cake:offer_contract_id>1456</cake:offer_contract_id>
|
16
16
|
<cake:countries>DE,FR</cake:countries>
|
17
|
+
<cake:allow_countries>true</cake:allow_countries>
|
18
|
+
<cake:redirect_offer_contract_ids>0,0</cake:redirect_offer_contract_ids>
|
19
|
+
<cake:add_edit_option>add</cake:add_edit_option>
|
17
20
|
<cake:set_targeting_to_geo>true</cake:set_targeting_to_geo>
|
21
|
+
</cake:GeoTargets>
|
22
|
+
</env:Body>
|
23
|
+
</env:Envelope>
|
24
|
+
headers:
|
25
|
+
Content-Type:
|
26
|
+
- application/soap+xml;charset=UTF-8
|
27
|
+
response:
|
28
|
+
status:
|
29
|
+
code: 200
|
30
|
+
message: OK
|
31
|
+
headers:
|
32
|
+
Cache-Control:
|
33
|
+
- private, max-age=0
|
34
|
+
Content-Type:
|
35
|
+
- application/soap+xml; charset=utf-8
|
36
|
+
Server:
|
37
|
+
- Microsoft-IIS/8.0
|
38
|
+
X-Aspnet-Version:
|
39
|
+
- 4.0.30319
|
40
|
+
X-Powered-By:
|
41
|
+
- ASP.NET
|
42
|
+
Date:
|
43
|
+
- Tue, 17 Mar 2015 10:22:54 GMT
|
44
|
+
Content-Length:
|
45
|
+
- '446'
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
49
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GeoTargetsResponse
|
50
|
+
xmlns="http://cakemarketing.com/api/2/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
|
51
|
+
Added</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
|
52
|
+
http_version:
|
53
|
+
recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
|
54
|
+
- request:
|
55
|
+
method: post
|
56
|
+
uri: https://cake-partner-domain.com/api/2/addedit.asmx
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: |
|
60
|
+
<?xml version="1.0"?>
|
61
|
+
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/2/">
|
62
|
+
<env:Header/>
|
63
|
+
<env:Body>
|
64
|
+
<cake:GeoTargets>
|
65
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
66
|
+
<cake:offer_contract_id>1456</cake:offer_contract_id>
|
67
|
+
<cake:countries>AT,CH</cake:countries>
|
68
|
+
<cake:allow_countries>false</cake:allow_countries>
|
69
|
+
<cake:redirect_offer_contract_ids>1392,1392</cake:redirect_offer_contract_ids>
|
18
70
|
<cake:add_edit_option>add</cake:add_edit_option>
|
71
|
+
<cake:set_targeting_to_geo>true</cake:set_targeting_to_geo>
|
19
72
|
</cake:GeoTargets>
|
20
73
|
</env:Body>
|
21
74
|
</env:Envelope>
|
@@ -38,15 +91,15 @@ http_interactions:
|
|
38
91
|
X-Powered-By:
|
39
92
|
- ASP.NET
|
40
93
|
Date:
|
41
|
-
-
|
94
|
+
- Tue, 17 Mar 2015 10:22:55 GMT
|
42
95
|
Content-Length:
|
43
|
-
- '
|
96
|
+
- '446'
|
44
97
|
body:
|
45
98
|
encoding: UTF-8
|
46
99
|
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
47
100
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GeoTargetsResponse
|
48
|
-
xmlns="http://cakemarketing.com/api/
|
49
|
-
Added</message><row_count>
|
101
|
+
xmlns="http://cakemarketing.com/api/2/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
|
102
|
+
Added</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
|
50
103
|
http_version:
|
51
104
|
recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
|
52
105
|
recorded_with: VCR 2.9.3
|
@@ -7,6 +7,7 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
7
7
|
let(:vertical_id) { 41 }
|
8
8
|
let(:offer_id) { 8910 }
|
9
9
|
let(:offer_contract_id) { 1456 }
|
10
|
+
let(:redirect_offer_contract_id) { 1392 }
|
10
11
|
let(:tier_id) { 4 }
|
11
12
|
|
12
13
|
describe 'offers' do
|
@@ -95,10 +96,33 @@ RSpec.describe 'ADDEDIT integration test' do
|
|
95
96
|
result = subject.add_geo_targets(
|
96
97
|
offer_contract_id: offer_contract_id,
|
97
98
|
countries: %w(DE FR),
|
98
|
-
|
99
|
+
allow_countries: true
|
99
100
|
)
|
101
|
+
expect(result).to include(success: true, row_count: '2')
|
100
102
|
|
101
|
-
|
103
|
+
result = subject.add_geo_targets(
|
104
|
+
offer_contract_id: offer_contract_id,
|
105
|
+
countries: %w(AT CH),
|
106
|
+
redirects: {
|
107
|
+
'AT' => redirect_offer_contract_id,
|
108
|
+
'CH' => redirect_offer_contract_id,
|
109
|
+
},
|
110
|
+
allow_countries: false
|
111
|
+
)
|
112
|
+
expect(result).to include(success: true, row_count: '2')
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'fails if it does not get a correct redirect hash' do
|
116
|
+
expect do
|
117
|
+
subject.add_geo_targets(
|
118
|
+
offer_contract_id: offer_contract_id,
|
119
|
+
redirects: {},
|
120
|
+
allow_countries: false
|
121
|
+
)
|
122
|
+
end.to raise_error(
|
123
|
+
SoapyCake::Error,
|
124
|
+
"Parameter 'redirects' must be a COUNTRY=>REDIRECT_OFFER_CONTRACT_ID hash!"
|
125
|
+
)
|
102
126
|
end
|
103
127
|
end
|
104
128
|
|
data/spec/spec_helper.rb
CHANGED
@@ -35,8 +35,8 @@ RSpec.configure do |config|
|
|
35
35
|
config.expose_dsl_globally = false
|
36
36
|
end
|
37
37
|
|
38
|
-
ENV['CAKE_API_KEY'] = '
|
39
|
-
ENV['CAKE_DOMAIN'] = '
|
38
|
+
ENV['CAKE_API_KEY'] = 'cake-api-key' if ENV['CAKE_API_KEY'].blank?
|
39
|
+
ENV['CAKE_DOMAIN'] = 'cake-partner-domain.com' if ENV['CAKE_DOMAIN'].blank?
|
40
40
|
ENV['CAKE_TIME_OFFSET'] = '1' if ENV['CAKE_TIME_OFFSET'].blank?
|
41
41
|
|
42
42
|
VCR.configure do |c|
|
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.4.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-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.4.
|
231
|
+
rubygems_version: 2.4.5
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: Simple client for the CAKE API
|