tangocard 3.1.0 → 3.2.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: 38b0f679e701e57609f203bcfd521b38556948cb
4
- data.tar.gz: 35728a425bbd07a23d6970ec75d1dbdd6484f15b
3
+ metadata.gz: 1b146ae717f7cbdb68ac360039e6a35cf676f0c8
4
+ data.tar.gz: 94980ddca9137e80fbe12ecc5ae6b5910f1cb8e8
5
5
  SHA512:
6
- metadata.gz: f2a8b94659d5b1448cef2ec4671bae7aa70505dc98fba2af582d386909c570fcc05850bdc5830c5166cd89cdcf68eac1e6e844a51ed4dd94d6ed4128eb7a435e
7
- data.tar.gz: c1e4926acf5f4d79bbf097d9def494e1a65c52d9e0deb622b93671ef48c9feb05e6e87120c4b8f356ceda29ec323742e0f3e4dcad5bafc126afca29881018ebc
6
+ metadata.gz: 4a5624ddb2268a3c993ac9e59681477b9477c06e3351cea4289587425b76fa8321cf8c6c24db44b65597cdec033c9639bcc2317069277ca4a7d0647074db2a39
7
+ data.tar.gz: 1fd5aad408539b3734e757d7126d738152c3f2501392e815f89820ae4c9b084af96afb8a73274983f729410fe1057abc6a94fad08899b4eaddd5500e106b5982
@@ -1,9 +1,25 @@
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
+ @result = nil
4
+ @brands = nil
5
+ @default_brands = nil
6
+ @brand_finder = {}
7
+
8
+ # Clear all cached responses. Next request for brand info will pull fresh from the Tango Card API.
9
+ #
10
+ # Example:
11
+ # >> Tangocard::Brand.clear_cache!
12
+ # => true
13
+ #
14
+ # Arguments:
15
+ # none
16
+ def self.clear_cache!
17
+ @result = nil
18
+ @brands = nil
19
+ @default_brands = nil
20
+ @brand_finder = {}
21
+ true
22
+ end
7
23
 
8
24
  # Return an array of all brands.
9
25
  #
@@ -14,8 +30,8 @@ class Tangocard::Brand
14
30
  # Arguments:
15
31
  # none
16
32
  def self.all
17
- @@result ||= Tangocard::Raas.rewards_index.parsed_response
18
- @@brands ||= @@result['brands'].map{|p| Tangocard::Brand.new(p)}
33
+ @result ||= Tangocard::Raas.rewards_index.parsed_response
34
+ @brands ||= @result['brands'].map{|p| Tangocard::Brand.new(p)}
19
35
  end
20
36
 
21
37
  # Return an array of default brands. Must set default_brands in your Tangocard initializer (see README).
@@ -27,7 +43,7 @@ class Tangocard::Brand
27
43
  # Arguments:
28
44
  # none
29
45
  def self.default_brands
30
- @@default_brands ||= self.all.select{|b| Tangocard.configuration.default_brands.include?(b.description)}
46
+ @default_brands ||= self.all.select{|b| Tangocard.configuration.default_brands.include?(b.description)}
31
47
  end
32
48
 
33
49
  # Find a brand by its :description field.
@@ -43,7 +59,7 @@ class Tangocard::Brand
43
59
  # Arguments:
44
60
  # brand_name: (String)
45
61
  def self.find(brand_name)
46
- @@brand_finder[brand_name] ||= self.all.select{|b| b.description == brand_name}.first
62
+ @brand_finder[brand_name] ||= self.all.select{|b| b.description == brand_name}.first
47
63
  end
48
64
 
49
65
  def initialize(params)
@@ -7,14 +7,14 @@ class Tangocard::Response
7
7
  end
8
8
 
9
9
  def success?
10
- parsed_response['success']
10
+ parsed_response['success'] rescue false
11
11
  end
12
12
 
13
13
  def error_message
14
- parsed_response['error_message']
14
+ parsed_response['error_message'] rescue 'UNKNOWN ERROR'
15
15
  end
16
16
 
17
17
  def invalid_inputs
18
- parsed_response['invalid_inputs']
18
+ parsed_response['invalid_inputs'] rescue 'UNKNOWN INVALID INPUTS'
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module Tangocard
2
- VERSION = "3.1.0"
2
+ VERSION = '3.2.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: 3.1.0
4
+ version: 3.2.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: 2014-11-25 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty