tangocard 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/tangocard/brand.rb +8 -4
- data/lib/tangocard/response.rb +3 -10
- data/lib/tangocard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjE2OTc1OWQ0YzY5MjIxNGZjZGRmZDc1ODAxZDMwNjdkYzU5Njg0NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzE2Y2RiZjc0ODkyOTI2NTA1OTUyNDliZDE4MzJjNTMwYTk0ZTM2MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDAxOTBhNGFhZDYyYTQxM2NkOWI3NWJlNTExMjhmYjUxNzMxMzk4ODYwYzZm
|
10
|
+
MGIwZWM2NTFhZTJiOWQ5MTJhZTA2N2ZlOTM3YTExODk1MzM2YTZkNzZjOWRl
|
11
|
+
MzMxNDg4MjRlMWUzNjQ2MmEwMDY2NmIyMWFmYzAyNDA3NWVhMGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTk5ZjA2NmZmYjVkMDgzOGFkMmRhNWU3OTRmNmQ4ZmQ4YWYxMmY3ZTkyYTMx
|
14
|
+
ODE3NjMxZTIxNzVmMDdkNjNhYzVmNmRlNWFlZjk5ZjU4YzhmNWM0NmJiYTY1
|
15
|
+
OGQyM2YxODZmNTkwYTYxMWVhZGJlM2NjMTJkNmU2YjQ1NDFhMDc=
|
data/lib/tangocard/brand.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
class Tangocard::Brand
|
2
2
|
attr_reader :description, :rewards
|
3
|
+
@@result = nil
|
4
|
+
@@brands = nil
|
5
|
+
@@default_brands = nil
|
6
|
+
@@brand_finder = {}
|
3
7
|
|
4
8
|
# Return an array of all brands.
|
5
9
|
#
|
@@ -10,8 +14,8 @@ class Tangocard::Brand
|
|
10
14
|
# Arguments:
|
11
15
|
# none
|
12
16
|
def self.all
|
13
|
-
result
|
14
|
-
result['brands'].map{|p| Tangocard::Brand.new(p)}
|
17
|
+
@@result ||= Tangocard::Raas.rewards_index.parsed_response
|
18
|
+
@@brands ||= @@result['brands'].map{|p| Tangocard::Brand.new(p)}
|
15
19
|
end
|
16
20
|
|
17
21
|
# Return an array of default brands. Must set default_brands in your Tangocard initializer (see README).
|
@@ -23,7 +27,7 @@ class Tangocard::Brand
|
|
23
27
|
# Arguments:
|
24
28
|
# none
|
25
29
|
def self.default_brands
|
26
|
-
self.all.select{|b| Tangocard.configuration.default_brands.include?(b.description)}
|
30
|
+
@@default_brands ||= self.all.select{|b| Tangocard.configuration.default_brands.include?(b.description)}
|
27
31
|
end
|
28
32
|
|
29
33
|
# Find a brand by its :description field.
|
@@ -39,7 +43,7 @@ class Tangocard::Brand
|
|
39
43
|
# Arguments:
|
40
44
|
# brand_name: (String)
|
41
45
|
def self.find(brand_name)
|
42
|
-
self.all.select{|b| b.description == brand_name}.first
|
46
|
+
@@brand_finder[brand_name] ||= self.all.select{|b| b.description == brand_name}.first
|
43
47
|
end
|
44
48
|
|
45
49
|
def initialize(params)
|
data/lib/tangocard/response.rb
CHANGED
@@ -1,16 +1,9 @@
|
|
1
1
|
class Tangocard::Response
|
2
|
-
attr_reader :
|
2
|
+
attr_reader :parsed_response, :code
|
3
3
|
|
4
4
|
def initialize(raw_response)
|
5
|
-
@
|
6
|
-
|
7
|
-
|
8
|
-
def parsed_response
|
9
|
-
raw_response.parsed_response
|
10
|
-
end
|
11
|
-
|
12
|
-
def code
|
13
|
-
raw_response.code
|
5
|
+
@parsed_response = raw_response.parsed_response
|
6
|
+
@code = raw_response.code
|
14
7
|
end
|
15
8
|
|
16
9
|
def success?
|
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: 2.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:
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|