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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b83f34c1746ec07e1eb0eb47ddbb50c9fea4796c
4
- data.tar.gz: f0dd1db1eaa1ba6550669564ea3a0c6984021a8c
3
+ metadata.gz: 9a66e1c42c1689312ec741c7ca995566d85e5aba
4
+ data.tar.gz: a2bf186bbde7a7373798b2805c987a93181ed584
5
5
  SHA512:
6
- metadata.gz: ce98500805287cef4ed338947ca7f556e707c6143941ba02a9a9b2ce71d1ddd340347d742a69cccb277d4ce2bcf03c6e1c80d7572fe36b82185376710cc6e555
7
- data.tar.gz: 082ec9d5cd54283ca0857bad5cf246bd43faf03bf27ac4314e8ebf3267b79ae593333668d1b06a9b2cccb2bc6bc6e60c4ed1f729dd512ef2c92585a7a4847365
6
+ metadata.gz: 9b10715b6a53bd27bc8f7eec15bd821f310e86d9ed5e65391997c6d18660d61ab8f0199f07d1f1787f1d7877d0b5d92028aaff32f4ec447b0eda92b8f36ce4e5
7
+ data.tar.gz: 56f798c3dac1384e86d44608ec97c995157c47b86f11357a4f4f537bf5e70b360d8414ea1bc342d509cad98c3b5d1ce4df526523640466255d6377a23f3c0fc3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
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
- opts = geo_targets_allow_options(opts)
95
- else
96
- opts = geo_targets_redirect_options(opts)
97
- end
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
- currency_id offer_status_id offer_type_id price_format_id
223
- conversion_cap_behavior conversion_behavior_on_redirect
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
- conversion_date affiliate_id sub_affiliate
19
- campaign_id creative_id total_to_insert
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
@@ -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
- time_offset = opts.fetch(:time_offset, ENV['CAKE_TIME_OFFSET'])
10
- time_zone = opts.fetch(:time_zone, ENV['CAKE_TIME_ZONE'])
11
- @time_converter = TimeConverter.new(time_zone, time_offset)
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(tries: 5, on: RateLimitError, sleep: -> (n) { 3**n }) do
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
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module SoapyCake
2
3
  module Helper
3
4
  def walk_tree(obj, key = nil, &block)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module SoapyCake
2
3
  class Request
3
4
  DATE_CLASSES = [Date, Time, DateTime, ActiveSupport::TimeWithZone].freeze
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module SoapyCake
2
3
  class Response
3
4
  include Helper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module SoapyCake
2
3
  class ResponseValue
3
4
  attr_reader :key, :value
@@ -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
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module SoapyCake
2
- VERSION = '1.20.0'.freeze
3
+ VERSION = '1.21.0'.freeze
3
4
  end
@@ -31,8 +31,8 @@ RSpec.describe SoapyCake::Response do
31
31
 
32
32
  it 'parses the CAKE XML structure properly' do
33
33
  expect(subject.to_enum.to_a).to eq([
34
- { id: '123' },
35
- { id: '312' }
36
- ])
34
+ { id: '123' },
35
+ { id: '312' }
36
+ ])
37
37
  end
38
38
  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.20.0
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: 2015-11-03 00:00:00.000000000 Z
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.4.8
273
+ rubygems_version: 2.5.1
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Simple client for the CAKE API