Class: TranslationCms::Api::Customers::BillingAddress
- Inherits:
-
Base
- Object
- JsonApiClient::Resource
- Base
- Base
- TranslationCms::Api::Customers::BillingAddress
show all
- Extended by:
- EnumField::EnumeratedAttribute
- Defined in:
- lib/translation_cms/api/customers/billing_address.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
all!, custom_scope!, default_attributes, destroy, dummy_resource!, #method_missing_with_translations_will_change, parsed!, path_with_custom_scope, resource_type!, update
Class Method Details
.path(*_params) ⇒ Object
20
21
22
|
# File 'lib/translation_cms/api/customers/billing_address.rb', line 20
def path(*_params)
'/api/v1/customers/billing_address'
end
|
Instance Method Details
#business? ⇒ Boolean
27
28
29
|
# File 'lib/translation_cms/api/customers/billing_address.rb', line 27
def business?
account_type.present? && account_type.business?
end
|
#country ⇒ Object
31
32
33
|
# File 'lib/translation_cms/api/customers/billing_address.rb', line 31
def country
@country ||= ISO3166::Country.find_country_by_alpha3(country_code)
end
|
#editable? ⇒ Boolean
41
42
43
|
# File 'lib/translation_cms/api/customers/billing_address.rb', line 41
def editable?
id.blank?
end
|
#in_eu? ⇒ Boolean
35
36
37
38
39
|
# File 'lib/translation_cms/api/customers/billing_address.rb', line 35
def in_eu?
return false if country_code.blank? || country.blank?
@in_eu ||= country.in_eu?
end
|
#params ⇒ Object
45
46
47
48
|
# File 'lib/translation_cms/api/customers/billing_address.rb', line 45
def params
attributes.as_json(only: [:country_code, :city, :vat_code, :address_1, :address_2, :zip_code,
:account_type_id])
end
|