tangocard 5.0.0 → 6.0.0
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 +4 -4
- data/README.md +1 -1
- data/lib/tangocard.rb +1 -0
- data/lib/tangocard/account.rb +5 -21
- data/lib/tangocard/brand.rb +13 -0
- data/lib/tangocard/response.rb +6 -2
- data/lib/tangocard/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 195374af4af9dbbafb48fb692f00d4b78acd006b
|
4
|
+
data.tar.gz: 1f2eaaa879ca2e69356d6027424c3e0492be19a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
|
data/lib/tangocard.rb
CHANGED
data/lib/tangocard/account.rb
CHANGED
@@ -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
|
-
# =>
|
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
|
-
# =>
|
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
|
-
|
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
|
-
# =>
|
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
|
-
|
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
|
data/lib/tangocard/brand.rb
CHANGED
@@ -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']
|
data/lib/tangocard/response.rb
CHANGED
@@ -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
|
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
|
data/lib/tangocard/version.rb
CHANGED
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
|
+
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-
|
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
|
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
|
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.
|
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.
|