Class: SpreeAvatax::Config

Inherits:
Spree::Base
  • Object
show all
Defined in:
app/models/spree_avatax/config.rb

Constant Summary collapse

DEFAULT_TIMEOUT =
20

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.company_codeObject

Returns the value of attribute company_code.



8
9
10
# File 'app/models/spree_avatax/config.rb', line 8

def company_code
  @company_code
end

.passwordObject

Returns the value of attribute password.



7
8
9
# File 'app/models/spree_avatax/config.rb', line 7

def password
  @password
end

.sales_invoice_cancel_error_handlerObject

Returns the value of attribute sales_invoice_cancel_error_handler.



15
16
17
# File 'app/models/spree_avatax/config.rb', line 15

def sales_invoice_cancel_error_handler
  @sales_invoice_cancel_error_handler
end

.sales_invoice_commit_error_handlerObject

Returns the value of attribute sales_invoice_commit_error_handler.



14
15
16
# File 'app/models/spree_avatax/config.rb', line 14

def sales_invoice_commit_error_handler
  @sales_invoice_commit_error_handler
end

.sales_invoice_generate_error_handlerObject

These error handlers should be objects that respond to “call” and accept an order and an exception as arguments. This allows you to ignore certain errors or handle them in specific ways.



13
14
15
# File 'app/models/spree_avatax/config.rb', line 13

def sales_invoice_generate_error_handler
  @sales_invoice_generate_error_handler
end

.service_urlObject

Returns the value of attribute service_url.



9
10
11
# File 'app/models/spree_avatax/config.rb', line 9

def service_url
  @service_url
end

.usernameObject

Returns the value of attribute username.



6
7
8
# File 'app/models/spree_avatax/config.rb', line 6

def username
  @username
end

Class Method Details

.enabledObject



24
25
26
# File 'app/models/spree_avatax/config.rb', line 24

def enabled
  (config = active) ? config.enabled : true
end

.timeoutObject

These configurations are stored in the database so that they can be updated immediately and synchronously across all servers in the event of an outage, without a redeploy or restart.



20
21
22
# File 'app/models/spree_avatax/config.rb', line 20

def timeout
  (config = active) ? config.timeout : DEFAULT_TIMEOUT
end