tangocard 4.1.0 → 5.0.0

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: 8b8c6e8dd748f73ba39b6300e69450556158be90
4
- data.tar.gz: eea2b48a8cd364c9f79871e93011467d34df83d2
3
+ metadata.gz: 49c965036413c7a215002d6607a6d620196f1ed7
4
+ data.tar.gz: 98763bca37c622a6fa2c8d8f3a55ec0e898c9ab3
5
5
  SHA512:
6
- metadata.gz: f1c2a0c08a8962c0cd89153bf5e20a4e19a95653a9632884acb18941e02e5f437653f2a3f5c1b3454ae4d265dead80605c77ab09ceffc08dc822fdebf3d2fc78
7
- data.tar.gz: 6b680dbf60193d42cfafdd4ae5e0719b6b64700594bbfcc081666712ddce9888b8aed439f3d22797112e9060a58b1967050532e596d8e40d3108a099648f44ed
6
+ metadata.gz: f3faadaa33b916d60448dd6e322a20afeb6dc76cf69dc1e39e1e2a58734803aa4b7c37bb9672257cfe829e0e126d38c391f406af8a47bf0600bd49ba257fcabb
7
+ data.tar.gz: 0d684e0d75017033b467a5b07d9385e68829c2d007b68e0240d2109f644daf966059d18b6c2c234d6b3d0e39c7bf812a5379ac468c4ac051d3736eced76543a1
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Ruby Wrapper for Tango Card RaaS API.
5
5
 
6
- Tango Card provides a RaaS API for developers (https://github.com/tangocarddev/RaaS). This gem provides commonsense Ruby
6
+ Tango Card provides a RaaS API for developers (https://www.tangocard.com/docs/raas-api/). This gem provides commonsense Ruby
7
7
  objects to wrap the JSON endpoints of the RaaS API.
8
8
 
9
9
  ## Information
@@ -50,7 +50,7 @@ There are also three optional configuration parameters:
50
50
  This gem provides two tools:
51
51
 
52
52
  1. A simple wrapper for the Tango Card RaaS API, consisting of two classes: `Tangocard::Raas` and `Tangocard::Response`.
53
- 2. Models for each of the Tango Card objects: `Tangocard::Account`, `Tangocard::Brand`, `Tangocard::Reward`, and `Tangocard::Order`. These provide a greater level of abstraction and ease of use.
53
+ 2. Models for each of the Tango Card objects: `Tangocard::Account`, `Tangocard::Brand`, `Tangocard::Reward`, `Tangocard::Order` and `Tangocard::ExchangeRate`. These provide a greater level of abstraction and ease of use.
54
54
 
55
55
  ## Notes and Credits
56
56
 
@@ -38,3 +38,4 @@ require 'tangocard/order'
38
38
  require 'tangocard/order_create_failed_exception'
39
39
  require 'tangocard/order_not_found_exception'
40
40
  require 'tangocard/reward'
41
+ require 'tangocard/exchange_rate'
@@ -80,13 +80,13 @@ class Tangocard::Account
80
80
  # Arguments:
81
81
  # client_ip: (String)
82
82
  # credit_card: (Hash) - see
83
- # https://github.com/tangocarddev/RaaS/blob/master/cc_register.schema.json for details
83
+ # https://www.tangocard.com/docs/raas-api/#create-cc-registration for details
84
84
  #
85
85
  # Credit Card Hash Example:
86
86
  #
87
87
  # {
88
88
  # 'number' => '4111111111111111',
89
- # 'expiration' => '01/17',
89
+ # 'expiration' => '2017-01',
90
90
  # 'security_code' => '123',
91
91
  # 'billing_address' => {
92
92
  # 'f_name' => 'Jane',
@@ -112,7 +112,7 @@ class Tangocard::Account
112
112
  @cc_token = response.parsed_response['cc_token']
113
113
  response.parsed_response
114
114
  else
115
- raise Tangocard::AccountRegisterCreditCardFailedException, "#{response.denial_message}"
115
+ raise Tangocard::AccountRegisterCreditCardFailedException, "#{response.error_message} #{response.denial_message} #{response.invalid_inputs}"
116
116
  end
117
117
  end
118
118
 
@@ -158,48 +158,6 @@ class Tangocard::Account
158
158
  end
159
159
  end
160
160
 
161
- # (DEPRECATED)
162
- # Add funds to the account.
163
- #
164
- # Example:
165
- # >> account.fund!(10000, '128.128.128.128', Hash (see example below))
166
- # => #<Tangocard::Account:0x007f9a6fec0138 @customer="bonusly", @email="dev@bonus.ly", @identifier="test", @available_balance=0>
167
- #
168
- # Arguments:
169
- # amount: (Integer)
170
- # client_ip: (String)
171
- # credit_card: (Hash) - see https://github.com/tangocarddev/RaaS/blob/master/fund_create.schema.json for details
172
- #
173
- # Credit Card Hash Example:
174
- #
175
- # {
176
- # 'number' => '4111111111111111',
177
- # 'expiration' => '01/17',
178
- # 'security_code' => '123',
179
- # 'billing_address' => {
180
- # 'f_name' => 'Jane',
181
- # 'l_name' => 'User',
182
- # 'address' => '123 Main Street',
183
- # 'city' => 'Anytown',
184
- # 'state' => 'NY',
185
- # 'zip' => '11222',
186
- # 'country' => 'USA',
187
- # 'email' => 'jane@company.com'
188
- # }
189
- # }
190
- def fund!(amount, client_ip, credit_card)
191
- warn "[DEPRECATION] `fund!` is deprecated. Please use `cc_fund` instead. See https://github.com/tangocarddev/RaaS#fund-a-platforms-account"
192
-
193
- params = {
194
- 'amount' => amount,
195
- 'client_ip' => client_ip,
196
- 'credit_card' => credit_card,
197
- 'customer' => customer,
198
- 'account_identifier' => identifier
199
- }
200
- Tangocard::Raas.fund_account(params)
201
- end
202
-
203
161
  # Delete a credit card from an account
204
162
  # Raises Tangocard::AccountDeleteCreditCardFailedException failure.
205
163
  # Example:
@@ -1,3 +1,3 @@
1
- class Tangocard::AccountCreateFailedException < Exception
1
+ class Tangocard::AccountCreateFailedException < StandardError
2
2
 
3
- end
3
+ end
@@ -1,3 +1,3 @@
1
- class Tangocard::AccountDeleteCreditCardFailedException < Exception
1
+ class Tangocard::AccountDeleteCreditCardFailedException < StandardError
2
2
 
3
3
  end
@@ -1,3 +1,3 @@
1
- class Tangocard::AccountFundFailedException < Exception
1
+ class Tangocard::AccountFundFailedException < StandardError
2
2
 
3
3
  end
@@ -1,3 +1,3 @@
1
- class Tangocard::AccountNotFoundException < Exception
1
+ class Tangocard::AccountNotFoundException < StandardError
2
2
 
3
- end
3
+ end
@@ -1,3 +1,3 @@
1
- class Tangocard::AccountRegisterCreditCardFailedException < Exception
1
+ class Tangocard::AccountRegisterCreditCardFailedException < StandardError
2
2
 
3
3
  end
@@ -29,11 +29,12 @@ class Tangocard::Brand
29
29
  #
30
30
  # Example:
31
31
  # >> Tangocard::Brand.find("Amazon.com")
32
- # => #<Tangocard::Brand:0x007f9a6fb076e0 @description="Amazon.com",
33
- # @image_url="http://static-integration.tangocard.com/graphics/item-images/amazon-gift-card.png",
34
- # @rewards=[#<Tangocard::Reward:0x007f9a6fb07618 @description="Amazon.com Gift Card (Custom)",
35
- # @sku="AMZN-E-V-STD", @currency_type="USD", @unit_price=-1, @available=true, @min_price=100,
36
- # @max_price=100000>]>
32
+ # => #<Tangocard::Brand:0x007f96a9cbe980 @description="Amazon.com",
33
+ # @image_url="https://dwwvg90koz96l.cloudfront.net/graphics/item-images/amazon-gift-card.png",
34
+ # @rewards=[#<Tangocard::Reward:0x007f96a9cbe930 @type="reward",
35
+ # @description="Amazon.com Gift Card (Custom)", @sku="AMZN-E-V-STD", @is_variable=true,
36
+ # @denomination=0, @min_price=1, @max_price=100000, @currency_code="USD", @available=true,
37
+ # @countries=["US"]>]>
37
38
  #
38
39
  # Arguments:
39
40
  # brand_name: (String)
@@ -64,8 +65,12 @@ class Tangocard::Brand
64
65
  #
65
66
  # Example:
66
67
  # >> itunes_brand.purchasable_rewards(1000)
67
- # => [#<Tangocard::Reward:0x007f9a6fd29810 @description="iTunes Gift Card $10", @sku="APPL-E-1000-STD",
68
- # @currency_type="USD", @unit_price=1000, @available=true, @min_price=0, @max_price=0>]
68
+ # => [#<Tangocard::Reward:0x007f96aa3b4dc0 @type="reward", @description="iTunes Code USD $5",
69
+ # @sku="APPL-E-500-STD", @is_variable=false, @denomination=500, @min_price=0, @max_price=0,
70
+ # @currency_code="USD", @available=true, @countries=["US"]>,
71
+ # #<Tangocard::Reward:0x007f96aa3b4d98 @type="reward", @description="iTunes Code USD $10",
72
+ # @sku="APPL-E-1000-STD", @is_variable=false, @denomination=1000, @min_price=0, @max_price=0,
73
+ # @currency_code="USD", @available=true, @countries=["US"]>]
69
74
  #
70
75
  # Arguments:
71
76
  # balance_in_cents: (Integer)
@@ -98,4 +103,4 @@ class Tangocard::Brand
98
103
  def variable_price?
99
104
  rewards.select{|r| r.variable_price? }.any?
100
105
  end
101
- end
106
+ end
@@ -0,0 +1,86 @@
1
+ class Tangocard::ExchangeRate
2
+ attr_reader :currency_code, :rate
3
+
4
+ # Clear all cached responses. Next request for exchange rate info will pull fresh from the Tango Card API.
5
+ #
6
+ # Example:
7
+ # >> Tangocard::ExchangeRate.clear_cache!
8
+ # => true
9
+ #
10
+ # Arguments:
11
+ # none
12
+ def self.clear_cache!
13
+ Tangocard::Raas.clear_cache!
14
+ end
15
+
16
+ # Return current currency exchange rate timestamp.
17
+ #
18
+ # Example:
19
+ # >> Tangocard::ExchangeRate.timestamp
20
+ # => 1456956187
21
+ #
22
+ # Arguments:
23
+ # none
24
+ def self.timestamp
25
+ Tangocard::Raas.rewards_index.parsed_response['xrates']['timestamp']
26
+ end
27
+
28
+ # Return an array of all currency exchange rates.
29
+ #
30
+ # Example:
31
+ # >> Tangocard::ExchangeRate.all
32
+ # => [#<Tangocard::ExchangeRate:0x007ff31ab927a0 @currency_code="USD", @rate="1.00000">,
33
+ # #<Tangocard::ExchangeRate:0x007ff31ab92750 @currency_code="JPY", @rate="123.44700">, ...]
34
+ #
35
+ # Arguments:
36
+ # none
37
+ def self.all
38
+ Tangocard::Raas.rewards_index.parsed_response['xrates']['rates'].map do |currency_code, rate|
39
+ Tangocard::ExchangeRate.new(currency_code, rate)
40
+ end
41
+ end
42
+
43
+ # Find a exchange rate by its currency code.
44
+ #
45
+ # Example:
46
+ # >> Tangocard::ExchangeRate.find("EUR")
47
+ # => #<Tangocard::ExchangeRate:0x007ff31a2dd808 @currency_code="EUR", @rate="0.88870">
48
+ #
49
+ # Arguments:
50
+ # currency_code: (String)
51
+ def self.find(currency_code)
52
+ self.all.select{|r| r.currency_code == currency_code}.first
53
+ end
54
+
55
+ # Set all available exchange rates for Money gem. Once set allows to get reward USD representation
56
+ # of other currencies. For more information and use cases refer to Money gem docs.
57
+ #
58
+ # Example:
59
+ # >> Tangocard::ExchangeRate.populate_money_rates
60
+ # => true
61
+ # >> reward.to_money(:denomination)
62
+ # => #<Money fractional:500 currency:EUR>
63
+ # >> reward.to_money(:denomination).exchange_to('USD')
64
+ # => #<Money fractional:563 currency:USD>
65
+ #
66
+ # Arguments:
67
+ # none
68
+ def self.populate_money_rates
69
+ self.all.each {|r| Money.add_rate(r.currency_code, 'USD', r.inverse_rate)}
70
+ true
71
+ end
72
+
73
+ def initialize(currency_code, rate)
74
+ @currency_code = currency_code
75
+ @rate = rate.to_f
76
+ end
77
+
78
+ # Return an inverse rate of original (float). Used to pupulate Money gem rates.
79
+ #
80
+ # Arguments:
81
+ # none
82
+ def inverse_rate
83
+ 1.0 / rate
84
+ end
85
+
86
+ end
@@ -3,11 +3,14 @@ class Tangocard::Order
3
3
  :account_identifier,
4
4
  :customer,
5
5
  :sku,
6
- :amount,
6
+ :denomination,
7
+ :amount_charged,
7
8
  :reward_message,
9
+ :reward_subject,
8
10
  :reward_from,
9
11
  :delivered_at,
10
12
  :recipient,
13
+ :external_id,
11
14
  :reward,
12
15
  :raw_response
13
16
 
@@ -20,7 +23,7 @@ class Tangocard::Order
20
23
  # => [#<Tangocard::Order:0x007f9a6c4bca68 ...>, #<Tangocard::Order:0x007f9a6c4bca68 ...>, ...]
21
24
  #
22
25
  # Arguments:
23
- # params: (Hash - optional, see https://github.com/tangocarddev/RaaS#retrieve-a-list-of-historical-orders for details)
26
+ # params: (Hash - optional, see https://www.tangocard.com/docs/raas-api/#list-orders for details)
24
27
  def self.all(params = {})
25
28
  response = Tangocard::Raas.orders_index(params)
26
29
  if response.success?
@@ -54,29 +57,31 @@ class Tangocard::Order
54
57
  # => #<Tangocard::Order:0x007f9a6c4bca68 ...>
55
58
  #
56
59
  # Arguments:
57
- # params: (Hash - see https://github.com/tangocarddev/RaaS#place-an-order for details)
60
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#create-order for details)
58
61
  def self.create(params)
59
62
  response = Tangocard::Raas.create_order(params)
60
63
  if response.success?
61
64
  new(response.parsed_response['order'], response)
62
65
  else
63
- raise Tangocard::OrderCreateFailedException, "#{response.error_message}"
66
+ raise Tangocard::OrderCreateFailedException, "#{response.error_message} #{response.invalid_inputs}"
64
67
  end
65
68
  end
66
69
 
67
70
  def initialize(params, raw_response = nil)
68
- @order_id = params['order_id']
71
+ @order_id = params['order_id']
69
72
  @account_identifier = params['account_identifier']
70
- @customer = params['customer']
71
- @sku = params['sku']
72
- @amount = params['amount']
73
- @reward_message = params['reward_message']
74
- @reward_subject = params['reward_subject']
75
- @reward_from = params['reward_from']
76
- @delivered_at = params['delivered_at']
77
- @recipient = params['recipient']
78
- @reward = params['reward'] || {}
79
- @raw_response = raw_response
73
+ @customer = params['customer']
74
+ @sku = params['sku']
75
+ @denomination = params['denomination'] || {}
76
+ @amount_charged = params['amount_charged'] || {}
77
+ @reward_message = params['reward_message']
78
+ @reward_subject = params['reward_subject']
79
+ @reward_from = params['reward_from']
80
+ @delivered_at = params['delivered_at']
81
+ @recipient = params['recipient'] || {}
82
+ @external_id = params['external_id']
83
+ @reward = params['reward'] || {}
84
+ @raw_response = raw_response
80
85
  end
81
86
 
82
87
  def reward
@@ -86,4 +91,4 @@ class Tangocard::Order
86
91
  def identifier
87
92
  @account_identifier
88
93
  end
89
- end
94
+ end
@@ -1,3 +1,3 @@
1
- class Tangocard::OrderCreateFailedException < Exception
1
+ class Tangocard::OrderCreateFailedException < StandardError
2
2
 
3
- end
3
+ end
@@ -1,3 +1,3 @@
1
- class Tangocard::OrderNotFoundException < Exception
1
+ class Tangocard::OrderNotFoundException < StandardError
2
2
 
3
- end
3
+ end
@@ -8,7 +8,7 @@ class Tangocard::Raas
8
8
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
9
9
  #
10
10
  # Arguments:
11
- # params: (Hash - see https://github.com/tangocarddev/RaaS#create-a-new-platform-account for details)
11
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#create-account for details)
12
12
  def self.create_account(params)
13
13
  Tangocard::Response.new(post(endpoint + '/accounts', {:body => params.to_json}.merge(basic_auth_param)))
14
14
  end
@@ -20,24 +20,11 @@ class Tangocard::Raas
20
20
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
21
21
  #
22
22
  # Arguments:
23
- # params: (Hash - see https://github.com/tangocarddev/RaaS#get-the-information-for-a-specific-platform-account for details)
23
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#get-account for details)
24
24
  def self.show_account(params)
25
25
  Tangocard::Response.new(get(endpoint + "/accounts/#{params['customer']}/#{params['identifier']}", basic_auth_param))
26
26
  end
27
27
 
28
- # (Deprecated)
29
- # Funds an account. Returns Tangocard::Response object.
30
- #
31
- # Example:
32
- # >> Tangocard::Raas.fund_account(params)
33
- # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
34
- #
35
- # Arguments:
36
- # params: (Hash - see https://github.com/tangocarddev/RaaS#fund-a-platforms-account for details)
37
- def self.fund_account(params)
38
- Tangocard::Response.new(post(endpoint + '/funds', {:body => params.to_json}.merge(basic_auth_param)))
39
- end
40
-
41
28
  # Funds an account. Returns Tangocard::Response object.
42
29
  #
43
30
  # Example:
@@ -45,7 +32,7 @@ class Tangocard::Raas
45
32
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
46
33
  #
47
34
  # Arguments:
48
- # params: (Hash - see https://github.com/tangocarddev/RaaS#fund-resources for details)
35
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#create-cc-fund for details)
49
36
  def self.cc_fund_account(params)
50
37
  Tangocard::Response.new(post(endpoint + '/cc_fund', {:body => params.to_json}.merge(basic_auth_param)))
51
38
  end
@@ -57,7 +44,7 @@ class Tangocard::Raas
57
44
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
58
45
  #
59
46
  # Arguments:
60
- # params: (Hash - see https://github.com/tangocarddev/RaaS#fund-resources for details)
47
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#create-cc-registration for details)
61
48
  def self.register_credit_card(params)
62
49
  Tangocard::Response.new(post(endpoint + '/cc_register', {:body => params.to_json}.merge(basic_auth_param)))
63
50
  end
@@ -69,7 +56,7 @@ class Tangocard::Raas
69
56
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
70
57
  #
71
58
  # Arguments:
72
- # params: (Hash - see https://github.com/tangocarddev/RaaS#delete-a-credit-card-from-an-account for details)
59
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#create-cc-un-registration for details)
73
60
  def self.delete_credit_card(params)
74
61
  Tangocard::Response.new(post(endpoint + '/cc_unregister', {:body => params.to_json}.merge(basic_auth_param)))
75
62
  end
@@ -97,7 +84,7 @@ class Tangocard::Raas
97
84
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
98
85
  #
99
86
  # Arguments:
100
- # params: (Hash - see https://github.com/tangocarddev/RaaS#place-an-order for details)
87
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#create-order for details)
101
88
  def self.create_order(params)
102
89
  Tangocard::Response.new(post(endpoint + '/orders', {:body => params.to_json}.merge(basic_auth_param)))
103
90
  end
@@ -109,7 +96,7 @@ class Tangocard::Raas
109
96
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
110
97
  #
111
98
  # Arguments:
112
- # params: (Hash - see https://github.com/tangocarddev/RaaS#retrieve-a-historical-order for details)
99
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#get-order for details)
113
100
  def self.show_order(params)
114
101
  Tangocard::Response.new(get(endpoint + "/orders/#{params['order_id']}", basic_auth_param))
115
102
  end
@@ -121,7 +108,7 @@ class Tangocard::Raas
121
108
  # => #<Tangocard::Response:0x007f9a6c4bca68 ...>
122
109
  #
123
110
  # Arguments:
124
- # params: (Hash - see https://github.com/tangocarddev/RaaS#retrieve-a-list-of-historical-orders for details)
111
+ # params: (Hash - see https://www.tangocard.com/docs/raas-api/#list-orders for details)
125
112
  def self.orders_index(params = {})
126
113
  query_string = ""
127
114
  if params.any?
@@ -145,6 +132,6 @@ class Tangocard::Raas
145
132
  end
146
133
 
147
134
  def self.endpoint
148
- Tangocard.configuration.base_uri + '/raas/v1'
135
+ Tangocard.configuration.base_uri + '/raas/v1.1'
149
136
  end
150
137
  end
@@ -1,18 +1,18 @@
1
1
  class Tangocard::Reward
2
- attr_reader :description, :sku, :currency_type, :unit_price, :available, :min_price, :max_price,
3
- :currency_code, :denomination, :locale
2
+ attr_reader :type, :description, :sku, :is_variable, :denomination, :min_price, :max_price,
3
+ :currency_code, :available, :countries
4
4
 
5
5
  def initialize(params)
6
- @description = params['description']
7
- @sku = params['sku']
8
- @currency_type = params['currency_type']
9
- @unit_price = params['unit_price'].to_i
10
- @available = params['available']
11
- @min_price = params['min_price'].to_i
12
- @max_price = params['max_price'].to_i
6
+ @type = params['type']
7
+ @description = params['description']
8
+ @sku = params['sku']
9
+ @is_variable = params['is_variable']
10
+ @denomination = params['denomination'].to_i
11
+ @min_price = params['min_price'].to_i
12
+ @max_price = params['max_price'].to_i
13
13
  @currency_code = params['currency_code']
14
- @denomination = params['denomination'].to_i
15
- @locale = params['locale']
14
+ @available = params['available']
15
+ @countries = params['countries']
16
16
  end
17
17
 
18
18
  # Is this a variable-priced reward?
@@ -24,7 +24,7 @@ class Tangocard::Reward
24
24
  # Arguments:
25
25
  # none
26
26
  def variable_price?
27
- self.unit_price == -1
27
+ is_variable
28
28
  end
29
29
 
30
30
  # Is this reward purchasable given a certain number of cents available to purchase it?
@@ -43,21 +43,21 @@ class Tangocard::Reward
43
43
  if variable_price?
44
44
  min_price <= balance_in_cents
45
45
  else
46
- unit_price <= balance_in_cents
46
+ denomination <= balance_in_cents
47
47
  end
48
48
  end
49
49
 
50
- # Converts price in cents for given field to Money object using currency_type
50
+ # Converts price in cents for given field to Money object using currency_code
51
51
  #
52
52
  # Example:
53
53
  # >> reward.to_money(:unit_price)
54
54
  # => #<Money fractional:5000 currency:USD>
55
55
  #
56
56
  # Arguments:
57
- # field_name: (Symbol - must be :min_price, :max_price, or :unit_price)
57
+ # field_name: (Symbol - must be :min_price, :max_price, or :denomination)
58
58
  def to_money(field_name)
59
- return nil unless [:min_price, :max_price, :unit_price].include?(field_name)
59
+ return nil unless [:min_price, :max_price, :denomination].include?(field_name)
60
60
 
61
- Money.new(self.send(field_name), currency_type)
61
+ Money.new(self.send(field_name), currency_code)
62
62
  end
63
- end
63
+ end
@@ -1,3 +1,3 @@
1
1
  module Tangocard
2
- VERSION = '4.1.0'
2
+ VERSION = '5.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tangocard
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Crawford-Marks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.11
47
+ version: '0.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.11
54
+ version: '0.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: |-
84
- Tango Card provides a RaaS API for developers (https://github.com/tangocarddev/RaaS). This gem
84
+ Tango Card provides a RaaS API for developers (https://www.tangocard.com/docs/raas-api/). This gem
85
85
  provides commonsense Ruby objects to wrap the JSON endpoints of the RaaS API.
86
86
  email:
87
87
  - raphael@bonus.ly
@@ -100,6 +100,7 @@ files:
100
100
  - lib/tangocard/account_not_found_exception.rb
101
101
  - lib/tangocard/account_register_credit_card_failed_exception.rb
102
102
  - lib/tangocard/brand.rb
103
+ - lib/tangocard/exchange_rate.rb
103
104
  - lib/tangocard/order.rb
104
105
  - lib/tangocard/order_create_failed_exception.rb
105
106
  - lib/tangocard/order_not_found_exception.rb
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  version: '0'
127
128
  requirements: []
128
129
  rubyforge_project:
129
- rubygems_version: 2.4.3
130
+ rubygems_version: 2.5.1
130
131
  signing_key:
131
132
  specification_version: 4
132
133
  summary: Ruby Wrapper for Tango Card RaaS API.