soapy_cake 1.26.0 → 2.0.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: f0200aa227f1f26c12610300c9848a22b831433a
4
- data.tar.gz: 515fda58cc88b35ef23ecfbd83f3bb7dc250bce1
3
+ metadata.gz: 5a83e62398d6bf19d63c844e3b38b49ef77e1c32
4
+ data.tar.gz: d3343d5c47737c662a489885633aa481d71bfa4f
5
5
  SHA512:
6
- metadata.gz: 57058b8a99b05a26c4ee21c0c21b818a957281d0125c56925d764caa07d2f6baeb2e7ec6b217ba27efeeed0cef641d04e19bf17e864fe6b5574b968a26fe00b3
7
- data.tar.gz: 22554ab098bcbe0f909539b1ecf2bf72b4745e4fc7d8b10428cb490d526c7dc60cbb8a24b37f8e80c58292d70435e7a3f7a2339f3f6fd53aa1cfc627ed55dd2f
6
+ metadata.gz: a76be5731e6506480c83e4a1fbbbf73dcfb0c6121a8e9bef0b5ab79e46e06d9dc18465dadd1f3bcbfea21babe07270aab845f7211b63507094f1145bf1131b54
7
+ data.tar.gz: 5fe3a19428b63b69d115252904e865e5d4715bdff19b76e1db8bd49c3f74216058ebb6f4667dac7c63b1898d003b9ad1483059a630bb54237367bf235b154b57
@@ -111,7 +111,7 @@ module SoapyCake
111
111
  run Request.new(:admin, :addedit, :contact, opts)
112
112
  end
113
113
 
114
- def add_geo_targets(opts)
114
+ def edit_geo_targets(opts)
115
115
  require_params(opts, %i(offer_contract_id allow_countries))
116
116
 
117
117
  opts = if opts[:allow_countries]
@@ -120,7 +120,7 @@ module SoapyCake
120
120
  geo_targets_redirect_options(opts)
121
121
  end
122
122
 
123
- opts = opts.merge(add_edit_option: 'add', set_targeting_to_geo: true)
123
+ opts = opts.merge(add_edit_option: 'replace', set_targeting_to_geo: true)
124
124
 
125
125
  run Request.new(:admin, :addedit, :geo_targets, opts)
126
126
  end
@@ -44,9 +44,8 @@ module SoapyCake
44
44
  end
45
45
 
46
46
  def check_write_enabled!(request)
47
- unless request.read_only? || write_enabled
48
- raise Error, 'Writes not enabled (pass write_enabled: true or set CAKE_WRITE_ENABLED=yes)'
49
- end
47
+ return if request.read_only? || write_enabled
48
+ raise Error, 'Writes not enabled (pass write_enabled: true or set CAKE_WRITE_ENABLED=yes)'
50
49
  end
51
50
 
52
51
  def with_retries(&block)
@@ -63,7 +62,7 @@ module SoapyCake
63
62
  end
64
63
 
65
64
  def http_response(request)
66
- logger.info("soapy_cake:request #{request}") if logger
65
+ logger&.info("soapy_cake:request #{request}")
67
66
 
68
67
  http_request = Net::HTTP::Post.new(request.path, HEADERS)
69
68
  http_request.body = request.xml
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SoapyCake
3
- VERSION = '1.26.0'
3
+ VERSION = '2.0.0'
4
4
  end
@@ -16,7 +16,7 @@ http_interactions:
16
16
  <cake:countries>DE,FR</cake:countries>
17
17
  <cake:allow_countries>true</cake:allow_countries>
18
18
  <cake:redirect_site_offer_contract_ids>-1,-1</cake:redirect_site_offer_contract_ids>
19
- <cake:add_edit_option>add</cake:add_edit_option>
19
+ <cake:add_edit_option>replace</cake:add_edit_option>
20
20
  <cake:set_targeting_to_geo>true</cake:set_targeting_to_geo>
21
21
  </cake:GeoTargets>
22
22
  </env:Body>
@@ -24,6 +24,12 @@ http_interactions:
24
24
  headers:
25
25
  Content-Type:
26
26
  - application/soap+xml;charset=UTF-8
27
+ Accept-Encoding:
28
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
29
+ Accept:
30
+ - "*/*"
31
+ User-Agent:
32
+ - Ruby
27
33
  response:
28
34
  status:
29
35
  code: 200
@@ -34,21 +40,21 @@ http_interactions:
34
40
  Content-Type:
35
41
  - application/soap+xml; charset=utf-8
36
42
  Server:
37
- - Microsoft-IIS/8.0
43
+ - Microsoft-IIS/8.5
38
44
  X-Aspnet-Version:
39
45
  - 4.0.30319
40
46
  X-Powered-By:
41
47
  - ASP.NET
42
48
  Date:
43
- - Fri, 07 Aug 2015 13:45:43 GMT
49
+ - Mon, 10 Oct 2016 10:22:33 GMT
44
50
  Content-Length:
45
- - '446'
51
+ - '449'
46
52
  body:
47
53
  encoding: UTF-8
48
54
  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
49
55
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GeoTargetsResponse
50
56
  xmlns="http://cakemarketing.com/api/3/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
51
- Added</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
57
+ Replaced</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
52
58
  http_version:
53
59
  recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
54
60
  - request:
@@ -67,7 +73,7 @@ http_interactions:
67
73
  <cake:countries>AT,CH</cake:countries>
68
74
  <cake:allow_countries>false</cake:allow_countries>
69
75
  <cake:redirect_site_offer_contract_ids>1392,1392</cake:redirect_site_offer_contract_ids>
70
- <cake:add_edit_option>add</cake:add_edit_option>
76
+ <cake:add_edit_option>replace</cake:add_edit_option>
71
77
  <cake:set_targeting_to_geo>true</cake:set_targeting_to_geo>
72
78
  </cake:GeoTargets>
73
79
  </env:Body>
@@ -75,6 +81,12 @@ http_interactions:
75
81
  headers:
76
82
  Content-Type:
77
83
  - application/soap+xml;charset=UTF-8
84
+ Accept-Encoding:
85
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
86
+ Accept:
87
+ - "*/*"
88
+ User-Agent:
89
+ - Ruby
78
90
  response:
79
91
  status:
80
92
  code: 200
@@ -85,21 +97,21 @@ http_interactions:
85
97
  Content-Type:
86
98
  - application/soap+xml; charset=utf-8
87
99
  Server:
88
- - Microsoft-IIS/8.0
100
+ - Microsoft-IIS/8.5
89
101
  X-Aspnet-Version:
90
102
  - 4.0.30319
91
103
  X-Powered-By:
92
104
  - ASP.NET
93
105
  Date:
94
- - Fri, 07 Aug 2015 13:45:48 GMT
106
+ - Mon, 10 Oct 2016 10:22:33 GMT
95
107
  Content-Length:
96
- - '446'
108
+ - '449'
97
109
  body:
98
110
  encoding: UTF-8
99
111
  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
100
112
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GeoTargetsResponse
101
113
  xmlns="http://cakemarketing.com/api/3/"><GeoTargetsResult><success>true</success><message>Geotarget(s)
102
- Added</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
114
+ Replaced</message><row_count>2</row_count></GeoTargetsResult></GeoTargetsResponse></soap:Body></soap:Envelope>
103
115
  http_version:
104
116
  recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
105
- recorded_with: VCR 2.9.3
117
+ recorded_with: VCR 3.0.1
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe SoapyCake::AdminAddedit do
3
+ # rubocop:disable RSpec/NestedGroups
3
4
  subject(:admin_addedit) { described_class.new }
4
5
 
5
6
  around { |example| Timecop.freeze(Time.utc(2015, 2, 17, 12), &example) }
@@ -149,14 +150,14 @@ RSpec.describe SoapyCake::AdminAddedit do
149
150
 
150
151
  describe 'geo targeting' do
151
152
  it 'creates geo targetings', :vcr do
152
- result = admin_addedit.add_geo_targets(
153
+ result = admin_addedit.edit_geo_targets(
153
154
  offer_contract_id: offer_contract_id,
154
155
  countries: %w(DE FR),
155
156
  allow_countries: true
156
157
  )
157
158
  expect(result).to include(success: true, row_count: '2')
158
159
 
159
- result = admin_addedit.add_geo_targets(
160
+ result = admin_addedit.edit_geo_targets(
160
161
  offer_contract_id: offer_contract_id,
161
162
  countries: %w(AT CH),
162
163
  redirects: {
@@ -170,7 +171,7 @@ RSpec.describe SoapyCake::AdminAddedit do
170
171
 
171
172
  it 'fails if it does not get a correct redirect hash' do
172
173
  expect do
173
- admin_addedit.add_geo_targets(
174
+ admin_addedit.edit_geo_targets(
174
175
  offer_contract_id: offer_contract_id,
175
176
  redirects: {},
176
177
  allow_countries: false
@@ -3,6 +3,7 @@ RSpec.describe SoapyCake::AdminAddedit do
3
3
  subject(:admin_addedit) { described_class.new }
4
4
 
5
5
  before do
6
+ # rubocop:disable RSpec/SubjectStub
6
7
  allow(admin_addedit).to receive(:run).and_return({})
7
8
  end
8
9
 
@@ -3,7 +3,7 @@ RSpec.describe SoapyCake::AdminBatched do
3
3
  subject(:admin_batched) { described_class.new }
4
4
  let(:admin) { instance_double(SoapyCake::Admin, xml_response?: false) }
5
5
 
6
- before :each do
6
+ before do
7
7
  allow(SoapyCake::Admin).to receive(:new).and_return(admin)
8
8
 
9
9
  stub_const('SoapyCake::AdminBatched::BatchedRequest::LIMIT', 2)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe SoapyCake::Admin do
3
+ # rubocop:disable RSpec/NestedGroups
3
4
  subject(:admin) { described_class.new }
4
5
  let(:opts) { nil }
5
6
  let(:cake_opts) { opts }
@@ -11,6 +11,7 @@ RSpec.describe SoapyCake::Affiliate do
11
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
+ # rubocop:disable RSpec/SubjectStub
14
15
  expect(affiliate).to receive(:run).with(request)
15
16
 
16
17
  affiliate.public_send(method, 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.26.0
4
+ version: 2.0.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: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  version: '0'
258
258
  requirements: []
259
259
  rubyforge_project:
260
- rubygems_version: 2.6.6
260
+ rubygems_version: 2.5.1
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Simple client for the CAKE API