-
-
Save jordan-brough/687285f847a9755cb840 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/db/migrate/20151130195450_add_spree_avatax_configs.rb b/db/migrate/20151130195450_add_spree_avatax_configs.rb | |
new file mode 100644 | |
index 0000000..3a07ac4 | |
--- /dev/null | |
+++ b/db/migrate/20151130195450_add_spree_avatax_configs.rb | |
@@ -0,0 +1,8 @@ | |
+class AddSpreeAvataxConfigs < ActiveRecord::Migration | |
+ def change | |
+ create_table 'spree_avatax_configs' do |t| | |
+ t.boolean 'enabled', null: false | |
+ t.integer 'timeout', null: false | |
+ end | |
+ end | |
+end | |
diff --git a/lib/spree_avatax/config.rb b/lib/spree_avatax/config.rb | |
index 9962103..fc06191 100644 | |
--- a/lib/spree_avatax/config.rb | |
+++ b/lib/spree_avatax/config.rb | |
@@ -1,5 +1,7 @@ | |
module SpreeAvatax | |
- class Config | |
+ class Config < Spree::Base | |
+ DEFAULT_TIMEOUT_SECONDS = 20 | |
+ | |
class << self | |
attr_accessor :username | |
attr_accessor :password | |
@@ -11,6 +13,14 @@ module SpreeAvatax | |
attr_accessor :sales_invoice_generate_error_handler | |
attr_accessor :sales_invoice_commit_error_handler | |
attr_accessor :sales_invoice_cancel_error_handler | |
+ | |
+ def timeout | |
+ (config = last) ? config.timeout : DEFAULT_TIMEOUT_SECONDS | |
+ end | |
+ | |
+ def enabled | |
+ (config = last) ? config.enabled : true | |
+ end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment