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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTEwNTdhNmNmOWU4YzMzYTA3NjgxZWM4YjUyMmU4N2JmM2M3NzNjZA==
4
+ NjE2OTc1OWQ0YzY5MjIxNGZjZGRmZDc1ODAxZDMwNjdkYzU5Njg0NA==
5
5
  data.tar.gz: !binary |-
6
- NzZjNTllZjZhYmFmMTI0NmU3MjJkNmZkYTM0OGI5ZWU4YTdhMDgwMQ==
6
+ YzE2Y2RiZjc0ODkyOTI2NTA1OTUyNDliZDE4MzJjNTMwYTk0ZTM2MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTZkZTI5YmI4NjJiZDdlNzMzNTcxODA0Mzg5Yjc2ZThmY2FlMjFiMTU2NjBm
10
- OTJlNjllZWRlNTBjYWEzMDU2MGRlNTkyYWI0ZjZiNmE5MDYxNjRkYzY4ZGQ1
11
- Mjg3OWUxMjcwNjY3NDI2MDUxMTVjMTM4YzE1Nzc1YmMzOTA0YTc=
9
+ NDAxOTBhNGFhZDYyYTQxM2NkOWI3NWJlNTExMjhmYjUxNzMxMzk4ODYwYzZm
10
+ MGIwZWM2NTFhZTJiOWQ5MTJhZTA2N2ZlOTM3YTExODk1MzM2YTZkNzZjOWRl
11
+ MzMxNDg4MjRlMWUzNjQ2MmEwMDY2NmIyMWFmYzAyNDA3NWVhMGU=
12
12
  data.tar.gz: !binary |-
13
- NWRlYjgxMDA5NDVhODMxNzViMTY2Mjg0NWU2M2FlYzYzZGE3NmI5ZWE3YTdh
14
- Y2U4NGIxNTU3YjQyNDhmMWFjYjRlOTFkZmE5NDdlNzAxOGE2NjJhMWNjMjZk
15
- YzI1YmY2ZDE5OTUxYjRlMGJmMjEzZGM3ZWRiOWRkMjhiM2JlYjA=
13
+ NTk5ZjA2NmZmYjVkMDgzOGFkMmRhNWU3OTRmNmQ4ZmQ4YWYxMmY3ZTkyYTMx
14
+ ODE3NjMxZTIxNzVmMDdkNjNhYzVmNmRlNWFlZjk5ZjU4YzhmNWM0NmJiYTY1
15
+ OGQyM2YxODZmNTkwYTYxMWVhZGJlM2NjMTJkNmU2YjQ1NDFhMDc=
@@ -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 = Tangocard::Raas.rewards_index.parsed_response
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)
@@ -1,16 +1,9 @@
1
1
  class Tangocard::Response
2
- attr_reader :raw_response
2
+ attr_reader :parsed_response, :code
3
3
 
4
4
  def initialize(raw_response)
5
- @raw_response = raw_response
6
- end
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?
@@ -1,3 +1,3 @@
1
1
  module Tangocard
2
- VERSION = "1.0.0"
2
+ VERSION = "2.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: 1.0.0
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: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty