Class: Spree::ExactorSetting
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spree::ExactorSetting
show all
- Defined in:
- app/models/spree/exactor_setting.rb
Defined Under Namespace
Classes: COMMIT_OPTIONS, SKU_SOURCES
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.get_settings ⇒ Object
134
135
136
137
|
# File 'app/models/spree/exactor_setting.rb', line 134
def self.get_settings
settings = Spree::ExactorSetting.all
return settings.empty?() ? nil:settings.first()
end
|
Instance Method Details
#all_commit_options ⇒ Object
#all_sku_sources ⇒ Object
#create_additional_entities ⇒ Object
93
94
95
|
# File 'app/models/spree/exactor_setting.rb', line 93
def create_additional_entities
TaxRate.find_or_create_exactor_tax_rate()
end
|
#get_ship_from ⇒ Object
121
122
123
124
125
126
127
128
129
130
131
|
# File 'app/models/spree/exactor_setting.rb', line 121
def get_ship_from
companyAddress = AddressType.new
companyAddress.FullName= ship_from_name
companyAddress.Street1= ship_from_street1
companyAddress.Street2= ship_from_street2
companyAddress.City= ship_from_city
companyAddress.StateOrProvince= state_id.nil?() ? state_name : state
companyAddress.PostalCode= ship_from_zip
companyAddress.Country= country
return companyAddress
end
|
#is_valid_state? ⇒ Boolean
86
87
88
89
90
|
# File 'app/models/spree/exactor_setting.rb', line 86
def is_valid_state?
if state_id.nil? and state_name.to_s.empty?
errors[:state] << "is required field"
end
end
|
#set_states ⇒ Object
98
99
100
101
102
103
104
|
# File 'app/models/spree/exactor_setting.rb', line 98
def set_states
unless country.states.include?(state) or state.nil?
@attributes["state_id"] = nil
else
@attributes["state_name"] = nil
end
end
|