Class: Spree::Admin::TaxjarSettingsController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Admin::TaxjarSettingsController
- Defined in:
- app/controllers/spree/admin/taxjar_settings_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/spree/admin/taxjar_settings_controller.rb', line 6 def edit if ENV["TAXJAR_API_KEY"].blank? flash[:error] = "You must provide a TaxJar API token to use this extension." render "edit_no_api_key" else @configuration = SuperGood::SolidusTaxjar.configuration @nexus_regions = cached_api.nexus_regions || [] @tax_categories = cached_tax_categories end end |
#sync_nexus_regions ⇒ Object
23 24 25 26 27 28 |
# File 'app/controllers/spree/admin/taxjar_settings_controller.rb', line 23 def sync_nexus_regions api_sync do cached_api.nexus_regions(refresh: true) flash[:success] = "Updated with new Nexus Regions" end end |
#sync_tax_categories ⇒ Object
30 31 32 33 34 35 |
# File 'app/controllers/spree/admin/taxjar_settings_controller.rb', line 30 def sync_tax_categories api_sync do cached_tax_categories flash[:success] = "Updated with new tax categories" end end |
#update ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/spree/admin/taxjar_settings_controller.rb', line 17 def update configuration_update if params[:super_good_solidus_taxjar_configuration] tax_category_update if params[:tax_category] redirect_back(fallback_location: spree.admin_taxjar_settings_path) end |