hasoffersv3 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7453bceffc7ee46496b55fcf566830b784aeafc8
4
- data.tar.gz: 4afeea63e581e37b8bbb50a1a604cc23a26ca1ad
3
+ metadata.gz: 6af628ce4e57076de7db4b320d0014e7add4e822
4
+ data.tar.gz: 0eb139d1daf9e20975167f4bd39465056ae189c4
5
5
  SHA512:
6
- metadata.gz: dab7532456120fbcebb9883b4483f87b881f66ce58cfeff716c16a2af6512efac9eb0e23fda14d29c0c9bcd0529118ade4b74c800da97dce17b61a7c604f14a2
7
- data.tar.gz: 153a7882dae6d973705dfb6510be90b74fbe66adbd900633f7f1845befb7d88ff42e05103588716ce7f38f62eb545114204b2bb38117396adeb732c53fc2af61
6
+ metadata.gz: 20e97013eff51bfc4801331a404124417a993db2e72c5beabb43000ff833fa0655b820b0a5d242fdf90a79f8fe69686c9a08ce4f5eafd06300b965aa23a7826e
7
+ data.tar.gz: a0da382c5b472e8f1de5753ab205b4e7454fa0de447020272d38e9ad2cc7cf5083d2852358f20b9d562e9ec95fd21606f10aa0c90be0423e778496d397e692a0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.2
2
+ - Support "Offer/findAllIdsByAffiliateId" method
3
+ - Support "Affiliate_Offer/findMyOffers" method
4
+
1
5
  # 0.2.1
2
6
  - Support "Affiliate_Offer/generateTrackingLink" method
3
7
 
@@ -1,33 +1,39 @@
1
1
  class HasOffersV3
2
2
  class AffiliateOffer < Base
3
+ class << self
3
4
 
4
- def self.target
5
- 'Affiliate_Offer'
6
- end
5
+ def target
6
+ 'Affiliate_Offer'
7
+ end
7
8
 
8
- def self.find_all(params = {})
9
- post_request 'findAll', params
10
- end
9
+ def find_all(params = {})
10
+ post_request 'findAll', params
11
+ end
11
12
 
12
- def self.find_by_id(params = {})
13
- requires! params, [:id]
14
- post_request 'findById', params
15
- end
13
+ def find_by_id(params = {})
14
+ requires! params, [:id]
15
+ post_request 'findById', params
16
+ end
16
17
 
17
- def self.get_categories(params = {})
18
- requires! params, [:ids]
19
- post_request 'getCategories', params
20
- end
18
+ def get_categories(params = {})
19
+ requires! params, [:ids]
20
+ post_request 'getCategories', params
21
+ end
21
22
 
22
- def self.get_target_countries(params = {})
23
- requires! params, [:ids]
24
- post_request 'getTargetCountries', params
25
- end
23
+ def get_target_countries(params = {})
24
+ requires! params, [:ids]
25
+ post_request 'getTargetCountries', params
26
+ end
26
27
 
27
- def self.generate_tracking_link(params = {})
28
- requires! params, [:offer_id]
29
- post_request 'generateTrackingLink', params
30
- end
28
+ def generate_tracking_link(params = {})
29
+ requires! params, [:offer_id]
30
+ post_request 'generateTrackingLink', params
31
+ end
31
32
 
33
+ def find_my_offers(params = {})
34
+ post_request 'findMyOffers', params
35
+ end
36
+
37
+ end
32
38
  end
33
39
  end
@@ -15,6 +15,11 @@ class HasOffersV3
15
15
  post_request 'findAllIdsByAdvertiserId', params
16
16
  end
17
17
 
18
+ def find_all_ids_by_affiliate_id(params = {})
19
+ requires! params, [:affiliate_id]
20
+ post_request 'findAllIdsByAffiliateId', params
21
+ end
22
+
18
23
  def find_by_id(params = {})
19
24
  requires! params, [:id]
20
25
  post_request 'findById', params
@@ -34,6 +39,11 @@ class HasOffersV3
34
39
  requires! params, [:id, :affiliate_id]
35
40
  post_request 'setPayout', params
36
41
  end
42
+
43
+ def remove_payout(params = {})
44
+ requires! params, [:id, :affiliate_id]
45
+ post_request 'removePayout', params
46
+ end
37
47
  end
38
48
  end
39
49
  end
@@ -1,3 +1,3 @@
1
1
  class HasOffersV3
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -9,7 +9,7 @@ describe HasOffersV3::Advertiser do
9
9
  it 'should make a proper request call' do
10
10
  stub_call
11
11
  response = subject.find_all
12
- a_request(:post, url).with(body: hash_including({'Method' => 'findAll'})).should have_been_made
12
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAll'}))).to have_been_made
13
13
  validate_call response
14
14
  end
15
15
  end
@@ -18,7 +18,7 @@ describe HasOffersV3::Advertiser do
18
18
  it 'should make a proper request call' do
19
19
  stub_call
20
20
  response = subject.find_all_ids
21
- a_request(:post, url).with(body: hash_including({'Method' => 'findAllIds'})).should have_been_made
21
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAllIds'}))).to have_been_made
22
22
  validate_call response
23
23
  end
24
24
  end
@@ -27,7 +27,7 @@ describe HasOffersV3::Advertiser do
27
27
  it 'should make a proper request call' do
28
28
  stub_call
29
29
  response = subject.find_by_id id: 1
30
- a_request(:post, url).with(body: hash_including({'Method' => 'findById', 'id' => '1'})).should have_been_made
30
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findById', 'id' => '1'}))).to have_been_made
31
31
  validate_call response
32
32
  end
33
33
 
@@ -9,7 +9,7 @@ describe HasOffersV3::AdvertiserUser do
9
9
  it 'should make a proper request call' do
10
10
  stub_call
11
11
  response = subject.find_all
12
- a_request(:post, url).with(body: hash_including({'Method' => 'findAll'})).should have_been_made
12
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAll'}))).to have_been_made
13
13
  validate_call response
14
14
  end
15
15
  end
@@ -91,4 +91,15 @@ describe HasOffersV3::AffiliateOffer do
91
91
  end
92
92
  end
93
93
 
94
+ describe '.find_my_offers' do
95
+ it 'should make a proper request call' do
96
+ stub_call
97
+ response = subject.find_my_offers
98
+ request = a_request(:post, url).with(body: hash_including('Method' => 'findMyOffers'))
99
+ expect(request).to have_been_made
100
+
101
+ validate_call response
102
+ end
103
+ end
104
+
94
105
  end
@@ -12,7 +12,7 @@ describe HasOffersV3::Affiliate do
12
12
  describe '.find_all' do
13
13
  it 'should make a proper request call' do
14
14
  response = subject.find_all
15
- a_request(:post, url).with(body: hash_including({'Method' => 'findAll'})).should have_been_made
15
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAll'}))).to have_been_made
16
16
  validate_call response
17
17
  end
18
18
  end
@@ -21,7 +21,7 @@ describe HasOffersV3::Affiliate do
21
21
  it 'should make a proper request call' do
22
22
  stub_call :get, nil, Regexp.new(url)
23
23
  response = subject.find_by_id id: 1
24
- a_request(:get, url).with(query: hash_including({'Method' => 'findById', 'id' => '1'})).should have_been_made
24
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'findById', 'id' => '1'}))).to have_been_made
25
25
  validate_call response
26
26
  end
27
27
 
@@ -35,7 +35,7 @@ describe HasOffersV3::Affiliate do
35
35
  describe '.update_payment_method_wire' do
36
36
  it 'should make a proper request call' do
37
37
  response = subject.update_payment_method_wire
38
- a_request(:post, url).with(body: hash_including({'Method' => 'updatePaymentMethodWire'})).should have_been_made
38
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'updatePaymentMethodWire'}))).to have_been_made
39
39
  validate_call response
40
40
  end
41
41
  end
@@ -43,7 +43,7 @@ describe HasOffersV3::Affiliate do
43
43
  describe '.update_payment_method_paypal' do
44
44
  it 'should make a proper request call' do
45
45
  response = subject.update_payment_method_paypal
46
- a_request(:post, url).with(body: hash_including({'Method' => 'updatePaymentMethodPaypal'})).should have_been_made
46
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'updatePaymentMethodPaypal'}))).to have_been_made
47
47
  validate_call response
48
48
  end
49
49
  end
@@ -34,9 +34,7 @@ describe HasOffersV3::Base do
34
34
  it "should make a proper request" do
35
35
  stub_call :get
36
36
  response = subject.get_request 'test'
37
- a_request(:get, url).
38
- with(query: hash_including('Method' => 'test')).
39
- should have_been_made
37
+ expect(a_request(:get, url).with(query: hash_including('Method' => 'test'))).to have_been_made
40
38
  validate_call response
41
39
  end
42
40
  end
@@ -12,7 +12,7 @@ describe HasOffersV3::Conversion do
12
12
  describe '.find_all' do
13
13
  it 'should make a proper request call' do
14
14
  response = subject.find_all
15
- a_request(:get, url).with(query: hash_including({'Method' => 'findAll'})).should have_been_made
15
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'findAll'}))).to have_been_made
16
16
  validate_call response
17
17
  end
18
18
  end
@@ -20,7 +20,7 @@ describe HasOffersV3::Conversion do
20
20
  describe '.find_added_conversions' do
21
21
  it 'should make a proper request call' do
22
22
  response = subject.find_added_conversions
23
- a_request(:get, url).with(query: hash_including({'Method' => 'findAddedConversions'})).should have_been_made
23
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'findAddedConversions'}))).to have_been_made
24
24
  validate_call response
25
25
  end
26
26
  end
@@ -28,7 +28,7 @@ describe HasOffersV3::Conversion do
28
28
  describe '.find_updated_conversions' do
29
29
  it 'should make a proper request call' do
30
30
  response = subject.find_updated_conversions
31
- a_request(:get, url).with(query: hash_including({'Method' => 'findUpdatedConversions'})).should have_been_made
31
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'findUpdatedConversions'}))).to have_been_made
32
32
  validate_call response
33
33
  end
34
34
  end
@@ -36,7 +36,7 @@ describe HasOffersV3::Conversion do
36
36
  describe '.findAll' do
37
37
  it 'should make a proper request call' do
38
38
  response = subject.findAll
39
- a_request(:get, url).with(query: hash_including({'Method' => 'findAll'})).should have_been_made
39
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'findAll'}))).to have_been_made
40
40
  validate_call response
41
41
  end
42
42
 
@@ -9,7 +9,7 @@ describe HasOffersV3::Offer do
9
9
  it 'should make a proper request call' do
10
10
  stub_call
11
11
  response = HasOffersV3::Offer.find_all
12
- a_request(:post, url).with(body: hash_including({'Method' => 'findAll'})).should have_been_made
12
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAll'}))).to have_been_made
13
13
  validate_call response
14
14
  end
15
15
  end
@@ -18,7 +18,7 @@ describe HasOffersV3::Offer do
18
18
  it 'should make a proper request call' do
19
19
  stub_call
20
20
  response = HasOffersV3::Offer.find_all_by_ids ids: [1]
21
- a_request(:post, url).with(body: hash_including({'Method' => 'findAllByIds'})).should have_been_made
21
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAllByIds'}))).to have_been_made
22
22
  validate_call response
23
23
  end
24
24
 
@@ -33,7 +33,7 @@ describe HasOffersV3::Offer do
33
33
  it 'should make a proper request call' do
34
34
  stub_call
35
35
  response = HasOffersV3::Offer.find_all_ids_by_advertiser_id advertiser_id: 1
36
- a_request(:post, url).with(body: hash_including({'Method' => 'findAllIdsByAdvertiserId', 'advertiser_id' => '1'})).should have_been_made
36
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAllIdsByAdvertiserId', 'advertiser_id' => '1'}))).to have_been_made
37
37
  validate_call response
38
38
  end
39
39
 
@@ -44,11 +44,19 @@ describe HasOffersV3::Offer do
44
44
  end
45
45
  end
46
46
 
47
+ describe '.find_all_ids_by_affiliate_id' do
48
+ it 'should make a proper request call' do
49
+ stub_call
50
+ response = HasOffersV3::Offer.find_all_ids_by_affiliate_id affiliate_id: 1
51
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findAllIdsByAffiliateId', 'affiliate_id' => '1'}))).to have_been_made
52
+ end
53
+ end
54
+
47
55
  describe '.find_by_id' do
48
56
  it 'should make a proper request call' do
49
57
  stub_call
50
58
  response = HasOffersV3::Offer.find_by_id id: 1
51
- a_request(:post, url).with(body: hash_including({'Method' => 'findById', 'id' => '1'})).should have_been_made
59
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'findById', 'id' => '1'}))).to have_been_made
52
60
  validate_call response
53
61
  end
54
62
 
@@ -63,7 +71,7 @@ describe HasOffersV3::Offer do
63
71
  it 'should make a proper request call' do
64
72
  stub_call
65
73
  response = HasOffersV3::Offer.get_groups id: 1
66
- a_request(:post, url).with(body: hash_including({'Method' => 'getGroups'})).should have_been_made
74
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'getGroups'}))).to have_been_made
67
75
  validate_call response
68
76
  end
69
77
 
@@ -78,7 +86,7 @@ describe HasOffersV3::Offer do
78
86
  it 'makes a proper API request' do
79
87
  stub_call
80
88
  response = HasOffersV3::Offer.get_approved_affiliate_ids id: 1
81
- a_request(:post, url).with(body: hash_including({'Method' => 'getApprovedAffiliateIds'})).should have_been_made
89
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'getApprovedAffiliateIds'}))).to have_been_made
82
90
  validate_call response
83
91
  end
84
92
 
@@ -93,7 +101,7 @@ describe HasOffersV3::Offer do
93
101
  it 'should make a proper request call' do
94
102
  stub_call
95
103
  response = HasOffersV3::Offer.set_payout id: 1, affiliate_id: 321
96
- a_request(:post, url).with(body: hash_including({'Method' => 'setPayout'})).should have_been_made
104
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'setPayout'}))).to have_been_made
97
105
  validate_call response
98
106
  end
99
107
 
@@ -103,4 +111,19 @@ describe HasOffersV3::Offer do
103
111
  end
104
112
  end
105
113
  end
114
+
115
+ describe '.remove_payout' do
116
+ it 'should make a proper request call' do
117
+ stub_call
118
+ response = HasOffersV3::Offer.remove_payout id: 1, affiliate_id: 321
119
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'removePayout'}))).to have_been_made
120
+ validate_call response
121
+ end
122
+
123
+ context 'when the id and/or affiliate id parameters are missing' do
124
+ it 'raises an exception' do
125
+ expect { HasOffersV3::Offer.remove_payout }.to raise_error ArgumentError
126
+ end
127
+ end
128
+ end
106
129
  end
@@ -12,7 +12,7 @@ describe HasOffersV3::RawLog do
12
12
  describe '.get_download_link' do
13
13
  it 'should make a proper request call' do
14
14
  response = subject.get_download_link log_type: 'clicks', log_filename: 'xxx'
15
- a_request(:get, url).with(query: hash_including({'Method' => 'getDownloadLink'})).should have_been_made
15
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'getDownloadLink'}))).to have_been_made
16
16
  validate_call response
17
17
  end
18
18
 
@@ -32,7 +32,7 @@ describe HasOffersV3::RawLog do
32
32
  describe '.get_log_expirations' do
33
33
  it 'should make a proper request call' do
34
34
  response = subject.get_log_expirations
35
- a_request(:get, url).with(query: hash_including({'Method' => 'getLogExpirations'})).should have_been_made
35
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'getLogExpirations'}))).to have_been_made
36
36
  validate_call response
37
37
  end
38
38
  end
@@ -40,7 +40,7 @@ describe HasOffersV3::RawLog do
40
40
  describe '.list_date_dirs' do
41
41
  it 'should make a proper request call' do
42
42
  response = subject.list_date_dirs log_type: 'clicks'
43
- a_request(:get, url).with(query: hash_including({'Method' => 'listDateDirs'})).should have_been_made
43
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'listDateDirs'}))).to have_been_made
44
44
  validate_call response
45
45
  end
46
46
 
@@ -54,7 +54,7 @@ describe HasOffersV3::RawLog do
54
54
  describe '.list_logs' do
55
55
  it 'should make a proper request call' do
56
56
  response = subject.list_logs log_type: 'clicks', date_dir: '20140101'
57
- a_request(:get, url).with(query: hash_including({'Method' => 'listLogs'})).should have_been_made
57
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'listLogs'}))).to have_been_made
58
58
  validate_call response
59
59
  end
60
60
 
@@ -70,4 +70,4 @@ describe HasOffersV3::RawLog do
70
70
  end
71
71
  end
72
72
  end
73
- end
73
+ end
@@ -9,7 +9,7 @@ describe HasOffersV3::Report do
9
9
 
10
10
  it 'should make a proper request call' do
11
11
  response = subject.get_conversions
12
- a_request(:post, url).with(body: hash_including({'Method' => 'getConversions'})).should have_been_made
12
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'getConversions'}))).to have_been_made
13
13
  validate_call response
14
14
  end
15
15
  end
@@ -19,7 +19,7 @@ describe HasOffersV3::Report do
19
19
 
20
20
  it 'should make a proper request call' do
21
21
  response = subject.getConversions
22
- a_request(:post, url).with(body: hash_including({'Method' => 'getConversions'})).should have_been_made
22
+ expect(a_request(:post, url).with(body: hash_including({'Method' => 'getConversions'}))).to have_been_made
23
23
  validate_call response
24
24
  end
25
25
 
@@ -41,7 +41,7 @@ describe HasOffersV3::Report do
41
41
 
42
42
  it 'should make a proper request call' do
43
43
  response = subject.get_mod_summary_logs
44
- a_request(:get, url).with(query: hash_including({'Method' => 'getModSummaryLogs'})).should have_been_made
44
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'getModSummaryLogs'}))).to have_been_made
45
45
  validate_call response
46
46
  end
47
47
  end
@@ -53,7 +53,7 @@ describe HasOffersV3::Report do
53
53
 
54
54
  it 'should make a proper request call' do
55
55
  response = subject.getModSummaryLogs
56
- a_request(:get, url).with(query: hash_including({'Method' => 'getModSummaryLogs'})).should have_been_made
56
+ expect(a_request(:get, url).with(query: hash_including({'Method' => 'getModSummaryLogs'}))).to have_been_made
57
57
  validate_call response
58
58
  end
59
59
 
data/spec/spec_helper.rb CHANGED
@@ -10,7 +10,6 @@ require 'webmock/rspec'
10
10
  #
11
11
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
12
12
  RSpec.configure do |config|
13
- config.treat_symbols_as_metadata_keys_with_true_values = true
14
13
  config.run_all_when_everything_filtered = true
15
14
  config.filter_run :focus
16
15
 
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.2.1
4
+ version: 0.2.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: 2014-09-09 00:00:00.000000000 Z
12
+ date: 2014-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oj
@@ -181,3 +181,4 @@ test_files:
181
181
  - spec/lib/raw_log_spec.rb
182
182
  - spec/lib/report_spec.rb
183
183
  - spec/spec_helper.rb
184
+ has_rdoc: