soapy_cake 1.14.0 → 1.14.1

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: d99924dd593a9f0d8fd215d02a44177a7919cb13
4
- data.tar.gz: da5d81a7738efdd7cfc4f1dd8372c1f4c7faa5d0
3
+ metadata.gz: 975d77a9bebc36a642eb905204a727ac4b461c18
4
+ data.tar.gz: 515c4a92916f800774388ab2169d354f5052d2c6
5
5
  SHA512:
6
- metadata.gz: a03fac64800f777a61b8c59969b16d133f252be0f8857b88c419496fc629a1fd639f260c0a87dcab706651e7dfaea7a7ab0c03a6b58e689e2c4fcb84b9095f5e
7
- data.tar.gz: 470188fc1c53c5f2c798f32edc8a438ee7aae6f585798f1a585f72b248125a113f5be268d8b6de852cb33af91ff53c95aa910969d5a27251471ad5b6fc03c12b
6
+ metadata.gz: 9209729dd365c22b06a09d96de5751a609a3b970b189fe9533f84721cc468886eb133ff9ca0dcba4d4df5cab50fb2139af16baa4eaaf5025659db77d46f75094
7
+ data.tar.gz: dfd5f4b2ff618af93fcd79d94ec9eb890186b52a9f41e042400a6f7911fadbb1809f3496b906e1022c08f25d499156008967cf4e04ebb8870ce977ef5a0e4a5c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.3
@@ -1,4 +1,5 @@
1
1
  module SoapyCake
2
+ # rubocop:disable Metrics/ClassLength
2
3
  class Admin < Client
3
4
  include Helper
4
5
 
@@ -105,8 +106,15 @@ module SoapyCake
105
106
  run Request.new(:admin, :addedit, :campaign, opts)
106
107
  end
107
108
 
108
- def add_blacklist(opts = {})
109
- run Request.new(:admin, :addedit, :blacklist, opts)
109
+ def add_blacklist(opts)
110
+ require_params(opts, %i(blacklist_date))
111
+
112
+ run Request.new(
113
+ :admin,
114
+ :addedit,
115
+ :blacklist,
116
+ opts.merge(blacklist_date: (opts[:blacklist_date] + 1.day).to_s)
117
+ )
110
118
  end
111
119
 
112
120
  def affiliate_signup(opts = {})
@@ -47,7 +47,7 @@ module SoapyCake
47
47
  payout_modification_type: 'change',
48
48
  received_modification_type: 'change',
49
49
  tags_modification_type: 'do_not_change'
50
- }
50
+ }.freeze
51
51
 
52
52
  REQUIRED_NEW_OFFER_PARAMS = %i(
53
53
  hidden offer_status_id offer_type_id currency_id ssl click_cookie_days
@@ -56,18 +56,18 @@ module SoapyCake
56
56
  enable_transaction_id_deduplication postbacks_only fire_global_pixel
57
57
  fire_pixel_on_nonpaid_conversions offer_link thankyou_link from_lines
58
58
  subject_lines
59
- )
59
+ ).freeze
60
60
 
61
61
  REQUIRED_OFFER_PARAMS = %i(
62
62
  advertiser_id vertical_id postback_url_ms_delay offer_contract_hidden
63
63
  price_format_id received received_percentage payout tags
64
- )
64
+ ).freeze
65
65
 
66
66
  REQUIRED_OFFER_CONTRACT_PARAMS = %i(
67
67
  offer_id offer_contract_id offer_contract_name price_format_id payout received
68
68
  received_percentage offer_link thankyou_link offer_contract_hidden
69
69
  offer_contract_is_default use_fallback_targeting
70
- )
70
+ ).freeze
71
71
 
72
72
  def add_offer(opts)
73
73
  require_params(opts, REQUIRED_NEW_OFFER_PARAMS)
@@ -2,7 +2,7 @@ module SoapyCake
2
2
  class AdminBatched
3
3
  ALLOWED_METHODS = %i(
4
4
  advertisers affiliates campaigns offers creatives clicks conversions events
5
- )
5
+ ).freeze
6
6
 
7
7
  def initialize(opts = {})
8
8
  @opts = opts
@@ -1,17 +1,30 @@
1
1
  module SoapyCake
2
2
  module Const
3
+ # The ID mapping in the API docs is wrong, these values are taken from the UI.
4
+ CONVERSION_BEHAVIOUR_ID = {
5
+ system: 0,
6
+ adv_off: 1,
7
+ adv_no_aff: 2,
8
+ no_adv_aff: 3,
9
+ no_adv_no_aff: 4,
10
+ ignore: 5
11
+ }.freeze
12
+
13
+ OFFER_STATUS_ID = {
14
+ public: 1,
15
+ private: 2,
16
+ apply_to_run: 3,
17
+ inactive: 4
18
+ }.freeze
19
+
3
20
  CONSTS = {
4
21
  account_status_id: {
5
22
  active: 1,
6
23
  inactive: 2,
7
24
  pending: 3
8
25
  },
9
- offer_status_id: {
10
- public: 1,
11
- private: 2,
12
- apply_to_run: 3,
13
- inactive: 4
14
- },
26
+ offer_status_id: OFFER_STATUS_ID,
27
+ status_id: OFFER_STATUS_ID,
15
28
  offer_type_id: {
16
29
  hosted: 1,
17
30
  host_n_post: 2,
@@ -36,15 +49,9 @@ module SoapyCake
36
49
  fixed: 4,
37
50
  revshare: 5
38
51
  },
39
- # The ID mapping in the API docs is wrong, these values are taken from the UI.
40
- conversion_behavior_id: {
41
- system: 0,
42
- adv_off: 1,
43
- adv_no_aff: 2,
44
- no_adv_aff: 3,
45
- no_adv_no_aff: 4,
46
- ignore: 5
47
- },
52
+ conversion_behavior_id: CONVERSION_BEHAVIOUR_ID,
53
+ conversion_cap_behavior: CONVERSION_BEHAVIOUR_ID,
54
+ conversion_behavior_on_redirect: CONVERSION_BEHAVIOUR_ID,
48
55
  cap_type_id: {
49
56
  click: 1,
50
57
  conversion: 2
@@ -67,12 +74,6 @@ module SoapyCake
67
74
  inactive: 2,
68
75
  hidden: 3
69
76
  }
70
- }
71
-
72
- CONSTS.merge!(
73
- conversion_cap_behavior: CONSTS[:conversion_behavior_id],
74
- conversion_behavior_on_redirect: CONSTS[:conversion_behavior_id],
75
- status_id: CONSTS[:offer_status_id]
76
- )
77
+ }.freeze
77
78
  end
78
79
  end
@@ -4,7 +4,7 @@ module SoapyCake
4
4
  attr_reader :key
5
5
 
6
6
  # Known string ids that should not be parsed as integers
7
- STRING_IDS = %w(tax_id transaction_id)
7
+ STRING_IDS = %w(tax_id transaction_id).freeze
8
8
 
9
9
  def initialize(key, value, opts = {})
10
10
  @key = key.to_s
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '1.14.0'
2
+ VERSION = '1.14.1'.freeze
3
3
  end
@@ -6,6 +6,7 @@ RSpec.describe SoapyCake::AdminTrack do
6
6
  let(:cake_method) { :decrypt_affiliate_link }
7
7
  let(:method) { :decrypt_affiliate_link }
8
8
  let(:cake_opts) { { a: 1 } }
9
+ let(:opts) { nil }
9
10
 
10
11
  it_behaves_like 'a cake admin method'
11
12
  end
@@ -1,5 +1,5 @@
1
1
  RSpec.describe SoapyCake::Admin do
2
- let(:opts) { { a: 1 } }
2
+ let(:opts) { nil }
3
3
  let(:cake_opts) { opts }
4
4
  let(:cake_method) { method }
5
5
 
@@ -88,7 +88,7 @@ RSpec.describe SoapyCake::Admin do
88
88
 
89
89
  describe '#conversions' do
90
90
  let(:method) { :conversions }
91
- let(:cake_opts) { opts.merge(conversion_type: 'conversions') }
91
+ let(:cake_opts) { { conversion_type: 'conversions' } }
92
92
  it_behaves_like 'a cake admin method'
93
93
  end
94
94
 
@@ -100,7 +100,7 @@ RSpec.describe SoapyCake::Admin do
100
100
  describe '#events' do
101
101
  let(:method) { :events }
102
102
  let(:cake_method) { :conversions }
103
- let(:cake_opts) { opts.merge(conversion_type: 'events') }
103
+ let(:cake_opts) { { conversion_type: 'events' } }
104
104
  it_behaves_like 'a cake admin method'
105
105
  end
106
106
 
@@ -176,6 +176,10 @@ RSpec.describe SoapyCake::Admin do
176
176
  describe '#add_blacklist' do
177
177
  let(:method) { :add_blacklist }
178
178
  let(:cake_method) { :blacklist }
179
+ let(:date) { Date.new(2015, 9, 3) }
180
+ let(:request) { double('request') }
181
+ let(:opts) { { blacklist_date: date } }
182
+ let(:cake_opts) { { blacklist_date: (date + 1.day).to_s } }
179
183
  it_behaves_like 'a cake admin method'
180
184
  end
181
185
  end
@@ -6,6 +6,7 @@ RSpec.describe SoapyCake::AdminTrack do
6
6
  let(:cake_method) { :decrypt_affiliate_link }
7
7
  let(:method) { :decrypt_affiliate_link }
8
8
  let(:cake_opts) { { a: 1 } }
9
+ let(:opts) { nil }
9
10
 
10
11
  it_behaves_like 'a cake admin method'
11
12
  end
@@ -6,6 +6,6 @@ RSpec.shared_examples_for 'a cake admin method' do
6
6
  .with(:admin, service, cake_method, cake_opts || {}).and_return(request)
7
7
  expect(subject).to receive(:run).with(request)
8
8
 
9
- subject.public_send(method, *[cake_opts].compact)
9
+ subject.public_send(method, *[opts || cake_opts].compact)
10
10
  end
11
11
  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.0
4
+ version: 1.14.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: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport