soapy_cake 1.20.0 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/soapy_cake/admin_addedit.rb +8 -8
- data/lib/soapy_cake/admin_track.rb +3 -3
- data/lib/soapy_cake/client.rb +11 -5
- data/lib/soapy_cake/helper.rb +1 -0
- data/lib/soapy_cake/request.rb +1 -0
- data/lib/soapy_cake/response.rb +1 -0
- data/lib/soapy_cake/response_value.rb +1 -0
- data/lib/soapy_cake/time_converter.rb +5 -4
- data/lib/soapy_cake/version.rb +2 -1
- data/spec/lib/soapy_cake/response_spec.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a66e1c42c1689312ec741c7ca995566d85e5aba
|
4
|
+
data.tar.gz: a2bf186bbde7a7373798b2805c987a93181ed584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b10715b6a53bd27bc8f7eec15bd821f310e86d9ed5e65391997c6d18660d61ab8f0199f07d1f1787f1d7877d0b5d92028aaff32f4ec447b0eda92b8f36ce4e5
|
7
|
+
data.tar.gz: 56f798c3dac1384e86d44608ec97c995157c47b86f11357a4f4f537bf5e70b360d8414ea1bc342d509cad98c3b5d1ce4df526523640466255d6377a23f3c0fc3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
@@ -90,11 +90,11 @@ module SoapyCake
|
|
90
90
|
def add_geo_targets(opts)
|
91
91
|
require_params(opts, %i(offer_contract_id allow_countries))
|
92
92
|
|
93
|
-
if opts[:allow_countries]
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
93
|
+
opts = if opts[:allow_countries]
|
94
|
+
geo_targets_allow_options(opts)
|
95
|
+
else
|
96
|
+
geo_targets_redirect_options(opts)
|
97
|
+
end
|
98
98
|
|
99
99
|
opts = opts.merge(add_edit_option: 'add', set_targeting_to_geo: true)
|
100
100
|
|
@@ -219,9 +219,9 @@ module SoapyCake
|
|
219
219
|
opts = translate_booleans(opts)
|
220
220
|
opts = apply_tag_opts(opts)
|
221
221
|
opts = translate_values(opts, %i(
|
222
|
-
|
223
|
-
|
224
|
-
|
222
|
+
currency_id offer_status_id offer_type_id price_format_id
|
223
|
+
conversion_cap_behavior conversion_behavior_on_redirect
|
224
|
+
))
|
225
225
|
|
226
226
|
run(Request.new(:admin, :addedit, :offer, default_offer_options.merge(opts)))[:success_info]
|
227
227
|
end
|
@@ -15,9 +15,9 @@ module SoapyCake
|
|
15
15
|
|
16
16
|
def mass_conversion_insert(opts)
|
17
17
|
require_params(opts, %i(
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
conversion_date affiliate_id sub_affiliate
|
19
|
+
campaign_id creative_id total_to_insert
|
20
|
+
))
|
21
21
|
|
22
22
|
run Request.new(:admin, :track, :mass_conversion_insert, opts)
|
23
23
|
end
|
data/lib/soapy_cake/client.rb
CHANGED
@@ -5,10 +5,12 @@ module SoapyCake
|
|
5
5
|
def initialize(opts = {})
|
6
6
|
@domain = opts.fetch(:domain, ENV['CAKE_DOMAIN']) || fail(Error, 'Cake domain missing')
|
7
7
|
@api_key = opts.fetch(:api_key, ENV['CAKE_API_KEY']) || fail(Error, 'Cake API key missing')
|
8
|
+
@retry_count = opts.fetch(:retry_count, ENV['CAKE_RETRY_COUNT']) || 4
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
@time_converter = TimeConverter.new(
|
11
|
+
opts.fetch(:time_zone, ENV['CAKE_TIME_ZONE']),
|
12
|
+
opts.fetch(:time_offset, ENV['CAKE_TIME_OFFSET'])
|
13
|
+
)
|
12
14
|
|
13
15
|
@opts = opts
|
14
16
|
end
|
@@ -19,13 +21,17 @@ module SoapyCake
|
|
19
21
|
|
20
22
|
protected
|
21
23
|
|
22
|
-
attr_reader :domain, :api_key, :time_converter, :opts, :logger
|
24
|
+
attr_reader :domain, :api_key, :time_converter, :opts, :logger, :retry_count
|
23
25
|
|
24
26
|
def run(request)
|
25
27
|
request.api_key = api_key
|
26
28
|
request.time_converter = time_converter
|
27
29
|
|
28
|
-
Retryable.retryable(
|
30
|
+
Retryable.retryable(
|
31
|
+
tries: retry_count + 1,
|
32
|
+
on: [RateLimitError, SocketError],
|
33
|
+
sleep: -> (n) { 3**n }
|
34
|
+
) do
|
29
35
|
response = Response.new(response_body(request), request.short_response?, time_converter)
|
30
36
|
xml_response? ? response.to_xml : response.to_enum
|
31
37
|
end
|
data/lib/soapy_cake/helper.rb
CHANGED
data/lib/soapy_cake/request.rb
CHANGED
data/lib/soapy_cake/response.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module SoapyCake
|
2
3
|
class TimeConverter
|
3
4
|
def initialize(time_zone, time_offset = nil)
|
@@ -21,15 +22,15 @@ module SoapyCake
|
|
21
22
|
zone.parse(value).utc
|
22
23
|
end
|
23
24
|
|
24
|
-
private
|
25
|
-
|
26
|
-
attr_reader :zone
|
27
|
-
|
28
25
|
def self.print_deprecation_warning
|
29
26
|
return if @deprecation_warning_printed
|
30
27
|
@deprecation_warning_printed = true
|
31
28
|
|
32
29
|
STDERR.puts 'SoapyCake - DEPRECATED: Please use time_zone instead of time_offset.'
|
33
30
|
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :zone
|
34
35
|
end
|
35
36
|
end
|
data/lib/soapy_cake/version.rb
CHANGED
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.21.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:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.5.1
|
274
274
|
signing_key:
|
275
275
|
specification_version: 4
|
276
276
|
summary: Simple client for the CAKE API
|