Class: SuperGood::SolidusTaxjar::CachedApi
- Inherits:
-
Object
- Object
- SuperGood::SolidusTaxjar::CachedApi
- Defined in:
- lib/super_good/solidus_taxjar/cached_api.rb
Instance Method Summary collapse
-
#initialize(api: SuperGood::SolidusTaxjar.api) ⇒ CachedApi
constructor
A new instance of CachedApi.
- #nexus_regions(refresh: false) ⇒ Object
Constructor Details
#initialize(api: SuperGood::SolidusTaxjar.api) ⇒ CachedApi
Returns a new instance of CachedApi.
5 6 7 |
# File 'lib/super_good/solidus_taxjar/cached_api.rb', line 5 def initialize(api: SuperGood::SolidusTaxjar.api) @api = api end |
Instance Method Details
#nexus_regions(refresh: false) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/super_good/solidus_taxjar/cached_api.rb', line 10 def nexus_regions(refresh: false) Rails.cache.fetch( :nexus_regions, expires_in: SuperGood::SolidusTaxjar.cache_duration, force: refresh ) { api.nexus_regions } end |