soapy_cake 1.23.1 → 1.24.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3709fcadb320803e1d0ca6dc207e0824c42a882e
4
- data.tar.gz: dbf854e7043d65559bc22ad9b4c7d7fb33472935
3
+ metadata.gz: 659ad505616720d0362c9f604740448dad327275
4
+ data.tar.gz: 506d9efebe3aecfee20c7c84ef846811f6c6c430
5
5
  SHA512:
6
- metadata.gz: 947e3659ed6e8cde1e0d4901da4cf8235e23bc0af6542dee020f6907d892f27863f0a4ed8b4ab89e08cb3f8ef5591457771ac85e9a9d5222ed13e507181db22f
7
- data.tar.gz: 3f3f1d695178a8881ee75a06200e7e6cc269b5c7f8f242f07347fe07e3cf8f7329de373995e4e9f59966293b45df193f4261233d91465ef2801fb7cd43ce62a4
6
+ metadata.gz: f3aa817cff5db27b22bbe2bb92110d75d376a552fc68b8aeaca640f23fad3472a2fa756ed87f17edaedf994869f61169dcd496d5b9b52bc7ea8af37520adf7d2
7
+ data.tar.gz: 0a2670a01da6c9ca8dd797238bb871c5d8060b37e6b39a3800850e29abd991ebb91ff514ffa18d896c348e2f00124856392d9e6359c482d3bb3077f388821da4
@@ -70,6 +70,24 @@ module SoapyCake
70
70
  offer_contract_is_default use_fallback_targeting
71
71
  ).freeze
72
72
 
73
+ CAMPAIGN_UPDATE_DEFAULT_OPTIONS = {
74
+ account_status_id: :no_change,
75
+ auto_disposition_delay_hours: 0,
76
+ clear_session_on_conversion: 'no_change',
77
+ currency_id: 0,
78
+ expiration_date_modification_type: 'do_not_change',
79
+ media_type_id: 0,
80
+ paid: 'no_change',
81
+ paid_redirects: 'no_change',
82
+ paid_upsells: 'no_change',
83
+ postback_delay_ms: -1,
84
+ redirect_404: 'no_change',
85
+ redirect_offer_contract_id: 0,
86
+ review: 'no_change',
87
+ use_offer_contract_payout: 'no_change',
88
+ payout_update_option: 'do_not_change'
89
+ }.freeze
90
+
73
91
  def add_offer(opts)
74
92
  require_params(opts, REQUIRED_NEW_OFFER_PARAMS)
75
93
 
@@ -169,14 +187,15 @@ module SoapyCake
169
187
  end
170
188
 
171
189
  def add_campaign(opts)
172
- addedit_campaign(opts.merge(campaign_id: 0))
190
+ require_params(opts, %i(affiliate_id offer_id account_status_id payout))
191
+ addedit_campaign(opts.merge(campaign_id: 0, expiration_date: future_expiration_date))
173
192
  end
174
193
 
175
194
  def edit_campaign(opts)
176
195
  require_params(opts, %i(campaign_id))
177
196
  validate_id(opts, :campaign_id)
178
197
 
179
- addedit_campaign(opts)
198
+ addedit_campaign(CAMPAIGN_UPDATE_DEFAULT_OPTIONS.merge(opts))
180
199
  end
181
200
 
182
201
  private
@@ -239,15 +258,8 @@ module SoapyCake
239
258
  end
240
259
 
241
260
  def addedit_campaign(opts)
242
- require_params(opts, %i(affiliate_id offer_id media_type_id account_status_id payout))
243
-
244
261
  opts = translate_values(opts, %i(account_status_id))
245
-
246
- opts = opts.reverse_merge(
247
- display_link_type_id: 1,
248
- expiration_date: future_expiration_date
249
- )
250
-
262
+ opts = opts.reverse_merge(display_link_type_id: 1)
251
263
  run Request.new(:admin, :addedit, :campaign, opts)
252
264
  end
253
265
  end
@@ -20,6 +20,7 @@ module SoapyCake
20
20
 
21
21
  CONSTS = {
22
22
  account_status_id: {
23
+ no_change: 0,
23
24
  active: 1,
24
25
  inactive: 2,
25
26
  pending: 3
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SoapyCake
3
- VERSION = '1.23.1'
3
+ VERSION = '1.24.1'
4
4
  end
@@ -13,13 +13,13 @@ http_interactions:
13
13
  <cake:Campaign>
14
14
  <cake:api_key>cake-api-key</cake:api_key>
15
15
  <cake:display_link_type_id>1</cake:display_link_type_id>
16
- <cake:expiration_date>2045-02-09T01:00:00</cake:expiration_date>
17
16
  <cake:affiliate_id>1</cake:affiliate_id>
18
17
  <cake:offer_id>8910</cake:offer_id>
19
18
  <cake:media_type_id>1</cake:media_type_id>
20
19
  <cake:account_status_id>1</cake:account_status_id>
21
20
  <cake:payout>1.23</cake:payout>
22
21
  <cake:campaign_id>0</cake:campaign_id>
22
+ <cake:expiration_date>2045-02-09T01:00:00</cake:expiration_date>
23
23
  </cake:Campaign>
24
24
  </env:Body>
25
25
  </env:Envelope>
@@ -36,21 +36,21 @@ http_interactions:
36
36
  Content-Type:
37
37
  - application/soap+xml; charset=utf-8
38
38
  Server:
39
- - Microsoft-IIS/8.0
39
+ - Microsoft-IIS/8.5
40
40
  X-Aspnet-Version:
41
41
  - 4.0.30319
42
42
  X-Powered-By:
43
43
  - ASP.NET
44
44
  Date:
45
- - Mon, 15 Jun 2015 12:26:41 GMT
45
+ - Wed, 04 May 2016 09:44:12 GMT
46
46
  Content-Length:
47
- - '628'
47
+ - '629'
48
48
  body:
49
49
  encoding: UTF-8
50
50
  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
51
51
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CampaignResponse
52
52
  xmlns="http://cakemarketing.com/api/3/"><CampaignResult><success>true</success><message>Campaign
53
- Created</message><success_info><campaign_id>18243</campaign_id><affiliate_id>1</affiliate_id><offer_id>8910</offer_id><offer_contract_id>1455</offer_contract_id><media_type_id>1</media_type_id><original>true</original></success_info></CampaignResult></CampaignResponse></soap:Body></soap:Envelope>
53
+ Created</message><success_info><campaign_id>22081</campaign_id><affiliate_id>1</affiliate_id><offer_id>8910</offer_id><offer_contract_id>1455</offer_contract_id><media_type_id>1</media_type_id><original>false</original></success_info></CampaignResult></CampaignResponse></soap:Body></soap:Envelope>
54
54
  http_version:
55
55
  recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
56
- recorded_with: VCR 2.9.3
56
+ recorded_with: VCR 3.0.1
@@ -13,12 +13,24 @@ http_interactions:
13
13
  <cake:Campaign>
14
14
  <cake:api_key>cake-api-key</cake:api_key>
15
15
  <cake:display_link_type_id>1</cake:display_link_type_id>
16
- <cake:expiration_date>2045-02-09T01:00:00</cake:expiration_date>
16
+ <cake:account_status_id>1</cake:account_status_id>
17
+ <cake:auto_disposition_delay_hours>0</cake:auto_disposition_delay_hours>
18
+ <cake:clear_session_on_conversion>no_change</cake:clear_session_on_conversion>
19
+ <cake:currency_id>0</cake:currency_id>
20
+ <cake:expiration_date_modification_type>do_not_change</cake:expiration_date_modification_type>
21
+ <cake:media_type_id>1</cake:media_type_id>
22
+ <cake:paid>no_change</cake:paid>
23
+ <cake:paid_redirects>no_change</cake:paid_redirects>
24
+ <cake:paid_upsells>no_change</cake:paid_upsells>
25
+ <cake:postback_delay_ms>-1</cake:postback_delay_ms>
26
+ <cake:redirect_404>no_change</cake:redirect_404>
27
+ <cake:redirect_offer_contract_id>0</cake:redirect_offer_contract_id>
28
+ <cake:review>no_change</cake:review>
29
+ <cake:use_offer_contract_payout>no_change</cake:use_offer_contract_payout>
30
+ <cake:payout_update_option>do_not_change</cake:payout_update_option>
17
31
  <cake:campaign_id>123</cake:campaign_id>
18
32
  <cake:affiliate_id>1</cake:affiliate_id>
19
33
  <cake:offer_id>8910</cake:offer_id>
20
- <cake:media_type_id>1</cake:media_type_id>
21
- <cake:account_status_id>1</cake:account_status_id>
22
34
  <cake:payout>1.23</cake:payout>
23
35
  </cake:Campaign>
24
36
  </env:Body>
@@ -36,13 +48,13 @@ http_interactions:
36
48
  Content-Type:
37
49
  - application/soap+xml; charset=utf-8
38
50
  Server:
39
- - Microsoft-IIS/8.0
51
+ - Microsoft-IIS/8.5
40
52
  X-Aspnet-Version:
41
53
  - 4.0.30319
42
54
  X-Powered-By:
43
55
  - ASP.NET
44
56
  Date:
45
- - Mon, 15 Jun 2015 12:27:13 GMT
57
+ - Wed, 04 May 2016 09:44:11 GMT
46
58
  Content-Length:
47
59
  - '626'
48
60
  body:
@@ -53,4 +65,4 @@ http_interactions:
53
65
  Updated</message><success_info><campaign_id>123</campaign_id><affiliate_id>-1</affiliate_id><offer_id>5078</offer_id><offer_contract_id>123</offer_contract_id><media_type_id>1</media_type_id><original>true</original></success_info></CampaignResult></CampaignResponse></soap:Body></soap:Envelope>
54
66
  http_version:
55
67
  recorded_at: Tue, 17 Feb 2015 12:00:00 GMT
56
- recorded_with: VCR 2.9.3
68
+ recorded_with: VCR 3.0.1
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe SoapyCake::AdminAddedit do
3
3
  before do
4
- allow_any_instance_of(SoapyCake::Client) # rubocop:disable RSpec/AnyInstance
5
- .to receive(:run).and_return({})
4
+ allow(subject).to receive(:run).and_return({})
6
5
  end
7
6
 
8
7
  describe '#edit_offer' do
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,7 @@ end
6
6
  require 'bundler/setup'
7
7
  Bundler.require(:default, :development)
8
8
  require 'soapy_cake'
9
+ require 'webmock/rspec'
9
10
 
10
11
  Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
11
12
 
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.23.1
4
+ version: 1.24.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-06-30 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport