Class: GoogleDistanceMatrix::ClientCache
- Inherits:
-
Object
- Object
- GoogleDistanceMatrix::ClientCache
- Defined in:
- lib/google_distance_matrix/client_cache.rb
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
- #get(url, options = {}) ⇒ Object
-
#initialize(client, cache) ⇒ ClientCache
constructor
A new instance of ClientCache.
Constructor Details
#initialize(client, cache) ⇒ ClientCache
Returns a new instance of ClientCache.
9 10 11 12 |
# File 'lib/google_distance_matrix/client_cache.rb', line 9 def initialize(client, cache) @client = client @cache = cache end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
3 4 5 |
# File 'lib/google_distance_matrix/client_cache.rb', line 3 def cache @cache end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/google_distance_matrix/client_cache.rb', line 3 def client @client end |
Class Method Details
.key(url) ⇒ Object
5 6 7 |
# File 'lib/google_distance_matrix/client_cache.rb', line 5 def self.key(url) url end |
Instance Method Details
#get(url, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/google_distance_matrix/client_cache.rb', line 14 def get(url, = {}) cache.fetch self.class.key(url) do client.get url, end end |