soapy_cake 1.16.2 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90fef756332d326320cff251efb995ae7ecbb552
4
- data.tar.gz: ed0f70f712a51a60816ee644dfc37f2def6aff67
3
+ metadata.gz: 1db258487b1d0a99533e0f6f9d8c5c07ef8b0928
4
+ data.tar.gz: edcc92e3828ce7fa9f3024e9ea12f381886727b5
5
5
  SHA512:
6
- metadata.gz: 387dd15276c23c87bb7edda1b05af420df08b684fadf4e7a5321cab1f5aa73f57c15aaff8a93a5ad0bbda459a9f567e79e8db6692fe1a124c72dbf7dbc009dd0
7
- data.tar.gz: 3c89c8fc345633e689d1dac0ab9bdba2164f59be4fd3e44f09d1eea414da4055b05fc3972b7edb318e392c61ad7c7d364682cf3aa7382efbc44d4e95bfe59cd0
6
+ metadata.gz: 06f50752766a111d703f58a24522e0d87c09af8ea32d9d171e365da202cca68e521674205e1f5f47a0eb14cbbc384f72aab8ec189b0b3e737f3b2c058210c5cb
7
+ data.tar.gz: 18366f408a3266a8ea9b043934eda7ea2092d3294406ea198167003d61685d684556bf2bb959c40da5d1ce75af37d9f118ad05829143d351896dc10c65881252
data/api_versions.yml CHANGED
@@ -25,6 +25,7 @@ admin:
25
25
  offer: 5
26
26
  offer_contract: 1
27
27
  offer_tiers: 1
28
+ remove_blacklist: 1
28
29
  suppresion_list: 1
29
30
  vertical: 1
30
31
  auth:
@@ -37,6 +38,7 @@ admin:
37
38
  advertisers: 5
38
39
  affiliate_referrals: 1
39
40
  affiliates: 5
41
+ blacklists: 1
40
42
  buyer_contracts: 1
41
43
  buyers: 1
42
44
  campaigns: 6
@@ -122,6 +122,15 @@ module SoapyCake
122
122
  )
123
123
  end
124
124
 
125
+ def blacklists(opts = {})
126
+ run Request.new(:admin, :export, :blacklists, opts)
127
+ end
128
+
129
+ def remove_blacklist(opts = {})
130
+ require_params(opts, %i(blacklist_id))
131
+ run Request.new(:admin, :addedit, :remove_blacklist, opts)
132
+ end
133
+
125
134
  def affiliate_signup(opts = {})
126
135
  run Request.new(:admin, :signup, :affiliate, opts)
127
136
  end
@@ -26,6 +26,8 @@ module SoapyCake
26
26
  end
27
27
 
28
28
  def to_xml
29
+ check_errors!
30
+
29
31
  (empty? ? [] : [body.to_s]).to_enum
30
32
  end
31
33
 
@@ -3,7 +3,7 @@ module SoapyCake
3
3
  attr_reader :key, :value
4
4
 
5
5
  # Known string ids that should not be parsed as integers
6
- STRING_IDS = %w(tax_id transaction_id).freeze
6
+ STRING_IDS = %w(tax_id transaction_id sub_id).freeze
7
7
 
8
8
  def initialize(key, value, time_converter)
9
9
  @key = key.to_s
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '1.16.2'.freeze
2
+ VERSION = '1.18.0'.freeze
3
3
  end
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cake-partner-domain.com/api/5/export.asmx
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ <?xml version="1.0"?>
10
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/5/">
11
+ <env:Header/>
12
+ <env:Body>
13
+ <cake:Affiliates>
14
+ <cake:api_key>cake-api-key</cake:api_key>
15
+ <cake:affiliate_id>-2</cake:affiliate_id>
16
+ </cake:Affiliates>
17
+ </env:Body>
18
+ </env:Envelope>
19
+ headers:
20
+ Content-Type:
21
+ - application/soap+xml;charset=UTF-8
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Cache-Control:
28
+ - private, max-age=0
29
+ Content-Type:
30
+ - application/soap+xml; charset=utf-8
31
+ Server:
32
+ - Microsoft-IIS/8.5
33
+ X-Aspnet-Version:
34
+ - 4.0.30319
35
+ X-Powered-By:
36
+ - ASP.NET
37
+ Date:
38
+ - Fri, 30 Oct 2015 11:08:53 GMT
39
+ Content-Length:
40
+ - '439'
41
+ body:
42
+ encoding: UTF-8
43
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
44
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AffiliatesResponse
45
+ xmlns="http://cakemarketing.com/api/5/"><AffiliatesResult><success>false</success><message>Restricted</message><row_count>0</row_count></AffiliatesResult></AffiliatesResponse></soap:Body></soap:Envelope>
46
+ http_version:
47
+ recorded_at: Mon, 15 Jun 2015 12:00:00 GMT
48
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cake-partner-domain.com/api/1/export.asmx
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ <?xml version="1.0"?>
10
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/1/">
11
+ <env:Header/>
12
+ <env:Body>
13
+ <cake:Blacklists>
14
+ <cake:api_key>cake-api-key</cake:api_key>
15
+ <cake:advertiser_id>15882</cake:advertiser_id>
16
+ <cake:offer_id>10551</cake:offer_id>
17
+ <cake:affiliate_id>16187</cake:affiliate_id>
18
+ <cake:sub_id>somesub</cake:sub_id>
19
+ </cake:Blacklists>
20
+ </env:Body>
21
+ </env:Envelope>
22
+ headers:
23
+ Content-Type:
24
+ - application/soap+xml;charset=UTF-8
25
+ response:
26
+ status:
27
+ code: 200
28
+ message: OK
29
+ headers:
30
+ Cache-Control:
31
+ - private, max-age=0
32
+ Content-Type:
33
+ - application/soap+xml; charset=utf-8
34
+ Server:
35
+ - Microsoft-IIS/8.5
36
+ X-Aspnet-Version:
37
+ - 4.0.30319
38
+ X-Powered-By:
39
+ - ASP.NET
40
+ Date:
41
+ - Fri, 30 Oct 2015 09:46:59 GMT
42
+ Content-Length:
43
+ - '1433'
44
+ body:
45
+ encoding: UTF-8
46
+ string: '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
47
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><BlacklistsResponse
48
+ xmlns="http://cakemarketing.com/api/1/"><BlacklistsResult><success>true</success><row_count>1</row_count><blacklists><blacklist><blacklist_id>202</blacklist_id><advertiser><advertiser_id
49
+ xmlns="API:id_name_store">15882</advertiser_id><advertiser_name xmlns="API:id_name_store">
50
+ NetDragon Websoft Inc. </advertiser_name></advertiser><offer><offer_id xmlns="API:id_name_store">10551</offer_id><offer_name
51
+ xmlns="API:id_name_store">DO NOT USE: Foxy Test 42 (AD DOI)</offer_name></offer><affiliate><affiliate_id
52
+ xmlns="API:id_name_store">16187</affiliate_id><affiliate_name xmlns="API:id_name_store">Illuminati
53
+ Corp.</affiliate_name></affiliate><sub_id>somesub</sub_id><blacklist_reason><blacklist_reason_id
54
+ xmlns="API:id_name_store">5</blacklist_reason_id><blacklist_reason_name xmlns="API:id_name_store">Fraud
55
+ - suspicious user-data</blacklist_reason_name></blacklist_reason><blacklist_type><blacklist_type_id
56
+ xmlns="API:id_name_store">1</blacklist_type_id><blacklist_type_name xmlns="API:id_name_store">Global
57
+ Redirect</blacklist_type_name></blacklist_type><date_created>2015-09-23T00:00:00</date_created></blacklist></blacklists></BlacklistsResult></BlacklistsResponse></soap:Body></soap:Envelope>'
58
+ http_version:
59
+ recorded_at: Mon, 15 Jun 2015 12:00:00 GMT
60
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,154 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cake-partner-domain.com/api/1/export.asmx
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ <?xml version="1.0"?>
10
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/1/">
11
+ <env:Header/>
12
+ <env:Body>
13
+ <cake:Blacklists>
14
+ <cake:api_key>cake-api-key</cake:api_key>
15
+ <cake:advertiser_id>14407</cake:advertiser_id>
16
+ <cake:offer_id>9738</cake:offer_id>
17
+ <cake:affiliate_id>15623</cake:affiliate_id>
18
+ <cake:sub_id>119960714</cake:sub_id>
19
+ </cake:Blacklists>
20
+ </env:Body>
21
+ </env:Envelope>
22
+ headers:
23
+ Content-Type:
24
+ - application/soap+xml;charset=UTF-8
25
+ response:
26
+ status:
27
+ code: 200
28
+ message: OK
29
+ headers:
30
+ Cache-Control:
31
+ - private, max-age=0
32
+ Content-Type:
33
+ - application/soap+xml; charset=utf-8
34
+ Server:
35
+ - Microsoft-IIS/8.5
36
+ X-Aspnet-Version:
37
+ - 4.0.30319
38
+ X-Powered-By:
39
+ - ASP.NET
40
+ Date:
41
+ - Fri, 30 Oct 2015 10:10:41 GMT
42
+ Content-Length:
43
+ - '1402'
44
+ body:
45
+ encoding: UTF-8
46
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
47
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><BlacklistsResponse
48
+ xmlns="http://cakemarketing.com/api/1/"><BlacklistsResult><success>true</success><row_count>1</row_count><blacklists><blacklist><blacklist_id>28</blacklist_id><advertiser><advertiser_id
49
+ xmlns="API:id_name_store">14407</advertiser_id><advertiser_name xmlns="API:id_name_store">2RealLife</advertiser_name></advertiser><offer><offer_id
50
+ xmlns="API:id_name_store">9738</offer_id><offer_name xmlns="API:id_name_store">Gametest
51
+ (DacH CPC)</offer_name></offer><affiliate><affiliate_id xmlns="API:id_name_store">15623</affiliate_id><affiliate_name
52
+ xmlns="API:id_name_store">clit games ltd</affiliate_name></affiliate><sub_id>119960714</sub_id><blacklist_reason><blacklist_reason_id
53
+ xmlns="API:id_name_store">5</blacklist_reason_id><blacklist_reason_name xmlns="API:id_name_store">Fraud
54
+ - suspicious user-data</blacklist_reason_name></blacklist_reason><blacklist_type><blacklist_type_id
55
+ xmlns="API:id_name_store">1</blacklist_type_id><blacklist_type_name xmlns="API:id_name_store">Global
56
+ Redirect</blacklist_type_name></blacklist_type><date_created>2015-04-08T00:00:00</date_created></blacklist></blacklists></BlacklistsResult></BlacklistsResponse></soap:Body></soap:Envelope>
57
+ http_version:
58
+ recorded_at: Mon, 15 Jun 2015 12:00:00 GMT
59
+ - request:
60
+ method: post
61
+ uri: https://cake-partner-domain.com/api/1/addedit.asmx
62
+ body:
63
+ encoding: UTF-8
64
+ string: |
65
+ <?xml version="1.0"?>
66
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/1/">
67
+ <env:Header/>
68
+ <env:Body>
69
+ <cake:RemoveBlacklist>
70
+ <cake:api_key>cake-api-key</cake:api_key>
71
+ <cake:blacklist_id>28</cake:blacklist_id>
72
+ </cake:RemoveBlacklist>
73
+ </env:Body>
74
+ </env:Envelope>
75
+ headers:
76
+ Content-Type:
77
+ - application/soap+xml;charset=UTF-8
78
+ response:
79
+ status:
80
+ code: 200
81
+ message: OK
82
+ headers:
83
+ Cache-Control:
84
+ - private, max-age=0
85
+ Content-Type:
86
+ - application/soap+xml; charset=utf-8
87
+ Server:
88
+ - Microsoft-IIS/8.5
89
+ X-Aspnet-Version:
90
+ - 4.0.30319
91
+ X-Powered-By:
92
+ - ASP.NET
93
+ Date:
94
+ - Fri, 30 Oct 2015 10:10:41 GMT
95
+ Content-Length:
96
+ - '446'
97
+ body:
98
+ encoding: UTF-8
99
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
100
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><RemoveBlacklistResponse
101
+ xmlns="http://cakemarketing.com/api/1/"><RemoveBlacklistResult><success>true</success><message>Blacklist
102
+ (28) Removed</message></RemoveBlacklistResult></RemoveBlacklistResponse></soap:Body></soap:Envelope>
103
+ http_version:
104
+ recorded_at: Mon, 15 Jun 2015 12:00:00 GMT
105
+ - request:
106
+ method: post
107
+ uri: https://cake-partner-domain.com/api/1/export.asmx
108
+ body:
109
+ encoding: UTF-8
110
+ string: |
111
+ <?xml version="1.0"?>
112
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/1/">
113
+ <env:Header/>
114
+ <env:Body>
115
+ <cake:Blacklists>
116
+ <cake:api_key>cake-api-key</cake:api_key>
117
+ <cake:advertiser_id>14407</cake:advertiser_id>
118
+ <cake:offer_id>9738</cake:offer_id>
119
+ <cake:affiliate_id>15623</cake:affiliate_id>
120
+ <cake:sub_id>119960714</cake:sub_id>
121
+ </cake:Blacklists>
122
+ </env:Body>
123
+ </env:Envelope>
124
+ headers:
125
+ Content-Type:
126
+ - application/soap+xml;charset=UTF-8
127
+ response:
128
+ status:
129
+ code: 200
130
+ message: OK
131
+ headers:
132
+ Cache-Control:
133
+ - private, max-age=0
134
+ Content-Type:
135
+ - application/soap+xml; charset=utf-8
136
+ Server:
137
+ - Microsoft-IIS/8.5
138
+ X-Aspnet-Version:
139
+ - 4.0.30319
140
+ X-Powered-By:
141
+ - ASP.NET
142
+ Date:
143
+ - Fri, 30 Oct 2015 10:10:41 GMT
144
+ Content-Length:
145
+ - '423'
146
+ body:
147
+ encoding: UTF-8
148
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
149
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><BlacklistsResponse
150
+ xmlns="http://cakemarketing.com/api/1/"><BlacklistsResult><success>true</success><row_count>0</row_count><blacklists
151
+ /></BlacklistsResult></BlacklistsResponse></soap:Body></soap:Envelope>
152
+ http_version:
153
+ recorded_at: Mon, 15 Jun 2015 12:00:00 GMT
154
+ recorded_with: VCR 2.9.3
@@ -104,5 +104,53 @@ RSpec.describe SoapyCake::Admin do
104
104
 
105
105
  expect(result.next).to eq(File.read('spec/fixtures/raw_response.xml').strip)
106
106
  end
107
+
108
+ it 'fails on error', :vcr do
109
+ expect do
110
+ subject.affiliates(affiliate_id: -2).next
111
+ end.to raise_error(SoapyCake::RequestFailed)
112
+ end
113
+ end
114
+
115
+ describe '#blacklists' do
116
+ it 'returns blacklists', :vcr do
117
+ expect(
118
+ subject.blacklists(
119
+ advertiser_id: 15882,
120
+ offer_id: 10551,
121
+ affiliate_id: 16187,
122
+ sub_id: 'somesub'
123
+ ).first
124
+ ).to eq(
125
+ advertiser: { advertiser_id: 15882, advertiser_name: ' NetDragon Websoft Inc. ' },
126
+ affiliate: { affiliate_id: 16187, affiliate_name: 'Illuminati Corp.' },
127
+ blacklist_id: 202,
128
+ blacklist_reason: { blacklist_reason_id: 5,
129
+ blacklist_reason_name: 'Fraud - suspicious user-data' },
130
+ blacklist_type: { blacklist_type_id: 1, blacklist_type_name: 'Global Redirect' },
131
+ date_created: Time.utc(2015, 9, 22, 22),
132
+ offer: { offer_id: 10551, offer_name: 'DO NOT USE: Foxy Test 42 (AD DOI)' },
133
+ sub_id: 'somesub'
134
+ )
135
+ end
136
+ end
137
+
138
+ describe '#remove_blacklist' do
139
+ let(:blacklist_params) do
140
+ {
141
+ advertiser_id: 14407,
142
+ offer_id: 9738,
143
+ affiliate_id: 15623,
144
+ sub_id: '119960714'
145
+ }
146
+ end
147
+
148
+ it 'removes blacklists', :vcr do
149
+ expect(subject.blacklists(blacklist_params).to_a).to be_present
150
+
151
+ subject.remove_blacklist(blacklist_id: 28)
152
+
153
+ expect(subject.blacklists(blacklist_params).to_a).to be_empty
154
+ end
107
155
  end
108
156
  end
@@ -234,4 +234,26 @@ RSpec.describe SoapyCake::Admin do
234
234
  end
235
235
  end
236
236
  end
237
+
238
+ describe '#blacklists' do
239
+ let(:method) { :blacklists }
240
+ let(:cake_method) { :blacklists }
241
+ let(:service) { :export }
242
+
243
+ it_behaves_like 'a cake admin method'
244
+ end
245
+
246
+ describe '#remove_blacklist' do
247
+ let(:method) { :remove_blacklist }
248
+ let(:cake_method) { :remove_blacklist }
249
+ let(:service) { :addedit }
250
+ let(:cake_opts) { { blacklist_id: 1 } }
251
+
252
+ it_behaves_like 'a cake admin method'
253
+
254
+ it 'fails if no blacklist_id is passed' do
255
+ expect { subject.remove_blacklist }
256
+ .to raise_error(SoapyCake::Error, "Parameter 'blacklist_id' missing!")
257
+ end
258
+ end
237
259
  end
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.16.2
4
+ version: 1.18.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-10-21 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -197,7 +197,10 @@ files:
197
197
  - lib/soapy_cake/version.rb
198
198
  - soapy_cake.gemspec
199
199
  - spec/fixtures/raw_response.xml
200
+ - spec/fixtures/vcr_cassettes/SoapyCake_Admin/XML_responses/fails_on_error.yml
200
201
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/XML_responses/returns_an_XML_string.yml
202
+ - spec/fixtures/vcr_cassettes/SoapyCake_Admin/_blacklists/returns_blacklists.yml
203
+ - spec/fixtures/vcr_cassettes/SoapyCake_Admin/_remove_blacklist/removes_blacklists.yml
201
204
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/creates_an_affiliate_and_returns_the_ID.yml
202
205
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/does_not_parse_a_transaction_id_as_an_integer.yml
203
206
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/raises_if_there_is_an_error.yml
@@ -259,7 +262,10 @@ specification_version: 4
259
262
  summary: Simple client for the CAKE API
260
263
  test_files:
261
264
  - spec/fixtures/raw_response.xml
265
+ - spec/fixtures/vcr_cassettes/SoapyCake_Admin/XML_responses/fails_on_error.yml
262
266
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/XML_responses/returns_an_XML_string.yml
267
+ - spec/fixtures/vcr_cassettes/SoapyCake_Admin/_blacklists/returns_blacklists.yml
268
+ - spec/fixtures/vcr_cassettes/SoapyCake_Admin/_remove_blacklist/removes_blacklists.yml
263
269
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/creates_an_affiliate_and_returns_the_ID.yml
264
270
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/does_not_parse_a_transaction_id_as_an_integer.yml
265
271
  - spec/fixtures/vcr_cassettes/SoapyCake_Admin/raises_if_there_is_an_error.yml