hasoffersv3 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/hasoffersv3/offer.rb +21 -0
- data/lib/hasoffersv3/version.rb +1 -1
- data/spec/lib/offer_spec.rb +73 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a92135ecef16e5e7f165c9fa042bbbe27b03346
|
4
|
+
data.tar.gz: 3c6983207542025e882bbf0549bf3879b65bee3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8e57b4cde27df38ff33a0d209eb01cc1212c7d41662b35f86afa4d929b902c63cb5d89954e6e65770d3f2fc6dbbd21f2c3cf4c7b2a6f1c8556dcfa270dfe3fd
|
7
|
+
data.tar.gz: 7f277adeb140d6e34aa3d0fdabe3675243058b5c36d9852a02b7c56a601acfbdf0ffe158fc62ba7ba63160c405db7ca9b2c31e69890c03127a6b7c018233af68
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.5.2
|
2
|
+
- [#54] Added Offer::addGroup method
|
3
|
+
- [#51] Added Offer::create, Offer::addTargetCountry and Offer::unblockAffiliate methods
|
4
|
+
|
5
|
+
# 0.5.1
|
6
|
+
- [#50] Added Affiliate::update method
|
7
|
+
|
1
8
|
# 0.4.0
|
2
9
|
- [#42] Support "Employee": findAll, find_all_by_ids and find_by_id
|
3
10
|
- [#41] Added config option `read_timeout` to changed default timeout to 60
|
data/lib/hasoffersv3/offer.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
class HasOffersV3
|
2
2
|
class Offer < Base
|
3
|
+
|
4
|
+
def add_group(params)
|
5
|
+
requires! params, [:id, :group_id]
|
6
|
+
post_request 'addGroup', params
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_target_country(params)
|
10
|
+
requires! params, [:id, :country_code]
|
11
|
+
post_request 'addTargetCountry', params
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(params = {})
|
15
|
+
requires! params, [:data]
|
16
|
+
post_request 'create', params
|
17
|
+
end
|
18
|
+
|
3
19
|
def find_all(params = {})
|
4
20
|
post_request 'findAll', params
|
5
21
|
end
|
@@ -58,5 +74,10 @@ class HasOffersV3
|
|
58
74
|
requires! params, [:id]
|
59
75
|
post_request 'getTierPayouts', params
|
60
76
|
end
|
77
|
+
|
78
|
+
def unblock_affilate(params = {})
|
79
|
+
requires! params, [:id, :affiliate_id]
|
80
|
+
post_request 'unblockAffilate', params
|
81
|
+
end
|
61
82
|
end
|
62
83
|
end
|
data/lib/hasoffersv3/version.rb
CHANGED
data/spec/lib/offer_spec.rb
CHANGED
@@ -169,4 +169,77 @@ describe HasOffersV3::Offer do
|
|
169
169
|
expect { subject.get_tier_payouts }.to raise_error ArgumentError
|
170
170
|
end
|
171
171
|
end
|
172
|
+
|
173
|
+
describe '#create' do
|
174
|
+
it 'makes a proper request call' do
|
175
|
+
stub_call
|
176
|
+
response = subject.create data: { name: "Test" }
|
177
|
+
expect(a_request(:post, url).with(
|
178
|
+
body: hash_including({'Method' => 'create', 'data' => {'name' => 'Test'}}))
|
179
|
+
).to have_been_made
|
180
|
+
validate_call response
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'fails without data' do
|
184
|
+
expect { subject.create }.to raise_error ArgumentError
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe '#unblock_affilate' do
|
189
|
+
it 'makes a proper request call' do
|
190
|
+
stub_call
|
191
|
+
response = subject.unblock_affilate id: 1, affiliate_id: 123
|
192
|
+
expect(a_request(:post, url).with(
|
193
|
+
body: hash_including({'Method' => 'unblockAffilate','id' => '1','affiliate_id' => '123'}))
|
194
|
+
).to have_been_made
|
195
|
+
end
|
196
|
+
|
197
|
+
context 'when required params are missing' do
|
198
|
+
it 'fails without id' do
|
199
|
+
expect { subject.unblock_affilate affiliate_id: 1 }.to raise_error ArgumentError
|
200
|
+
end
|
201
|
+
it 'fails without affiliate_id' do
|
202
|
+
expect { subject.unblock_affilate id: 10 }.to raise_error ArgumentError
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
|
208
|
+
describe '#add_target_country' do
|
209
|
+
it 'makes a proper request call' do
|
210
|
+
stub_call
|
211
|
+
response = subject.add_target_country id: 1, country_code: 'US'
|
212
|
+
expect(a_request(:post, url).with(
|
213
|
+
body: hash_including({'Method' => 'addTargetCountry','id' => '1','country_code' => 'US'}))
|
214
|
+
).to have_been_made
|
215
|
+
end
|
216
|
+
|
217
|
+
context 'when required params are missing' do
|
218
|
+
it 'fails without id' do
|
219
|
+
expect { subject.add_target_country country_code: 1 }.to raise_error ArgumentError
|
220
|
+
end
|
221
|
+
it 'fails without country_code' do
|
222
|
+
expect { subject.add_target_country id: 10 }.to raise_error ArgumentError
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe '#add_group' do
|
228
|
+
it 'makes a proper request call' do
|
229
|
+
stub_call
|
230
|
+
response = subject.add_group id: 1, group_id: 123
|
231
|
+
expect(a_request(:post, url).with(
|
232
|
+
body: hash_including({'Method' => 'addGroup','id' => '1','group_id' => '123'}))
|
233
|
+
).to have_been_made
|
234
|
+
end
|
235
|
+
|
236
|
+
context 'when required params are missing' do
|
237
|
+
it 'fails without id' do
|
238
|
+
expect { subject.add_group group_id: 1 }.to raise_error ArgumentError
|
239
|
+
end
|
240
|
+
it 'fails without group_id' do
|
241
|
+
expect { subject.add_group id: 10 }.to raise_error ArgumentError
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
172
245
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hasoffersv3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maximilian Seifert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|