balanced 0.3.8 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,13 +62,20 @@ module Balanced
62
62
  true
63
63
  end
64
64
 
65
- def method_missing(method, *args, &block)
66
- case method
67
- when :get, :post, :put, :delete
68
- self.client.send method, *args
69
- else
70
- super
71
- end
65
+ def get(*args, &block)
66
+ self.client.get *args
67
+ end
68
+
69
+ def post(*args, &block)
70
+ self.client.post *args
71
+ end
72
+
73
+ def put(*args, &block)
74
+ self.client.put *args
75
+ end
76
+
77
+ def delete(*args, &block)
78
+ self.client.delete *args
72
79
  end
73
80
  end
74
81
 
@@ -26,17 +26,24 @@ module Balanced
26
26
  def create_buyer *args
27
27
  options = args.last.is_a?(Hash) ? args.pop : {}
28
28
  email_address = args[0] || options.fetch(:email_address) { nil }
29
- card_uri = args[1] || options.fetch(:card_uri) { nil }
29
+ card = args[1] || options.fetch(:card_uri) { options.fetch(:card) { nil} }
30
30
  name = args[2] || options.fetch(:name) { nil }
31
31
  meta = args[3] || options.fetch(:meta) { nil }
32
32
 
33
- account = Account.new(
34
- :uri => self.accounts_uri,
35
- :email_address => email_address,
36
- :card_uri => card_uri,
37
- :name => name,
38
- :meta => meta,
39
- )
33
+ account_attributes = {
34
+ :uri => self.accounts_uri,
35
+ :email_address => email_address,
36
+ :name => name,
37
+ :meta => meta,
38
+ }
39
+
40
+ if card.respond_to? :keys
41
+ account_attributes[:card] = card
42
+ else
43
+ account_attributes[:card_uri] = card
44
+ end
45
+
46
+ account = Account.new account_attributes
40
47
  account.save
41
48
  end
42
49
 
@@ -1,3 +1,3 @@
1
1
  module Balanced
2
- VERSION = '0.3.8'
2
+ VERSION = '0.3.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: balanced
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 1.8.23
128
+ rubygems_version: 1.8.24
129
129
  signing_key:
130
130
  specification_version: 3
131
131
  summary: Sign up on https://balancedpayments.com/
@@ -140,4 +140,3 @@ test_files:
140
140
  - spec/client_spec.rb
141
141
  - spec/spec_helper.rb
142
142
  - spec/utils_spec.rb
143
- has_rdoc: