soapy_cake 1.14.4 → 1.15.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: c3b654857b547eb51c491365ab4d343ea30124de
4
- data.tar.gz: c9b18927ce5bf7bf1acc3dac882f1ff5c8bef1b0
3
+ metadata.gz: ded8535f4f057f3e55884f2c0cc218743e4134b9
4
+ data.tar.gz: 34dda1abcf277214c5d9442e35da548fc3667b36
5
5
  SHA512:
6
- metadata.gz: 0b225c933a256d0749bc1d257965dc3e7ce25782d1638051d89a61a663343b706e0a91070bcfc25f689c75bc9497b83f60a592da51ab1b72de64e274c69ca9d2
7
- data.tar.gz: 48a3a5488dfd7ac40a65074cca5680e219550d01407cf5cbef80adc18d945cd40114fb91b99eeecceb920d4a6329272cc340cdaee69d4785e8cbcd18bba409fd
6
+ metadata.gz: a0ffe0fa81c8b12a34b56cc3a680825ccf2dbee32106b76ee7bdb812d154b6b1cb99cbbdcdce4a88dfbbf72d8ebeaf2f9a852e30dc099cbb378a072499bb343f
7
+ data.tar.gz: e27a015d263b827d239142cd315a294846c2b8aacd90b5a7edf6e8c0d56e5333b73968c7d47e8bb43fd1ec81e858b993496571a4fd8098e6fc677b0af171e469
@@ -98,7 +98,7 @@ admin:
98
98
  # Version 2 returns an error about an invalid action, so using version 1
99
99
  mass_conversion_insert: 1
100
100
  rejected_dispositions: 1
101
- update_conversion: 2
101
+ update_conversion: 4
102
102
  update_conversion_disposition: 2
103
103
  update_conversion_price: 2
104
104
  update_conversion_revenue: 1
@@ -2,18 +2,32 @@ module SoapyCake
2
2
  class AdminTrack < Client
3
3
  include Helper
4
4
 
5
+ CONVERSION_DEFAULTS = {
6
+ add_to_existing_payout: false,
7
+ received_option: 'total_revenue',
8
+ received: 0,
9
+ disposition_type: 'no_change',
10
+ update_revshare_payout: false,
11
+ effective_date_option: 'today',
12
+ notes_to_append: '',
13
+ disallow_on_billing_status: 'ignore'
14
+ }.freeze
15
+
5
16
  def mass_conversion_insert(opts)
6
- require_params(
7
- opts,
8
- %i(
9
- conversion_date affiliate_id sub_affiliate
10
- campaign_id creative_id total_to_insert
11
- )
12
- )
17
+ require_params(opts, %i(
18
+ conversion_date affiliate_id sub_affiliate
19
+ campaign_id creative_id total_to_insert
20
+ ))
13
21
 
14
22
  run Request.new(:admin, :track, :mass_conversion_insert, opts)
15
23
  end
16
24
 
25
+ def update_conversion(opts)
26
+ require_params(opts, %i(offer_id payout))
27
+
28
+ run Request.new(:admin, :track, :update_conversion, CONVERSION_DEFAULTS.merge(opts))
29
+ end
30
+
17
31
  def decrypt_affiliate_link(opts = {})
18
32
  run Request.new(:admin, :track, :decrypt_affiliate_link, opts)
19
33
  end
@@ -52,6 +52,12 @@ module SoapyCake
52
52
  conversion_behavior_id: CONVERSION_BEHAVIOUR_ID,
53
53
  conversion_cap_behavior: CONVERSION_BEHAVIOUR_ID,
54
54
  conversion_behavior_on_redirect: CONVERSION_BEHAVIOUR_ID,
55
+ conversion_disposition_id: {
56
+ pending: 1,
57
+ rejected: 2,
58
+ approved: 3,
59
+ returned: 4
60
+ },
55
61
  cap_type_id: {
56
62
  click: 1,
57
63
  conversion: 2
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '1.14.4'.freeze
2
+ VERSION = '1.15.0'.freeze
3
3
  end
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://cake-partner-domain.com/api/4/track.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/4/">
11
+ <env:Header/>
12
+ <env:Body>
13
+ <cake:UpdateConversion>
14
+ <cake:api_key>cake-api-key</cake:api_key>
15
+ <cake:add_to_existing_payout>false</cake:add_to_existing_payout>
16
+ <cake:received_option>total_revenue</cake:received_option>
17
+ <cake:received>1.75</cake:received>
18
+ <cake:disposition_type>no_change</cake:disposition_type>
19
+ <cake:update_revshare_payout>false</cake:update_revshare_payout>
20
+ <cake:effective_date_option>today</cake:effective_date_option>
21
+ <cake:notes_to_append/>
22
+ <cake:disallow_on_billing_status>ignore</cake:disallow_on_billing_status>
23
+ <cake:conversion_id>145211</cake:conversion_id>
24
+ <cake:offer_id>5032</cake:offer_id>
25
+ <cake:payout>0.75</cake:payout>
26
+ </cake:UpdateConversion>
27
+ </env:Body>
28
+ </env:Envelope>
29
+ headers:
30
+ Content-Type:
31
+ - application/soap+xml;charset=UTF-8
32
+ response:
33
+ status:
34
+ code: 200
35
+ message: OK
36
+ headers:
37
+ Cache-Control:
38
+ - private, max-age=0
39
+ Content-Type:
40
+ - application/soap+xml; charset=utf-8
41
+ Server:
42
+ - Microsoft-IIS/8.5
43
+ X-Aspnet-Version:
44
+ - 4.0.30319
45
+ X-Powered-By:
46
+ - ASP.NET
47
+ Date:
48
+ - Mon, 12 Oct 2015 09:58:20 GMT
49
+ Content-Length:
50
+ - '446'
51
+ body:
52
+ encoding: UTF-8
53
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
54
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><UpdateConversionResponse
55
+ xmlns="http://cakemarketing.com/api/4/"><UpdateConversionResult><success>true</success><message>Conversion
56
+ Updated</message></UpdateConversionResult></UpdateConversionResponse></soap:Body></soap:Envelope>
57
+ http_version:
58
+ recorded_at: Mon, 12 Oct 2015 09:58:29 GMT
59
+ recorded_with: VCR 2.9.3
@@ -1,18 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe SoapyCake::AdminTrack do
4
- describe '#decrypt_affiliate_link' do
5
- let(:service) { :track }
6
- let(:cake_method) { :decrypt_affiliate_link }
7
- let(:method) { :decrypt_affiliate_link }
8
- let(:cake_opts) { { a: 1 } }
9
- let(:opts) { nil }
10
-
11
- it_behaves_like 'a cake admin method'
12
- end
13
-
14
4
  describe '#mass_conversion_insert', :vcr do
15
- it 'insers conversions' do
5
+ it 'inserts conversions' do
16
6
  result = subject.mass_conversion_insert(
17
7
  conversion_date: Date.new(2015, 5, 6),
18
8
  affiliate_id: 16059,
@@ -25,4 +15,17 @@ RSpec.describe SoapyCake::AdminTrack do
25
15
  expect(result).to eq(success: true, message: 'Conversions Inserted')
26
16
  end
27
17
  end
18
+
19
+ describe '#update_conversion', :vcr do
20
+ it 'updates a conversion' do
21
+ result = subject.update_conversion(
22
+ conversion_id: 145211,
23
+ offer_id: 5032,
24
+ payout: 0.75,
25
+ received: 1.75
26
+ )
27
+
28
+ expect(result).to eq(success: true, message: 'Conversion Updated')
29
+ end
30
+ end
28
31
  end
@@ -10,4 +10,14 @@ RSpec.describe SoapyCake::AdminTrack do
10
10
 
11
11
  it_behaves_like 'a cake admin method'
12
12
  end
13
+
14
+ describe '#update_conversion' do
15
+ let(:service) { :track }
16
+ let(:cake_method) { :update_conversion }
17
+ let(:method) { :update_conversion }
18
+ let(:cake_opts) { described_class::CONVERSION_DEFAULTS.merge(opts) }
19
+ let(:opts) { { offer_id: 42, payout: 0 } }
20
+
21
+ it_behaves_like 'a cake admin method'
22
+ end
13
23
  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.14.4
4
+ version: 1.15.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-09-30 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -216,7 +216,8 @@ files:
216
216
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offer_tiers/edits_an_offer_tier.yml
217
217
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offers/creates_an_offer.yml
218
218
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offers/updates_an_offer.yml
219
- - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_mass_conversion_insert/insers_conversions.yml
219
+ - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_mass_conversion_insert/inserts_conversions.yml
220
+ - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_update_conversion/updates_a_conversion.yml
220
221
  - spec/integration/soapy_cake/admin_addedit_spec.rb
221
222
  - spec/integration/soapy_cake/admin_spec.rb
222
223
  - spec/integration/soapy_cake/admin_track_spec.rb
@@ -276,7 +277,8 @@ test_files:
276
277
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offer_tiers/edits_an_offer_tier.yml
277
278
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offers/creates_an_offer.yml
278
279
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offers/updates_an_offer.yml
279
- - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_mass_conversion_insert/insers_conversions.yml
280
+ - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_mass_conversion_insert/inserts_conversions.yml
281
+ - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_update_conversion/updates_a_conversion.yml
280
282
  - spec/integration/soapy_cake/admin_addedit_spec.rb
281
283
  - spec/integration/soapy_cake/admin_spec.rb
282
284
  - spec/integration/soapy_cake/admin_track_spec.rb