mbsy 1.1.0 → 1.1.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: 4f1f8275167e9967a1cad50454e034743065d6c1
4
- data.tar.gz: 1a9f59b52bb3f4c4bd378840077e2b7794726d62
3
+ metadata.gz: 6d92d3523d8653d955fffba060a1206ce210621d
4
+ data.tar.gz: 3928d6606de957c6ed1a8ba059baece8bdf2c366
5
5
  SHA512:
6
- metadata.gz: d2e6c864174d070fc0cc532c8ff76f124aba6bcc6d460c21791ee08842bb81264fd05677b251bf2b5736f2e9f80890b327fc44000290c36f12a68f91eef18f02
7
- data.tar.gz: 26777be50499700a53b554bbc30179e38277fb633a4ecda46146beceeeb557504578ab2d5e285cd0740a2e6291e750baa2b77cd8aada6059fbf360304e8d28e6
6
+ metadata.gz: fe9b2c1b53f83cf6d3c54ddf1e18b29be59b793bd584d1a4f588ac3f6f94d9fce07bf28df5dbd9c27c2d4cc54e1da9aeebba213495f3ecc95d5676a7627ce545
7
+ data.tar.gz: 71b1d62bd652f1da13ab84bdea8b3fa651ba32749b5332af70e35314e0ecd33319c55e56c21c5a2757bc98d5d7fb069622cf0cd38473ab9060e6c8a0c167648d
data/.gitignore CHANGED
@@ -44,7 +44,8 @@ pkg
44
44
  #.\#*
45
45
 
46
46
  # For vim:
47
- #*.swp
47
+ *.swp
48
+ *.swo
48
49
 
49
50
  # For redcar:
50
51
  #.redcar
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mbsy [![Gem Version](https://badge.fury.io/rb/mbsy.svg)](http://badge.fury.io/rb/mbsy)
1
+ # mbsy [![Gem Version](https://badge.fury.io/rb/mbsy.svg)](http://badge.fury.io/rb/mbsy) [![Dependency Status](https://gemnasium.com/GetAmbassador/mbsy.svg)](https://gemnasium.com/GetAmbassador/mbsy)
2
2
 
3
3
  Ambassador API wrapper for Ruby.
4
4
 
@@ -13,5 +13,10 @@ module Mbsy
13
13
  raise ArgumentError, "You must include :email" unless params[:email]
14
14
  call('stats', params)
15
15
  end
16
+
17
+ def self.update(params={})
18
+ raise ArgumentError, "You must include :email or :uid" unless params[:email] || params[:uid]
19
+ call('update', params)
20
+ end
16
21
  end
17
22
  end
@@ -1,8 +1,19 @@
1
1
  module Mbsy
2
2
  class Commission < Base
3
3
  def self.update(params={})
4
- raise ArgumentError, "You must include either :commission_id or :transaction_uid" unless params[:commission_id] or params[:transaction_uid]
4
+ raise ArgumentError, "You must include either :commission_uid or :transaction_uid" unless params[:commission_uid] or params[:transaction_uid]
5
5
  call('update', params)
6
6
  end
7
+
8
+ def self.add(params={})
9
+ raise ArgumentError, "You must include either :email or :uid" unless params[:email] or params[:uid]
10
+ raise ArgumentError, "You must include :campaign_uid" unless params[:campaign_uid]
11
+ raise ArgumentError, "You must include :amount" unless params[:amount]
12
+ call('add', params)
13
+ end
14
+
15
+ def self.all(params={})
16
+ call('all', params)
17
+ end
7
18
  end
8
19
  end
@@ -1,3 +1,3 @@
1
1
  module Mbsy
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -34,4 +34,21 @@ describe Mbsy::Ambassador do
34
34
  expect(Mbsy::Ambassador).to have_received(:call).with('stats', email: 'a@example.com')
35
35
  end
36
36
  end
37
+
38
+ describe '.update' do
39
+ it 'raises ArgumentError when missing email or uid param' do
40
+ expect { Mbsy::Ambassador.update }.to raise_error(ArgumentError, 'You must include :email or :uid')
41
+ expect(Mbsy::Ambassador).to_not have_received(:call)
42
+ end
43
+
44
+ it 'calls #call when passed :email' do
45
+ expect(Mbsy::Ambassador.update(email: 'a@example.com')).to eq response
46
+ expect(Mbsy::Ambassador).to have_received(:call).with('update', email: 'a@example.com')
47
+ end
48
+
49
+ it 'calls #call when passed :uid' do
50
+ expect(Mbsy::Ambassador.update(uid: 999)).to eq response
51
+ expect(Mbsy::Ambassador).to have_received(:call).with('update', uid: 999)
52
+ end
53
+ end
37
54
  end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mbsy::Commission do
4
+ let(:response) { double(:response) }
5
+ before { allow(Mbsy::Commission).to receive(:call).and_return(response) }
6
+
7
+ describe '.update' do
8
+ it 'raises ArgumentError when missing commission_uid or transaction_uid param' do
9
+ expect { Mbsy::Commission.update }.to raise_error(ArgumentError, 'You must include either :commission_uid or :transaction_uid')
10
+ expect(Mbsy::Commission).to_not have_received(:call)
11
+ end
12
+
13
+ it 'calls #call when passed :commission_uid' do
14
+ expect(Mbsy::Commission.update(commission_uid: 999)).to eq response
15
+ expect(Mbsy::Commission).to have_received(:call).with('update', commission_uid: 999)
16
+ end
17
+
18
+ it 'calls #call when passed :transaction_uid' do
19
+ expect(Mbsy::Commission.update(transaction_uid: 999)).to eq response
20
+ expect(Mbsy::Commission).to have_received(:call).with('update', transaction_uid: 999)
21
+ end
22
+ end
23
+
24
+ describe '.all' do
25
+ it 'calls #call' do
26
+ expect(Mbsy::Commission.all).to eq response
27
+ expect(Mbsy::Commission).to have_received(:call).with('all', {})
28
+ end
29
+ end
30
+
31
+ describe '.add' do
32
+ it 'raises ArgumentError when missing email or uid param' do
33
+ expect { Mbsy::Commission.add }.to raise_error(ArgumentError, 'You must include either :email or :uid')
34
+ expect(Mbsy::Commission).to_not have_received(:call)
35
+ end
36
+
37
+ it 'raises ArgumentError when missing campaign_uid param' do
38
+ expect { Mbsy::Commission.add(email: 'a@example.com') }.to raise_error(ArgumentError, 'You must include :campaign_uid')
39
+ expect(Mbsy::Commission).to_not have_received(:call)
40
+ end
41
+
42
+ it 'raises ArgumentError when missing amount param' do
43
+ expect { Mbsy::Commission.add(email: 'a@example.com', campaign_uid: 999) }.to raise_error(ArgumentError, 'You must include :amount')
44
+ expect(Mbsy::Commission).to_not have_received(:call)
45
+ end
46
+
47
+ it 'calls #call' do
48
+ expect(Mbsy::Commission.add(email: 'a@example.com', campaign_uid: 999, amount: 50)).to eq response
49
+ expect(Mbsy::Commission).to have_received(:call).with('add', email: 'a@example.com', campaign_uid: 999, amount: 50)
50
+ end
51
+ end
52
+ end
53
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Mullen, Chase Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-14 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -153,6 +153,7 @@ files:
153
153
  - spec/resources/ambassador_spec.rb
154
154
  - spec/resources/balance_spec.rb
155
155
  - spec/resources/base_spec.rb
156
+ - spec/resources/commission_spec.rb
156
157
  - spec/spec_helper.rb
157
158
  homepage: http://github.com/GetAmbassador/mbsy
158
159
  licenses:
@@ -183,4 +184,5 @@ test_files:
183
184
  - spec/resources/ambassador_spec.rb
184
185
  - spec/resources/balance_spec.rb
185
186
  - spec/resources/base_spec.rb
187
+ - spec/resources/commission_spec.rb
186
188
  - spec/spec_helper.rb