soapy_cake 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/api_versions.yml +1 -0
- data/lib/soapy_cake.rb +3 -0
- data/lib/soapy_cake/admin.rb +4 -4
- data/lib/soapy_cake/admin_addedit.rb +115 -0
- data/lib/soapy_cake/client.rb +1 -1
- data/lib/soapy_cake/const.rb +39 -0
- data/lib/soapy_cake/helper.rb +11 -1
- data/lib/soapy_cake/request.rb +4 -0
- data/lib/soapy_cake/response.rb +13 -7
- data/lib/soapy_cake/version.rb +1 -1
- data/soapy_cake.gemspec +1 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_/_offer_contract_caps/removes_a_cap_for_an_offer_contract.yml +53 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_/_offer_contract_caps/updates_a_cap_for_an_offer_contract.yml +53 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_contracts/creates_an_offer_contract.yml +60 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_contracts/updates_an_offer_contract.yml +60 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_tiers/adds_an_offer_tier.yml +55 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offers/creates_an_offer.yml +96 -0
- data/spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offers/updates_an_offer.yml +95 -0
- data/spec/lib/soapy_cake/addedit_integration_spec.rb +185 -0
- data/spec/lib/soapy_cake/admin_spec.rb +7 -6
- data/spec/lib/soapy_cake/integration_spec.rb +2 -2
- data/spec/lib/soapy_cake/request_spec.rb +7 -0
- metadata +37 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0107652f9476d98d7948231f30c2483dcc060807
|
4
|
+
data.tar.gz: 26a0fc8182bb68f1178fd9a821786272132fe2ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aec19e1e56835808f384f4dae6e8f14dd8a1570687d19e5d5b330dd6b7293e3b2b7f0cc59d6297101ce04c20d4cdbc05842223e13367b0f8d4c570e8411ed32b
|
7
|
+
data.tar.gz: eebba180198ac7a1074a9c5568da4cfdd357f689461c769f3a77bdadad4633a70f944540aa68e3344d5b9757b8528122af74685f0e09aa83514349fb40559fea
|
data/api_versions.yml
CHANGED
data/lib/soapy_cake.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'saxerator'
|
3
3
|
require 'httparty'
|
4
|
+
require 'active_support/core_ext/hash/reverse_merge'
|
4
5
|
require 'active_support/core_ext/date'
|
5
6
|
require 'active_support/core_ext/numeric/time'
|
6
7
|
require 'active_support/core_ext/time/zones'
|
7
8
|
|
8
9
|
require 'soapy_cake/version'
|
10
|
+
require 'soapy_cake/const'
|
9
11
|
require 'soapy_cake/helper'
|
10
12
|
require 'soapy_cake/error'
|
11
13
|
require 'soapy_cake/request'
|
12
14
|
require 'soapy_cake/response'
|
13
15
|
require 'soapy_cake/client'
|
14
16
|
require 'soapy_cake/admin'
|
17
|
+
require 'soapy_cake/admin_addedit'
|
15
18
|
require 'soapy_cake/affiliate'
|
16
19
|
|
17
20
|
module SoapyCake
|
data/lib/soapy_cake/admin.rb
CHANGED
@@ -76,6 +76,10 @@ module SoapyCake
|
|
76
76
|
run Request.new(:admin, :get, :currencies, {})
|
77
77
|
end
|
78
78
|
|
79
|
+
def tiers(*)
|
80
|
+
run Request.new(:admin, :get, :affiliate_tiers, {})
|
81
|
+
end
|
82
|
+
|
79
83
|
def update_creative(opts = {})
|
80
84
|
run Request.new(:admin, :addedit, :creative, opts)
|
81
85
|
end
|
@@ -84,10 +88,6 @@ module SoapyCake
|
|
84
88
|
run Request.new(:admin, :addedit, :campaign, opts)
|
85
89
|
end
|
86
90
|
|
87
|
-
def update_offer(opts = {})
|
88
|
-
run Request.new(:admin, :addedit, :offer, opts)
|
89
|
-
end
|
90
|
-
|
91
91
|
def affiliate_signup(opts = {})
|
92
92
|
run Request.new(:admin, :signup, :affiliate, opts)
|
93
93
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module SoapyCake
|
2
|
+
class AdminAddedit < Client
|
3
|
+
include Helper
|
4
|
+
|
5
|
+
def add_offer(opts = {})
|
6
|
+
require_params(opts, %i(
|
7
|
+
hidden offer_status_id offer_type_id currency_id ssl click_cookie_days
|
8
|
+
impression_cookie_days redirect_404 enable_view_thru_conversion
|
9
|
+
click_trumps_impression disable_click_deduplication last_touch
|
10
|
+
enable_transaction_id_deduplication postbacks_only fire_global_pixel
|
11
|
+
fire_pixel_on_nonpaid_conversions offer_link thankyou_link from_lines
|
12
|
+
subject_lines))
|
13
|
+
|
14
|
+
addedit_offer(opts.merge(offer_id: 0))
|
15
|
+
end
|
16
|
+
|
17
|
+
def edit_offer(opts = {})
|
18
|
+
validate_id(opts, :offer_id)
|
19
|
+
|
20
|
+
addedit_offer(opts)
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_offer_contract(opts = {})
|
24
|
+
addedit_offer_contract(opts.merge(offer_contract_id: 0))
|
25
|
+
end
|
26
|
+
|
27
|
+
def edit_offer_contract(opts = {})
|
28
|
+
validate_id(opts, :offer_contract_id)
|
29
|
+
|
30
|
+
addedit_offer_contract(opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def update_caps(opts = {})
|
34
|
+
require_params(opts, %i(cap_type_id cap_interval_id cap_amount send_alert_only))
|
35
|
+
|
36
|
+
opts[:cap_amount] = -1 if opts[:cap_interval_id] == Const::CAP_INTERVAL_DISABLED
|
37
|
+
|
38
|
+
run Request.new(:admin, :addedit, :caps, opts)
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_offer_tier(opts = {})
|
42
|
+
require_params(opts, %i(offer_id tier_id price_format_id offer_contract_id status_id))
|
43
|
+
|
44
|
+
opts.merge!(
|
45
|
+
redirect_offer_contract_id: -1,
|
46
|
+
add_edit_option: 'add'
|
47
|
+
)
|
48
|
+
|
49
|
+
run Request.new(:admin, :addedit, :offer_tiers, opts)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def addedit_offer(opts)
|
55
|
+
require_params(opts, %i(
|
56
|
+
advertiser_id vertical_id postback_url_ms_delay offer_contract_hidden
|
57
|
+
price_format_id received received_percentage payout tags))
|
58
|
+
|
59
|
+
opts.each do |k, v|
|
60
|
+
opts[k] = 'on' if v == true
|
61
|
+
opts[k] = 'off' if v == false
|
62
|
+
end
|
63
|
+
|
64
|
+
opts.reverse_merge!(
|
65
|
+
offer_name: '',
|
66
|
+
third_party_name: '',
|
67
|
+
hidden: 'no_change',
|
68
|
+
offer_status_id: 0,
|
69
|
+
ssl: 'no_change',
|
70
|
+
click_cookie_days: -1,
|
71
|
+
impression_cookie_days: -1,
|
72
|
+
redirect_offer_contract_id: 0,
|
73
|
+
redirect_404: 'no_change',
|
74
|
+
enable_view_thru_conversion: 'no_change',
|
75
|
+
click_trumps_impression: 'no_change',
|
76
|
+
disable_click_deduplication: 'no_change',
|
77
|
+
last_touch: 'no_change',
|
78
|
+
enable_transaction_id_deduplication: 'no_change',
|
79
|
+
postbacks_only: 'no_change',
|
80
|
+
pixel_html: '',
|
81
|
+
postback_url: '',
|
82
|
+
fire_global_pixel: 'no_change',
|
83
|
+
fire_pixel_on_nonpaid_conversions: 'no_change',
|
84
|
+
conversion_cap_behavior: Const::CONVERSION_BEHAVIOR_SYSTEM,
|
85
|
+
conversion_behavior_on_redirect: Const::CONVERSION_BEHAVIOR_SYSTEM,
|
86
|
+
expiration_date: Date.today + (365 * 100),
|
87
|
+
expiration_date_modification_type: 'do_not_change',
|
88
|
+
offer_contract_name: '',
|
89
|
+
offer_link: '',
|
90
|
+
thankyou_link: '',
|
91
|
+
preview_link: '',
|
92
|
+
thumbnail_file_import_url: '',
|
93
|
+
offer_description: '',
|
94
|
+
restrictions: '',
|
95
|
+
advertiser_extended_terms: '',
|
96
|
+
testing_instructions: '',
|
97
|
+
allow_affiliates_to_create_creatives: 'no_change',
|
98
|
+
unsubscribe_link: '',
|
99
|
+
from_lines: '',
|
100
|
+
subject_lines: ''
|
101
|
+
)
|
102
|
+
|
103
|
+
run(Request.new(:admin, :addedit, :offer, opts))[:success_info]
|
104
|
+
end
|
105
|
+
|
106
|
+
def addedit_offer_contract(opts)
|
107
|
+
require_params(opts, %i(
|
108
|
+
offer_id offer_contract_id offer_contract_name price_format_id payout received
|
109
|
+
received_percentage offer_link thankyou_link offer_contract_hidden
|
110
|
+
offer_contract_is_default use_fallback_targeting))
|
111
|
+
|
112
|
+
run Request.new(:admin, :addedit, :offer_contract, opts)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
data/lib/soapy_cake/client.rb
CHANGED
@@ -21,7 +21,7 @@ module SoapyCake
|
|
21
21
|
url = "https://#{domain}#{request.path}"
|
22
22
|
body = HTTParty.post(url, headers: headers, body: request.xml).body
|
23
23
|
|
24
|
-
response = Response.new(body)
|
24
|
+
response = Response.new(body, request.addedit?)
|
25
25
|
response.time_offset = time_offset
|
26
26
|
response.collection
|
27
27
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module SoapyCake
|
2
|
+
module Const
|
3
|
+
OFFER_STATUS_PUBLIC = 1
|
4
|
+
OFFER_STATUS_PRIVATE = 2
|
5
|
+
OFFER_STATUS_APPLY_TO_RUN = 3
|
6
|
+
OFFER_STATUS_INACTIVE = 4
|
7
|
+
|
8
|
+
OFFER_TYPE_HOSTED = 1
|
9
|
+
OFFER_TYPE_HOST_N_POST = 2
|
10
|
+
OFFER_TYPE_3RD_PARTY = 3
|
11
|
+
|
12
|
+
CURRENCY_USD = 1
|
13
|
+
CURRENCY_EUR = 2
|
14
|
+
CURRENCY_GBD = 3
|
15
|
+
CURRENCY_AUD = 4
|
16
|
+
CURRENCY_CAD = 5
|
17
|
+
|
18
|
+
PRICE_FORMAT_CPA = 1
|
19
|
+
PRICE_FORMAT_CPC = 2
|
20
|
+
PRICE_FORMAT_CPM = 3
|
21
|
+
PRICE_FORMAT_FIXED = 4
|
22
|
+
PRICE_FORMAT_REVSHARE = 5
|
23
|
+
|
24
|
+
CONVERSION_BEHAVIOR_SYSTEM = 0
|
25
|
+
CONVERSION_BEHAVIOR_ADV_AFF = 1
|
26
|
+
CONVERSION_BEHAVIOR_ADV_NO_AFF = 2
|
27
|
+
CONVERSION_BEHAVIOR_IGNORE = 3
|
28
|
+
CONVERSION_BEHAVIOR_NO_ADV_AFF = 4
|
29
|
+
CONVERSION_BEHAVIOR_NO_ADV_NO_AFF = 5
|
30
|
+
|
31
|
+
CAP_TYPE_CLICK = 1
|
32
|
+
CAP_TYPE_CONVERSION = 2
|
33
|
+
|
34
|
+
CAP_INTERVAL_DISABLED = 0
|
35
|
+
CAP_INTERVAL_DAILY = 1
|
36
|
+
CAP_INTERVAL_WEEKLY = 2
|
37
|
+
CAP_INTERVAL_MONTHLY = 3
|
38
|
+
end
|
39
|
+
end
|
data/lib/soapy_cake/helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module SoapyCake
|
2
2
|
module Helper
|
3
|
-
def
|
3
|
+
def walk_tree(obj, key = nil, &block)
|
4
4
|
return nil if obj == {}
|
5
5
|
|
6
6
|
case obj
|
@@ -12,5 +12,15 @@ module SoapyCake
|
|
12
12
|
yield(obj, key)
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def validate_id(opts, key)
|
17
|
+
fail Error, "Parameter '#{key}' must be > 0!" if opts[key].to_i < 1
|
18
|
+
end
|
19
|
+
|
20
|
+
def require_params(opts, params)
|
21
|
+
params.each do |param|
|
22
|
+
fail Error, "Parameter '#{param}' missing!" unless opts.key?(param)
|
23
|
+
end
|
24
|
+
end
|
15
25
|
end
|
16
26
|
end
|
data/lib/soapy_cake/request.rb
CHANGED
data/lib/soapy_cake/response.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
module SoapyCake
|
2
2
|
class Response
|
3
|
+
include Helper
|
4
|
+
|
3
5
|
attr_accessor :time_offset
|
4
|
-
attr_reader :body
|
6
|
+
attr_reader :body, :addedit
|
5
7
|
|
6
|
-
def initialize(body)
|
8
|
+
def initialize(body, addedit)
|
7
9
|
@body = body
|
10
|
+
@addedit = addedit
|
8
11
|
end
|
9
12
|
|
10
13
|
def collection
|
11
14
|
check_errors!
|
12
15
|
|
16
|
+
return typed_element(sax.at_depth(3).first) if addedit
|
17
|
+
|
13
18
|
sax.at_depth(5).map do |element|
|
14
19
|
typed_element(element)
|
15
20
|
end
|
@@ -18,7 +23,7 @@ module SoapyCake
|
|
18
23
|
private
|
19
24
|
|
20
25
|
def typed_element(element)
|
21
|
-
|
26
|
+
walk_tree(element) do |value, key|
|
22
27
|
next value.to_i if key.to_s.end_with?('_id') && !key.to_s.end_with?('tax_id')
|
23
28
|
|
24
29
|
if /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d*\z/.match(value)
|
@@ -42,10 +47,11 @@ module SoapyCake
|
|
42
47
|
def check_errors!
|
43
48
|
fault = sax.for_tag(:fault).first
|
44
49
|
fail RequestFailed, fault[:reason][:text] if fault
|
45
|
-
unless sax.for_tag(:success).first == 'true'
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
fail RequestFailed, error_message unless sax.for_tag(:success).first == 'true'
|
51
|
+
end
|
52
|
+
|
53
|
+
def error_message
|
54
|
+
sax.for_tag(:message).first || sax.for_tag(:Text).first || 'Unknown error'
|
49
55
|
end
|
50
56
|
end
|
51
57
|
end
|
data/lib/soapy_cake/version.rb
CHANGED
data/soapy_cake.gemspec
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://cake-partner-domain.com/api/1/addedit.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:Caps>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:offer_contract_id>1456</cake:offer_contract_id>
|
16
|
+
<cake:cap_type_id>2</cake:cap_type_id>
|
17
|
+
<cake:cap_interval_id>0</cake:cap_interval_id>
|
18
|
+
<cake:cap_amount>-1</cake:cap_amount>
|
19
|
+
<cake:send_alert_only>false</cake:send_alert_only>
|
20
|
+
</cake:Caps>
|
21
|
+
</env:Body>
|
22
|
+
</env:Envelope>
|
23
|
+
headers:
|
24
|
+
Content-Type:
|
25
|
+
- application/soap+xml;charset=UTF-8
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 200
|
29
|
+
message: OK
|
30
|
+
headers:
|
31
|
+
Cache-Control:
|
32
|
+
- private, max-age=0
|
33
|
+
Content-Type:
|
34
|
+
- application/soap+xml; charset=utf-8
|
35
|
+
Server:
|
36
|
+
- Microsoft-IIS/8.0
|
37
|
+
X-Aspnet-Version:
|
38
|
+
- 4.0.30319
|
39
|
+
X-Powered-By:
|
40
|
+
- ASP.NET
|
41
|
+
Date:
|
42
|
+
- Tue, 17 Feb 2015 14:00:08 GMT
|
43
|
+
Content-Length:
|
44
|
+
- '391'
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
48
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CapsResponse
|
49
|
+
xmlns="http://cakemarketing.com/api/1/"><CapsResult><success>true</success><message>Cap
|
50
|
+
Updated</message></CapsResult></CapsResponse></soap:Body></soap:Envelope>
|
51
|
+
http_version:
|
52
|
+
recorded_at: Tue, 17 Feb 2015 14:00:11 GMT
|
53
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://cake-partner-domain.com/api/1/addedit.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:Caps>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:offer_contract_id>1456</cake:offer_contract_id>
|
16
|
+
<cake:cap_type_id>2</cake:cap_type_id>
|
17
|
+
<cake:cap_interval_id>1</cake:cap_interval_id>
|
18
|
+
<cake:cap_amount>42</cake:cap_amount>
|
19
|
+
<cake:send_alert_only>false</cake:send_alert_only>
|
20
|
+
</cake:Caps>
|
21
|
+
</env:Body>
|
22
|
+
</env:Envelope>
|
23
|
+
headers:
|
24
|
+
Content-Type:
|
25
|
+
- application/soap+xml;charset=UTF-8
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 200
|
29
|
+
message: OK
|
30
|
+
headers:
|
31
|
+
Cache-Control:
|
32
|
+
- private, max-age=0
|
33
|
+
Content-Type:
|
34
|
+
- application/soap+xml; charset=utf-8
|
35
|
+
Server:
|
36
|
+
- Microsoft-IIS/8.0
|
37
|
+
X-Aspnet-Version:
|
38
|
+
- 4.0.30319
|
39
|
+
X-Powered-By:
|
40
|
+
- ASP.NET
|
41
|
+
Date:
|
42
|
+
- Tue, 17 Feb 2015 13:56:30 GMT
|
43
|
+
Content-Length:
|
44
|
+
- '391'
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
48
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CapsResponse
|
49
|
+
xmlns="http://cakemarketing.com/api/1/"><CapsResult><success>true</success><message>Cap
|
50
|
+
Updated</message></CapsResult></CapsResponse></soap:Body></soap:Envelope>
|
51
|
+
http_version:
|
52
|
+
recorded_at: Tue, 17 Feb 2015 13:56:33 GMT
|
53
|
+
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/addedit.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:OfferContract>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:offer_id>8910</cake:offer_id>
|
16
|
+
<cake:offer_contract_name>Test Contract</cake:offer_contract_name>
|
17
|
+
<cake:price_format_id>1</cake:price_format_id>
|
18
|
+
<cake:received>3.2</cake:received>
|
19
|
+
<cake:received_percentage>false</cake:received_percentage>
|
20
|
+
<cake:payout>2.5</cake:payout>
|
21
|
+
<cake:offer_link>http://oc.example.com</cake:offer_link>
|
22
|
+
<cake:thankyou_link>http://oc.example.com/thanks</cake:thankyou_link>
|
23
|
+
<cake:offer_contract_hidden>true</cake:offer_contract_hidden>
|
24
|
+
<cake:offer_contract_is_default>false</cake:offer_contract_is_default>
|
25
|
+
<cake:use_fallback_targeting>true</cake:use_fallback_targeting>
|
26
|
+
<cake:offer_contract_id>0</cake:offer_contract_id>
|
27
|
+
</cake:OfferContract>
|
28
|
+
</env:Body>
|
29
|
+
</env:Envelope>
|
30
|
+
headers:
|
31
|
+
Content-Type:
|
32
|
+
- application/soap+xml;charset=UTF-8
|
33
|
+
response:
|
34
|
+
status:
|
35
|
+
code: 200
|
36
|
+
message: OK
|
37
|
+
headers:
|
38
|
+
Cache-Control:
|
39
|
+
- private, max-age=0
|
40
|
+
Content-Type:
|
41
|
+
- application/soap+xml; charset=utf-8
|
42
|
+
Server:
|
43
|
+
- Microsoft-IIS/8.0
|
44
|
+
X-Aspnet-Version:
|
45
|
+
- 4.0.30319
|
46
|
+
X-Powered-By:
|
47
|
+
- ASP.NET
|
48
|
+
Date:
|
49
|
+
- Tue, 17 Feb 2015 13:19:10 GMT
|
50
|
+
Content-Length:
|
51
|
+
- '486'
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
55
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><OfferContractResponse
|
56
|
+
xmlns="http://cakemarketing.com/api/1/"><OfferContractResult><success>true</success><message>Offer
|
57
|
+
Contract 1456 Created</message><offer_contract_id>1456</offer_contract_id></OfferContractResult></OfferContractResponse></soap:Body></soap:Envelope>
|
58
|
+
http_version:
|
59
|
+
recorded_at: Tue, 17 Feb 2015 13:19:12 GMT
|
60
|
+
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/addedit.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:OfferContract>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:offer_id>8910</cake:offer_id>
|
16
|
+
<cake:offer_contract_id>1456</cake:offer_contract_id>
|
17
|
+
<cake:offer_contract_name>Test Contract</cake:offer_contract_name>
|
18
|
+
<cake:price_format_id>1</cake:price_format_id>
|
19
|
+
<cake:received>3.2</cake:received>
|
20
|
+
<cake:received_percentage>false</cake:received_percentage>
|
21
|
+
<cake:payout>2.5</cake:payout>
|
22
|
+
<cake:offer_link>http://oc.example.com</cake:offer_link>
|
23
|
+
<cake:thankyou_link>http://oc.example.com/thanks</cake:thankyou_link>
|
24
|
+
<cake:offer_contract_hidden>true</cake:offer_contract_hidden>
|
25
|
+
<cake:offer_contract_is_default>false</cake:offer_contract_is_default>
|
26
|
+
<cake:use_fallback_targeting>true</cake:use_fallback_targeting>
|
27
|
+
</cake:OfferContract>
|
28
|
+
</env:Body>
|
29
|
+
</env:Envelope>
|
30
|
+
headers:
|
31
|
+
Content-Type:
|
32
|
+
- application/soap+xml;charset=UTF-8
|
33
|
+
response:
|
34
|
+
status:
|
35
|
+
code: 200
|
36
|
+
message: OK
|
37
|
+
headers:
|
38
|
+
Cache-Control:
|
39
|
+
- private, max-age=0
|
40
|
+
Content-Type:
|
41
|
+
- application/soap+xml; charset=utf-8
|
42
|
+
Server:
|
43
|
+
- Microsoft-IIS/8.0
|
44
|
+
X-Aspnet-Version:
|
45
|
+
- 4.0.30319
|
46
|
+
X-Powered-By:
|
47
|
+
- ASP.NET
|
48
|
+
Date:
|
49
|
+
- Tue, 17 Feb 2015 13:36:30 GMT
|
50
|
+
Content-Length:
|
51
|
+
- '486'
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
55
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><OfferContractResponse
|
56
|
+
xmlns="http://cakemarketing.com/api/1/"><OfferContractResult><success>true</success><message>Offer
|
57
|
+
Contract 1456 Updated</message><offer_contract_id>1456</offer_contract_id></OfferContractResult></OfferContractResponse></soap:Body></soap:Envelope>
|
58
|
+
http_version:
|
59
|
+
recorded_at: Tue, 17 Feb 2015 13:36:32 GMT
|
60
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://cake-partner-domain.com/api/1/addedit.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:OfferTiers>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:offer_id>8910</cake:offer_id>
|
16
|
+
<cake:offer_contract_id>1456</cake:offer_contract_id>
|
17
|
+
<cake:tier_id>4</cake:tier_id>
|
18
|
+
<cake:price_format_id>1</cake:price_format_id>
|
19
|
+
<cake:status_id>1</cake:status_id>
|
20
|
+
<cake:redirect_offer_contract_id>-1</cake:redirect_offer_contract_id>
|
21
|
+
<cake:add_edit_option>add</cake:add_edit_option>
|
22
|
+
</cake:OfferTiers>
|
23
|
+
</env:Body>
|
24
|
+
</env:Envelope>
|
25
|
+
headers:
|
26
|
+
Content-Type:
|
27
|
+
- application/soap+xml;charset=UTF-8
|
28
|
+
response:
|
29
|
+
status:
|
30
|
+
code: 200
|
31
|
+
message: OK
|
32
|
+
headers:
|
33
|
+
Cache-Control:
|
34
|
+
- private, max-age=0
|
35
|
+
Content-Type:
|
36
|
+
- application/soap+xml; charset=utf-8
|
37
|
+
Server:
|
38
|
+
- Microsoft-IIS/8.0
|
39
|
+
X-Aspnet-Version:
|
40
|
+
- 4.0.30319
|
41
|
+
X-Powered-By:
|
42
|
+
- ASP.NET
|
43
|
+
Date:
|
44
|
+
- Tue, 17 Feb 2015 14:33:01 GMT
|
45
|
+
Content-Length:
|
46
|
+
- '444'
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
50
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><OfferTiersResponse
|
51
|
+
xmlns="http://cakemarketing.com/api/1/"><OfferTiersResult><success>true</success><message>Offer
|
52
|
+
Tier Added</message><row_count>0</row_count></OfferTiersResult></OfferTiersResponse></soap:Body></soap:Envelope>
|
53
|
+
http_version:
|
54
|
+
recorded_at: Tue, 17 Feb 2015 14:33:04 GMT
|
55
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://cake-partner-domain.com/api/4/addedit.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:Offer>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:hidden>off</cake:hidden>
|
16
|
+
<cake:offer_status_id>1</cake:offer_status_id>
|
17
|
+
<cake:offer_type_id>3</cake:offer_type_id>
|
18
|
+
<cake:currency_id>2</cake:currency_id>
|
19
|
+
<cake:ssl>off</cake:ssl>
|
20
|
+
<cake:click_cookie_days>30</cake:click_cookie_days>
|
21
|
+
<cake:impression_cookie_days>30</cake:impression_cookie_days>
|
22
|
+
<cake:redirect_404>off</cake:redirect_404>
|
23
|
+
<cake:enable_view_thru_conversion>off</cake:enable_view_thru_conversion>
|
24
|
+
<cake:click_trumps_impression>off</cake:click_trumps_impression>
|
25
|
+
<cake:disable_click_deduplication>off</cake:disable_click_deduplication>
|
26
|
+
<cake:last_touch>off</cake:last_touch>
|
27
|
+
<cake:enable_transaction_id_deduplication>off</cake:enable_transaction_id_deduplication>
|
28
|
+
<cake:postbacks_only>off</cake:postbacks_only>
|
29
|
+
<cake:fire_global_pixel>on</cake:fire_global_pixel>
|
30
|
+
<cake:fire_pixel_on_nonpaid_conversions>off</cake:fire_pixel_on_nonpaid_conversions>
|
31
|
+
<cake:offer_link>http://www.example.com/</cake:offer_link>
|
32
|
+
<cake:thankyou_link>http://www.example.com/</cake:thankyou_link>
|
33
|
+
<cake:from_lines>from</cake:from_lines>
|
34
|
+
<cake:subject_lines>subject</cake:subject_lines>
|
35
|
+
<cake:advertiser_id>15886</cake:advertiser_id>
|
36
|
+
<cake:vertical_id>41</cake:vertical_id>
|
37
|
+
<cake:postback_url_ms_delay>60</cake:postback_url_ms_delay>
|
38
|
+
<cake:offer_contract_hidden>off</cake:offer_contract_hidden>
|
39
|
+
<cake:price_format_id>1</cake:price_format_id>
|
40
|
+
<cake:received>2.0</cake:received>
|
41
|
+
<cake:received_percentage>off</cake:received_percentage>
|
42
|
+
<cake:payout>1.5</cake:payout>
|
43
|
+
<cake:tags/>
|
44
|
+
<cake:offer_name>Test Offer</cake:offer_name>
|
45
|
+
<cake:offer_description>TEST1</cake:offer_description>
|
46
|
+
<cake:restrictions>TEST2</cake:restrictions>
|
47
|
+
<cake:advertiser_extended_terms>TEST3</cake:advertiser_extended_terms>
|
48
|
+
<cake:testing_instructions>TEST4</cake:testing_instructions>
|
49
|
+
<cake:offer_id>0</cake:offer_id>
|
50
|
+
<cake:third_party_name/>
|
51
|
+
<cake:redirect_offer_contract_id>0</cake:redirect_offer_contract_id>
|
52
|
+
<cake:pixel_html/>
|
53
|
+
<cake:postback_url/>
|
54
|
+
<cake:conversion_cap_behavior>0</cake:conversion_cap_behavior>
|
55
|
+
<cake:conversion_behavior_on_redirect>0</cake:conversion_behavior_on_redirect>
|
56
|
+
<cake:expiration_date>2115-01-24T01:00:00</cake:expiration_date>
|
57
|
+
<cake:expiration_date_modification_type>do_not_change</cake:expiration_date_modification_type>
|
58
|
+
<cake:offer_contract_name/>
|
59
|
+
<cake:preview_link/>
|
60
|
+
<cake:thumbnail_file_import_url/>
|
61
|
+
<cake:allow_affiliates_to_create_creatives>no_change</cake:allow_affiliates_to_create_creatives>
|
62
|
+
<cake:unsubscribe_link/>
|
63
|
+
</cake:Offer>
|
64
|
+
</env:Body>
|
65
|
+
</env:Envelope>
|
66
|
+
headers:
|
67
|
+
Content-Type:
|
68
|
+
- application/soap+xml;charset=UTF-8
|
69
|
+
response:
|
70
|
+
status:
|
71
|
+
code: 200
|
72
|
+
message: OK
|
73
|
+
headers:
|
74
|
+
Cache-Control:
|
75
|
+
- private, max-age=0
|
76
|
+
Content-Type:
|
77
|
+
- application/soap+xml; charset=utf-8
|
78
|
+
Server:
|
79
|
+
- Microsoft-IIS/8.0
|
80
|
+
X-Aspnet-Version:
|
81
|
+
- 4.0.30319
|
82
|
+
X-Powered-By:
|
83
|
+
- ASP.NET
|
84
|
+
Date:
|
85
|
+
- Tue, 17 Feb 2015 13:18:40 GMT
|
86
|
+
Content-Length:
|
87
|
+
- '562'
|
88
|
+
body:
|
89
|
+
encoding: UTF-8
|
90
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
91
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><OfferResponse
|
92
|
+
xmlns="http://cakemarketing.com/api/4/"><OfferResult><success>true</success><message>Offer
|
93
|
+
8910 Created</message><success_info><offer_id>8910</offer_id><offer_contract_id>1455</offer_contract_id><campaign_id>13301</campaign_id><creative_id>9431</creative_id></success_info></OfferResult></OfferResponse></soap:Body></soap:Envelope>
|
94
|
+
http_version:
|
95
|
+
recorded_at: Tue, 17 Feb 2015 13:18:43 GMT
|
96
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,95 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://cake-partner-domain.com/api/4/addedit.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:Offer>
|
14
|
+
<cake:api_key>cake-api-key</cake:api_key>
|
15
|
+
<cake:offer_id>8910</cake:offer_id>
|
16
|
+
<cake:advertiser_id>15886</cake:advertiser_id>
|
17
|
+
<cake:vertical_id>41</cake:vertical_id>
|
18
|
+
<cake:postback_url_ms_delay>50</cake:postback_url_ms_delay>
|
19
|
+
<cake:offer_contract_hidden>off</cake:offer_contract_hidden>
|
20
|
+
<cake:price_format_id>1</cake:price_format_id>
|
21
|
+
<cake:received>2.0</cake:received>
|
22
|
+
<cake:received_percentage>off</cake:received_percentage>
|
23
|
+
<cake:payout>1.5</cake:payout>
|
24
|
+
<cake:tags/>
|
25
|
+
<cake:offer_name/>
|
26
|
+
<cake:third_party_name/>
|
27
|
+
<cake:hidden>no_change</cake:hidden>
|
28
|
+
<cake:offer_status_id>0</cake:offer_status_id>
|
29
|
+
<cake:ssl>no_change</cake:ssl>
|
30
|
+
<cake:click_cookie_days>-1</cake:click_cookie_days>
|
31
|
+
<cake:impression_cookie_days>-1</cake:impression_cookie_days>
|
32
|
+
<cake:redirect_offer_contract_id>0</cake:redirect_offer_contract_id>
|
33
|
+
<cake:redirect_404>no_change</cake:redirect_404>
|
34
|
+
<cake:enable_view_thru_conversion>no_change</cake:enable_view_thru_conversion>
|
35
|
+
<cake:click_trumps_impression>no_change</cake:click_trumps_impression>
|
36
|
+
<cake:disable_click_deduplication>no_change</cake:disable_click_deduplication>
|
37
|
+
<cake:last_touch>no_change</cake:last_touch>
|
38
|
+
<cake:enable_transaction_id_deduplication>no_change</cake:enable_transaction_id_deduplication>
|
39
|
+
<cake:postbacks_only>no_change</cake:postbacks_only>
|
40
|
+
<cake:pixel_html/>
|
41
|
+
<cake:postback_url/>
|
42
|
+
<cake:fire_global_pixel>no_change</cake:fire_global_pixel>
|
43
|
+
<cake:fire_pixel_on_nonpaid_conversions>no_change</cake:fire_pixel_on_nonpaid_conversions>
|
44
|
+
<cake:conversion_cap_behavior>0</cake:conversion_cap_behavior>
|
45
|
+
<cake:conversion_behavior_on_redirect>0</cake:conversion_behavior_on_redirect>
|
46
|
+
<cake:expiration_date>2115-01-24T01:00:00</cake:expiration_date>
|
47
|
+
<cake:expiration_date_modification_type>do_not_change</cake:expiration_date_modification_type>
|
48
|
+
<cake:offer_contract_name/>
|
49
|
+
<cake:offer_link/>
|
50
|
+
<cake:thankyou_link/>
|
51
|
+
<cake:preview_link/>
|
52
|
+
<cake:thumbnail_file_import_url/>
|
53
|
+
<cake:offer_description/>
|
54
|
+
<cake:restrictions/>
|
55
|
+
<cake:advertiser_extended_terms/>
|
56
|
+
<cake:testing_instructions/>
|
57
|
+
<cake:allow_affiliates_to_create_creatives>no_change</cake:allow_affiliates_to_create_creatives>
|
58
|
+
<cake:unsubscribe_link/>
|
59
|
+
<cake:from_lines/>
|
60
|
+
<cake:subject_lines/>
|
61
|
+
</cake:Offer>
|
62
|
+
</env:Body>
|
63
|
+
</env:Envelope>
|
64
|
+
headers:
|
65
|
+
Content-Type:
|
66
|
+
- application/soap+xml;charset=UTF-8
|
67
|
+
response:
|
68
|
+
status:
|
69
|
+
code: 200
|
70
|
+
message: OK
|
71
|
+
headers:
|
72
|
+
Cache-Control:
|
73
|
+
- private, max-age=0
|
74
|
+
Content-Type:
|
75
|
+
- application/soap+xml; charset=utf-8
|
76
|
+
Server:
|
77
|
+
- Microsoft-IIS/8.0
|
78
|
+
X-Aspnet-Version:
|
79
|
+
- 4.0.30319
|
80
|
+
X-Powered-By:
|
81
|
+
- ASP.NET
|
82
|
+
Date:
|
83
|
+
- Tue, 17 Feb 2015 13:19:09 GMT
|
84
|
+
Content-Length:
|
85
|
+
- '559'
|
86
|
+
body:
|
87
|
+
encoding: UTF-8
|
88
|
+
string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
|
89
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><OfferResponse
|
90
|
+
xmlns="http://cakemarketing.com/api/4/"><OfferResult><success>true</success><message>Offer
|
91
|
+
8910 Updated</message><success_info><offer_id>8910</offer_id><offer_contract_id>1455</offer_contract_id><campaign_id
|
92
|
+
xsi:nil="true" /><creative_id xsi:nil="true" /></success_info></OfferResult></OfferResponse></soap:Body></soap:Envelope>
|
93
|
+
http_version:
|
94
|
+
recorded_at: Tue, 17 Feb 2015 13:19:11 GMT
|
95
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,185 @@
|
|
1
|
+
RSpec.describe 'ADDEDIT integration test' do
|
2
|
+
subject { SoapyCake::AdminAddedit.new }
|
3
|
+
|
4
|
+
around { |example| Timecop.freeze(Time.utc(2015, 2, 17, 12), &example) }
|
5
|
+
|
6
|
+
let(:advertiser_id) { 15886 }
|
7
|
+
let(:vertical_id) { 41 }
|
8
|
+
let(:offer_id) { 8910 }
|
9
|
+
let(:offer_contract_id) { 1456 }
|
10
|
+
let(:tier_id) { 4 }
|
11
|
+
|
12
|
+
describe 'offers' do
|
13
|
+
it 'creates an offer', :vcr do
|
14
|
+
result = subject.add_offer(
|
15
|
+
hidden: false,
|
16
|
+
offer_status_id: SoapyCake::Const::OFFER_STATUS_PUBLIC,
|
17
|
+
offer_type_id: SoapyCake::Const::OFFER_TYPE_3RD_PARTY,
|
18
|
+
currency_id: SoapyCake::Const::CURRENCY_EUR,
|
19
|
+
ssl: false,
|
20
|
+
click_cookie_days: 30,
|
21
|
+
impression_cookie_days: 30,
|
22
|
+
redirect_404: 'off',
|
23
|
+
enable_view_thru_conversion: 'off',
|
24
|
+
click_trumps_impression: 'off',
|
25
|
+
disable_click_deduplication: 'off',
|
26
|
+
last_touch: 'off',
|
27
|
+
enable_transaction_id_deduplication: 'off',
|
28
|
+
postbacks_only: 'off',
|
29
|
+
fire_global_pixel: 'on',
|
30
|
+
fire_pixel_on_nonpaid_conversions: 'off',
|
31
|
+
offer_link: 'http://www.example.com/',
|
32
|
+
thankyou_link: 'http://www.example.com/',
|
33
|
+
from_lines: 'from',
|
34
|
+
subject_lines: 'subject',
|
35
|
+
|
36
|
+
advertiser_id: advertiser_id,
|
37
|
+
vertical_id: vertical_id,
|
38
|
+
postback_url_ms_delay: 60,
|
39
|
+
offer_contract_hidden: false,
|
40
|
+
price_format_id: SoapyCake::Const::PRICE_FORMAT_CPA,
|
41
|
+
received: 2.0,
|
42
|
+
received_percentage: false,
|
43
|
+
payout: 1.5,
|
44
|
+
|
45
|
+
tags: '',
|
46
|
+
offer_name: 'Test Offer',
|
47
|
+
offer_description: 'TEST1',
|
48
|
+
restrictions: 'TEST2',
|
49
|
+
advertiser_extended_terms: 'TEST3',
|
50
|
+
testing_instructions: 'TEST4'
|
51
|
+
)
|
52
|
+
|
53
|
+
expect(result).to include(
|
54
|
+
creative_id: 9431,
|
55
|
+
offer_contract_id: 1455,
|
56
|
+
offer_id: 8910
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'updates an offer', :vcr do
|
61
|
+
result = subject.edit_offer(
|
62
|
+
offer_id: offer_id,
|
63
|
+
|
64
|
+
advertiser_id: advertiser_id,
|
65
|
+
vertical_id: vertical_id,
|
66
|
+
postback_url_ms_delay: 50,
|
67
|
+
offer_contract_hidden: false,
|
68
|
+
price_format_id: SoapyCake::Const::PRICE_FORMAT_CPA,
|
69
|
+
received: 2.0,
|
70
|
+
received_percentage: false,
|
71
|
+
payout: 1.5,
|
72
|
+
tags: ''
|
73
|
+
)
|
74
|
+
|
75
|
+
expect(result).to include(offer_id: offer_id)
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'errors' do
|
79
|
+
it 'fails when not enough params are given' do
|
80
|
+
expect do
|
81
|
+
subject.edit_offer(offer_id: 123)
|
82
|
+
end.to raise_error(SoapyCake::Error, "Parameter 'advertiser_id' missing!")
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'fails when invalid offer_id is given on edit' do
|
86
|
+
expect do
|
87
|
+
subject.edit_offer(offer_id: -1)
|
88
|
+
end.to raise_error(SoapyCake::Error, "Parameter 'offer_id' must be > 0!")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe 'offer contracts' do
|
94
|
+
it 'creates an offer contract', :vcr do
|
95
|
+
result = subject.add_offer_contract(
|
96
|
+
offer_id: offer_id,
|
97
|
+
offer_contract_name: 'Test Contract',
|
98
|
+
price_format_id: SoapyCake::Const::PRICE_FORMAT_CPA,
|
99
|
+
received: 3.2,
|
100
|
+
received_percentage: false,
|
101
|
+
payout: 2.5,
|
102
|
+
offer_link: 'http://oc.example.com',
|
103
|
+
thankyou_link: 'http://oc.example.com/thanks',
|
104
|
+
offer_contract_hidden: true,
|
105
|
+
offer_contract_is_default: false,
|
106
|
+
use_fallback_targeting: true
|
107
|
+
)
|
108
|
+
|
109
|
+
expect(result).to include(offer_contract_id: 1456)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'updates an offer contract', :vcr do
|
113
|
+
result = subject.edit_offer_contract(
|
114
|
+
offer_id: offer_id,
|
115
|
+
offer_contract_id: offer_contract_id,
|
116
|
+
offer_contract_name: 'Test Contract',
|
117
|
+
price_format_id: SoapyCake::Const::PRICE_FORMAT_CPA,
|
118
|
+
received: 3.2,
|
119
|
+
received_percentage: false,
|
120
|
+
payout: 2.5,
|
121
|
+
offer_link: 'http://oc.example.com',
|
122
|
+
thankyou_link: 'http://oc.example.com/thanks',
|
123
|
+
offer_contract_hidden: true,
|
124
|
+
offer_contract_is_default: false,
|
125
|
+
use_fallback_targeting: true
|
126
|
+
)
|
127
|
+
|
128
|
+
expect(result).to include(offer_contract_id: 1456)
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'errors' do
|
132
|
+
it 'fails when not enough params are given' do
|
133
|
+
expect do
|
134
|
+
subject.edit_offer_contract(offer_contract_id: 123)
|
135
|
+
end.to raise_error(SoapyCake::Error, "Parameter 'offer_id' missing!")
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'fails when invalid offer_id is given on edit' do
|
139
|
+
expect do
|
140
|
+
subject.edit_offer_contract(offer_contract_id: -1)
|
141
|
+
end.to raise_error(SoapyCake::Error, "Parameter 'offer_contract_id' must be > 0!")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe 'offer / offer contract caps' do
|
147
|
+
it 'updates a cap for an offer contract', :vcr do
|
148
|
+
result = subject.update_caps(
|
149
|
+
offer_contract_id: offer_contract_id,
|
150
|
+
cap_type_id: SoapyCake::Const::CAP_TYPE_CONVERSION,
|
151
|
+
cap_interval_id: SoapyCake::Const::CAP_INTERVAL_DAILY,
|
152
|
+
cap_amount: 42,
|
153
|
+
send_alert_only: false
|
154
|
+
)
|
155
|
+
|
156
|
+
expect(result[:message]).to eq('Cap Updated')
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'removes a cap for an offer contract', :vcr do
|
160
|
+
result = subject.update_caps(
|
161
|
+
offer_contract_id: offer_contract_id,
|
162
|
+
cap_type_id: SoapyCake::Const::CAP_TYPE_CONVERSION,
|
163
|
+
cap_interval_id: SoapyCake::Const::CAP_INTERVAL_DISABLED,
|
164
|
+
cap_amount: 42,
|
165
|
+
send_alert_only: false
|
166
|
+
)
|
167
|
+
|
168
|
+
expect(result[:message]).to eq('Cap Updated')
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe 'offer tiers' do
|
173
|
+
it 'adds an offer tier', :vcr do
|
174
|
+
result = subject.add_offer_tier(
|
175
|
+
offer_id: offer_id,
|
176
|
+
offer_contract_id: offer_contract_id,
|
177
|
+
tier_id: tier_id,
|
178
|
+
price_format_id: SoapyCake::Const::PRICE_FORMAT_CPA,
|
179
|
+
status_id: SoapyCake::Const::OFFER_STATUS_PUBLIC
|
180
|
+
)
|
181
|
+
|
182
|
+
expect(result[:message]).to eq('Offer Tier Added')
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -130,6 +130,13 @@ RSpec.describe SoapyCake::Admin do
|
|
130
130
|
let(:cake_opts) { {} }
|
131
131
|
it_behaves_like 'a cake admin method'
|
132
132
|
end
|
133
|
+
|
134
|
+
describe '#tiers' do
|
135
|
+
let(:method) { :tiers }
|
136
|
+
let(:cake_method) { :affiliate_tiers }
|
137
|
+
let(:cake_opts) { {} }
|
138
|
+
it_behaves_like 'a cake admin method'
|
139
|
+
end
|
133
140
|
end
|
134
141
|
|
135
142
|
describe 'addedit service' do
|
@@ -146,12 +153,6 @@ RSpec.describe SoapyCake::Admin do
|
|
146
153
|
let(:cake_method) { :campaign }
|
147
154
|
it_behaves_like 'a cake admin method'
|
148
155
|
end
|
149
|
-
|
150
|
-
describe '#update_creative' do
|
151
|
-
let(:method) { :update_offer }
|
152
|
-
let(:cake_method) { :offer }
|
153
|
-
it_behaves_like 'a cake admin method'
|
154
|
-
end
|
155
156
|
end
|
156
157
|
|
157
158
|
describe 'signup service' do
|
@@ -13,11 +13,11 @@ RSpec.describe 'Integration test' do
|
|
13
13
|
# dates
|
14
14
|
date_created: DateTime.new(2014, 4, 28, 10, 52, 15.537),
|
15
15
|
# floats
|
16
|
-
minimum_payment_threshold: '0.0000'
|
16
|
+
minimum_payment_threshold: '0.0000'
|
17
17
|
)
|
18
18
|
|
19
19
|
# arrays
|
20
|
-
expect(result.first[:contacts][:contact_info].map { |contact| contact[:contact_id]}).to \
|
20
|
+
expect(result.first[:contacts][:contact_info].map { |contact| contact[:contact_id] }).to \
|
21
21
|
eq([8819, 8820])
|
22
22
|
end
|
23
23
|
|
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.
|
4
|
+
version: 1.2.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-02-
|
11
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: timecop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
153
167
|
description: Simple client for the CAKE API (http://getcake.com)
|
154
168
|
email:
|
155
169
|
- developers@ad2games.com
|
@@ -167,20 +181,31 @@ files:
|
|
167
181
|
- api_versions.yml
|
168
182
|
- lib/soapy_cake.rb
|
169
183
|
- lib/soapy_cake/admin.rb
|
184
|
+
- lib/soapy_cake/admin_addedit.rb
|
170
185
|
- lib/soapy_cake/affiliate.rb
|
171
186
|
- lib/soapy_cake/client.rb
|
187
|
+
- lib/soapy_cake/const.rb
|
172
188
|
- lib/soapy_cake/error.rb
|
173
189
|
- lib/soapy_cake/helper.rb
|
174
190
|
- lib/soapy_cake/request.rb
|
175
191
|
- lib/soapy_cake/response.rb
|
176
192
|
- lib/soapy_cake/version.rb
|
177
193
|
- soapy_cake.gemspec
|
194
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_/_offer_contract_caps/removes_a_cap_for_an_offer_contract.yml
|
195
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_/_offer_contract_caps/updates_a_cap_for_an_offer_contract.yml
|
196
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_contracts/creates_an_offer_contract.yml
|
197
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_contracts/updates_an_offer_contract.yml
|
198
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_tiers/adds_an_offer_tier.yml
|
199
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offers/creates_an_offer.yml
|
200
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offers/updates_an_offer.yml
|
178
201
|
- spec/fixtures/vcr_cassettes/Integration_test/raises_if_there_is_an_error.yml
|
179
202
|
- spec/fixtures/vcr_cassettes/Integration_test/returns_a_clicks_report_with_a_defined_time_range.yml
|
180
203
|
- spec/fixtures/vcr_cassettes/Integration_test/returns_an_affiliate_with_correct_data_types.yml
|
204
|
+
- spec/lib/soapy_cake/addedit_integration_spec.rb
|
181
205
|
- spec/lib/soapy_cake/admin_spec.rb
|
182
206
|
- spec/lib/soapy_cake/affiliate_spec.rb
|
183
207
|
- spec/lib/soapy_cake/integration_spec.rb
|
208
|
+
- spec/lib/soapy_cake/request_spec.rb
|
184
209
|
- spec/spec_helper.rb
|
185
210
|
homepage: http://ad2games.com
|
186
211
|
licenses:
|
@@ -202,15 +227,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
227
|
version: '0'
|
203
228
|
requirements: []
|
204
229
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.4.
|
230
|
+
rubygems_version: 2.4.6
|
206
231
|
signing_key:
|
207
232
|
specification_version: 4
|
208
233
|
summary: Simple client for the CAKE API
|
209
234
|
test_files:
|
235
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_/_offer_contract_caps/removes_a_cap_for_an_offer_contract.yml
|
236
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_/_offer_contract_caps/updates_a_cap_for_an_offer_contract.yml
|
237
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_contracts/creates_an_offer_contract.yml
|
238
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_contracts/updates_an_offer_contract.yml
|
239
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offer_tiers/adds_an_offer_tier.yml
|
240
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offers/creates_an_offer.yml
|
241
|
+
- spec/fixtures/vcr_cassettes/ADDEDIT_integration_test/offers/updates_an_offer.yml
|
210
242
|
- spec/fixtures/vcr_cassettes/Integration_test/raises_if_there_is_an_error.yml
|
211
243
|
- spec/fixtures/vcr_cassettes/Integration_test/returns_a_clicks_report_with_a_defined_time_range.yml
|
212
244
|
- spec/fixtures/vcr_cassettes/Integration_test/returns_an_affiliate_with_correct_data_types.yml
|
245
|
+
- spec/lib/soapy_cake/addedit_integration_spec.rb
|
213
246
|
- spec/lib/soapy_cake/admin_spec.rb
|
214
247
|
- spec/lib/soapy_cake/affiliate_spec.rb
|
215
248
|
- spec/lib/soapy_cake/integration_spec.rb
|
249
|
+
- spec/lib/soapy_cake/request_spec.rb
|
216
250
|
- spec/spec_helper.rb
|