tangocard 5.0.0 → 6.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: 49c965036413c7a215002d6607a6d620196f1ed7
4
- data.tar.gz: 98763bca37c622a6fa2c8d8f3a55ec0e898c9ab3
3
+ metadata.gz: 195374af4af9dbbafb48fb692f00d4b78acd006b
4
+ data.tar.gz: 1f2eaaa879ca2e69356d6027424c3e0492be19a8
5
5
  SHA512:
6
- metadata.gz: f3faadaa33b916d60448dd6e322a20afeb6dc76cf69dc1e39e1e2a58734803aa4b7c37bb9672257cfe829e0e126d38c391f406af8a47bf0600bd49ba257fcabb
7
- data.tar.gz: 0d684e0d75017033b467a5b07d9385e68829c2d007b68e0240d2109f644daf966059d18b6c2c234d6b3d0e39c7bf812a5379ac468c4ac051d3736eced76543a1
6
+ metadata.gz: c53de8686810144fde4acc8780145afe663d7cac61cf3724d4f0f1d9e9c53df381d4ff38a2a10d774270824cd784fb12590afc4e1ce1b7c257417407b97396d9
7
+ data.tar.gz: beb1ad464599fe27e5a79c40eda647e6f9d0600b7adadb447f1f23e3acc2e65be482d8b7f75af290d4a55cfe09f0f38e739be9f757bbef362bdc8e7556553ca6
data/README.md CHANGED
@@ -41,7 +41,7 @@ There are three required configuration parameters:
41
41
 
42
42
  There are also three optional configuration parameters:
43
43
 
44
- * `default_brands` - An array of strings for the brands you want to retrieve with `Tangocard::Brand.default_brands`. The strings should match the unique brand `description` fields exactly.
44
+ * `default_brands` - An array of strings for the brands you want to retrieve with `Tangocard::Brand.default`. The strings should match the unique brand `description` fields exactly.
45
45
  * `local_images` - An array of local image names/URIs that you want to display instead of the default Tango Card-provided `image_url`. `image_url` is sometimes blank, so this can be handy in those cases.
46
46
  * `sku_blacklist` - Reward SKUs that are blacklisted, ie. should never be returned as a purchasable reward.
47
47
 
@@ -10,6 +10,7 @@ module Tangocard
10
10
  self.name = nil
11
11
  self.key = nil
12
12
  self.base_uri = 'https://sandbox.tangocard.com'
13
+ self.default_brands = []
13
14
  self.local_images = {}
14
15
  self.sku_blacklist = []
15
16
  self.use_cache = true
@@ -75,7 +75,7 @@ class Tangocard::Account
75
75
  # Raises Tango::AccountRegisterCreditCardFailedException on failure.
76
76
  # Example:
77
77
  # >> account.register_credit_card('128.128.128.128', Hash (see example below))
78
- # => {"success"=>true, "cc_token"=>"33041234", "active_date"=>1439286111}
78
+ # => #<Tangocard::Response:0x007f9a6fec0138 ...>
79
79
  #
80
80
  # Arguments:
81
81
  # client_ip: (String)
@@ -108,19 +108,13 @@ class Tangocard::Account
108
108
  }
109
109
 
110
110
  response = Tangocard::Raas.register_credit_card(params)
111
- if response.success?
112
- @cc_token = response.parsed_response['cc_token']
113
- response.parsed_response
114
- else
115
- raise Tangocard::AccountRegisterCreditCardFailedException, "#{response.error_message} #{response.denial_message} #{response.invalid_inputs}"
116
- end
117
111
  end
118
112
 
119
113
  # Add funds to the account.
120
114
  # Raises Tangocard::AccountFundFailedException on failure.
121
115
  # Example:
122
116
  # >> account.cc_fund(5000, '128.128.128.128', '12345678', '123')
123
- # => {"success"=>true, "fund_id"=>"RF13-09261098-12", "amount"=>5000}
117
+ # => #<Tangocard::Response:0x007f9a6fec0138 ...>
124
118
 
125
119
  # Arguments:
126
120
  # amount: (Integer)
@@ -150,19 +144,14 @@ class Tangocard::Account
150
144
  'security_code' => security_code
151
145
  }
152
146
 
153
- response = Tangocard::Raas.cc_fund_account(params)
154
- if response.success?
155
- response.parsed_response
156
- else
157
- raise Tangocard::AccountFundFailedException, "#{response.error_message} #{response.denial_message} #{response.invalid_inputs}"
158
- end
147
+ Tangocard::Raas.cc_fund_account(params)
159
148
  end
160
149
 
161
150
  # Delete a credit card from an account
162
151
  # Raises Tangocard::AccountDeleteCreditCardFailedException failure.
163
152
  # Example:
164
153
  # >> account.delete_credit_card("12345678")
165
- # => {"success"=>true, "message": "This card is no longer present in the system"}
154
+ # => #<Tangocard::Response:0x007f9a6fec0138 ...>
166
155
 
167
156
  # Arguments:
168
157
  # cc_token: (String)
@@ -173,12 +162,7 @@ class Tangocard::Account
173
162
  'account_identifier' => identifier
174
163
  }
175
164
 
176
- response = Tangocard::Raas.delete_credit_card(params)
177
- if response.success?
178
- response.parsed_response
179
- else
180
- raise Tangocard::AccountDeleteCreditCardFailedException, "#{response.error_message}"
181
- end
165
+ Tangocard::Raas.delete_credit_card(params)
182
166
  end
183
167
 
184
168
  end
@@ -42,6 +42,19 @@ class Tangocard::Brand
42
42
  self.all.select{|b| b.description == brand_name}.first
43
43
  end
44
44
 
45
+ # Return an array of default brands. You can set :default_brands in your Tangocard initializer
46
+ # to define your desired list of brands. See the README for details.
47
+ #
48
+ # Example:
49
+ # >> Tangocard::Brand.default
50
+ # => [#<Tangocard::Brand:0x007f9a6f9d3030 ...>, #<Tangocard::Brand:0x007f9a6f9d3030 ...>, ...]
51
+ #
52
+ # Arguments:
53
+ # none
54
+ def self.default
55
+ self.all.select{|b| Tangocard.configuration.default_brands.include?(b.description)}
56
+ end
57
+
45
58
  def initialize(params)
46
59
  @description = params['description']
47
60
  @image_url = params['image_url']
@@ -11,11 +11,15 @@ class Tangocard::Response
11
11
  end
12
12
 
13
13
  def error_message
14
- parsed_response['error_message'] rescue 'UNKNOWN ERROR'
14
+ parsed_response['error_message'] rescue 'UNKNOWN ERROR MESSAGE'
15
15
  end
16
16
 
17
17
  def denial_message
18
- parsed_response['denial_message'] rescue 'UNKNOWN ERROR'
18
+ parsed_response['denial_message'] rescue 'UNKNOWN DENIAL MESSSAGE'
19
+ end
20
+
21
+ def denial_code
22
+ parsed_response['denial_code'] rescue 'UNKNOWN DENIAL CODE'
19
23
  end
20
24
 
21
25
  def invalid_inputs
@@ -1,3 +1,3 @@
1
1
  module Tangocard
2
- VERSION = '5.0.0'
2
+ VERSION = '6.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: 5.0.0
4
+ version: 6.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: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.14.1
61
+ version: '2.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.14.1
68
+ version: '2.14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rr
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.5.1
130
+ rubygems_version: 2.4.3
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Ruby Wrapper for Tango Card RaaS API.