soapy_cake 1.24.1 → 1.25.1

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: 659ad505616720d0362c9f604740448dad327275
4
- data.tar.gz: 506d9efebe3aecfee20c7c84ef846811f6c6c430
3
+ metadata.gz: f34206792cd5e4c12a01f151950c2cdc2fb93842
4
+ data.tar.gz: 3b001b6ab170294913d412bca3d587aac23284d1
5
5
  SHA512:
6
- metadata.gz: f3aa817cff5db27b22bbe2bb92110d75d376a552fc68b8aeaca640f23fad3472a2fa756ed87f17edaedf994869f61169dcd496d5b9b52bc7ea8af37520adf7d2
7
- data.tar.gz: 0a2670a01da6c9ca8dd797238bb871c5d8060b37e6b39a3800850e29abd991ebb91ff514ffa18d896c348e2f00124856392d9e6359c482d3bb3077f388821da4
6
+ metadata.gz: 0769d845dc9e1ee7ab2b9e967a828b25fa33273f3b2aca9138d9dd9642417405ae1dfe98f29e3891a2416b8b621546cbccbc8ee7e7de54ee2dbf00ff85e7dc7e
7
+ data.tar.gz: ee939674e9521deb531591dbf10a4ad48d3e42ad8b008361237d77bdee61bd57a5f36fe5b6ba301af0ec49ab14331ab5b70a07326059b2cd2fb0ff0650385e2b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
data/api.yml CHANGED
@@ -22,7 +22,7 @@ versions:
22
22
  creative: 1
23
23
  creative_files: 1
24
24
  exchange_rates: 1
25
- geo_targets: 2
25
+ geo_targets: 3
26
26
  offer: 5
27
27
  offer_contract: 1
28
28
  offer_tiers: 1
@@ -125,19 +125,19 @@ module SoapyCake
125
125
  opts = opts.dup
126
126
  countries = Array(opts[:countries])
127
127
  opts[:countries] = countries.join(',')
128
- opts[:redirect_offer_contract_ids] = ([-1] * countries.count).join(',')
128
+ opts[:redirect_site_offer_contract_ids] = ([-1] * countries.count).join(',')
129
129
  opts
130
130
  end
131
131
 
132
132
  def geo_targets_redirect_options(opts)
133
133
  opts = opts.dup
134
134
  redirects = opts.delete(:redirects)
135
- unless redirects.is_a?(Hash) && redirects.keys.count > 0
135
+ unless redirects.is_a?(Hash) && redirects.keys.count.positive?
136
136
  raise Error, "Parameter 'redirects' must be a COUNTRY=>REDIRECT_OFFER_CONTRACT_ID hash!"
137
137
  end
138
138
 
139
139
  opts[:countries] = redirects.keys.join(',')
140
- opts[:redirect_offer_contract_ids] = redirects.values.join(',')
140
+ opts[:redirect_site_offer_contract_ids] = redirects.values.join(',')
141
141
  opts
142
142
  end
143
143
 
@@ -221,7 +221,7 @@ module SoapyCake
221
221
  opts[:tags_modification_type] =
222
222
  if opts[:tags].to_s == ''
223
223
  'remove_all'
224
- elsif opts.delete(:tags_replace) && opts[:offer_id] != 0
224
+ elsif opts.delete(:tags_replace) && opts[:offer_id].nonzero?
225
225
  'replace'
226
226
  else
227
227
  'add'
@@ -60,10 +60,16 @@ module SoapyCake
60
60
  attr_reader :admin, :method, :opts, :offset, :limit
61
61
  end
62
62
 
63
- def method_missing(name, method_opts = {}, limit = nil)
64
- raise Error, "Invalid method #{name}" unless ALLOWED_METHODS.include?(name)
63
+ def respond_to_missing?(name)
64
+ ALLOWED_METHODS.include?(name)
65
+ end
65
66
 
66
- BatchedRequest.new(admin, name, method_opts, limit).to_enum
67
+ def method_missing(name, method_opts = {}, limit = nil)
68
+ if respond_to_missing?(name)
69
+ BatchedRequest.new(admin, name, method_opts, limit).to_enum
70
+ else
71
+ super
72
+ end
67
73
  end
68
74
 
69
75
  private
@@ -45,7 +45,7 @@ module SoapyCake
45
45
  private
46
46
 
47
47
  def api_path
48
- "#{(role == 'admin') ? '' : "/#{role.pluralize}"}/api/#{version}"
48
+ "#{role == 'admin' ? '' : "/#{role.pluralize}"}/api/#{version}"
49
49
  end
50
50
 
51
51
  def xml_params(xml)
@@ -78,7 +78,7 @@ module SoapyCake
78
78
  # for this specific request. Also, this is the only request with a tag depth
79
79
  # of 4, not 3 or 5 like ALL OTHER requests.
80
80
  # BTW: There is a 10$ reward if anyone can find a worse designed API.
81
- return true if sax.for_tag(:MediaType).count > 0
81
+ return true if sax.for_tag(:MediaType).count.positive?
82
82
 
83
83
  false
84
84
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SoapyCake
3
- VERSION = '1.24.1'
3
+ VERSION = '1.25.1'
4
4
  end
@@ -2,12 +2,12 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://cake-partner-domain.com/api/2/addedit.asmx
5
+ uri: https://cake-partner-domain.com/api/3/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/2/">
10
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/3/">
11
11
  <env:Header/>
12
12
  <env:Body>
13
13
  <cake:GeoTargets>
@@ -15,7 +15,7 @@ http_interactions:
15
15
  <cake:offer_contract_id>1456</cake:offer_contract_id>
16
16
  <cake:countries>DE,FR</cake:countries>
17
17
  <cake:allow_countries>true</cake:allow_countries>
18
- <cake:redirect_offer_contract_ids>-1,-1</cake:redirect_offer_contract_ids>
18
+ <cake:redirect_site_offer_contract_ids>-1,-1</cake:redirect_site_offer_contract_ids>
19
19
  <cake:add_edit_option>add</cake:add_edit_option>
20
20
  <cake:set_targeting_to_geo>true</cake:set_targeting_to_geo>
21
21
  </cake:GeoTargets>
@@ -47,18 +47,18 @@ http_interactions:
47
47
  encoding: UTF-8
48
48
  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
49
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)
50
+ xmlns="http://cakemarketing.com/api/3/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
51
51
  Added</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
52
52
  http_version:
53
53
  recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
54
54
  - request:
55
55
  method: post
56
- uri: https://cake-partner-domain.com/api/2/addedit.asmx
56
+ uri: https://cake-partner-domain.com/api/3/addedit.asmx
57
57
  body:
58
58
  encoding: UTF-8
59
59
  string: |
60
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/">
61
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/3/">
62
62
  <env:Header/>
63
63
  <env:Body>
64
64
  <cake:GeoTargets>
@@ -66,7 +66,7 @@ http_interactions:
66
66
  <cake:offer_contract_id>1456</cake:offer_contract_id>
67
67
  <cake:countries>AT,CH</cake:countries>
68
68
  <cake:allow_countries>false</cake:allow_countries>
69
- <cake:redirect_offer_contract_ids>1392,1392</cake:redirect_offer_contract_ids>
69
+ <cake:redirect_site_offer_contract_ids>1392,1392</cake:redirect_site_offer_contract_ids>
70
70
  <cake:add_edit_option>add</cake:add_edit_option>
71
71
  <cake:set_targeting_to_geo>true</cake:set_targeting_to_geo>
72
72
  </cake:GeoTargets>
@@ -98,7 +98,7 @@ http_interactions:
98
98
  encoding: UTF-8
99
99
  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
100
100
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GeoTargetsResponse
101
- xmlns="http://cakemarketing.com/api/2/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
101
+ xmlns="http://cakemarketing.com/api/3/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
102
102
  Added</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
103
103
  http_version:
104
104
  recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
@@ -108,7 +108,7 @@ RSpec.describe SoapyCake::AdminAddedit do
108
108
  )
109
109
 
110
110
  %i(creative_id offer_contract_id offer_id).each do |key|
111
- expect(result[key]).to be > 0
111
+ expect(result[key]).to be_positive
112
112
  end
113
113
  end
114
114
 
@@ -2,7 +2,7 @@
2
2
  RSpec.describe SoapyCake::Admin do
3
3
  around { |example| Timecop.freeze(Time.utc(2015, 6, 15, 12), &example) }
4
4
 
5
- let(:logger) { double('logger') }
5
+ let(:logger) { instance_double(Logger) }
6
6
  before { allow(logger).to receive(:info) }
7
7
 
8
8
  subject { described_class.new(logger: logger) }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe SoapyCake::AdminBatched do
3
- let(:admin) { double('admin', xml_response?: false) }
3
+ let(:admin) { instance_double(SoapyCake::Admin, xml_response?: false) }
4
4
 
5
5
  before :each do
6
6
  allow(SoapyCake::Admin).to receive(:new).and_return(admin)
@@ -51,7 +51,7 @@ RSpec.describe SoapyCake::AdminBatched do
51
51
 
52
52
  context 'errors' do
53
53
  it 'fails with an invalid method' do
54
- expect { subject.something }.to raise_error(/Invalid method something/)
54
+ expect { subject.something }.to raise_error(NoMethodError)
55
55
  end
56
56
 
57
57
  it 'fails when row_limit is set' do
@@ -178,7 +178,7 @@ RSpec.describe SoapyCake::Admin do
178
178
 
179
179
  let(:method) { :add_blacklist }
180
180
  let(:cake_method) { :blacklist }
181
- let(:request) { double('request') }
181
+ let(:request) { instance_double(SoapyCake::Request) }
182
182
  let(:opts) { { blacklist_date: date } }
183
183
 
184
184
  context 'immediate blacklisting for current date' do
@@ -8,7 +8,7 @@ RSpec.describe SoapyCake::Affiliate do
8
8
 
9
9
  shared_examples_for 'a cake affiliate method' do
10
10
  it 'runs the request' do
11
- request = double('request')
11
+ request = instance_double(SoapyCake::Request)
12
12
  expect(SoapyCake::Request).to receive(:new)
13
13
  .with(:affiliate, service, method, cake_opts).and_return(request)
14
14
  expect(subject).to receive(:run).with(request)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe SoapyCake::ResponseValue do
3
- let(:time_converter) { double('date converter') }
3
+ let(:time_converter) { instance_double(SoapyCake::TimeConverter) }
4
4
 
5
5
  def parse(key, value)
6
6
  described_class.new(key, value, time_converter).parse
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.shared_examples_for 'a cake admin method' do
3
- let(:request) { double('request') }
3
+ let(:request) { instance_double(SoapyCake::Request) }
4
4
 
5
5
  it 'runs the request' do
6
6
  expect(SoapyCake::Request).to receive(:new)
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.24.1
4
+ version: 1.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2016-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport