Class: MarketTown::Checkout::Address Private
- Inherits:
-
Object
- Object
- MarketTown::Checkout::Address
- Includes:
- ActiveModel::Model
- Defined in:
- lib/market_town/checkout/models/address.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
An Address model for validating addresses. This class is for internal use only. You should validate addresses yourself before passing them into MarketTown::Checkout.
Defined Under Namespace
Classes: InvalidError
Instance Attribute Summary collapse
- #address_1 ⇒ Object private
- #address_2 ⇒ Object private
- #address_3 ⇒ Object private
- #company ⇒ Object private
- #country ⇒ Object private
- #locality ⇒ Object private
- #name ⇒ Object private
- #postal_code ⇒ Object private
- #region ⇒ Object private
- #save ⇒ Object private
Class Method Summary collapse
-
.validate!(address_attrs) ⇒ Object
private
Validates an address, throws InvalidError if invalid.
Instance Attribute Details
#address_1 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def address_1 @address_1 end |
#address_2 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def address_2 @address_2 end |
#address_3 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def address_3 @address_3 end |
#company ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def company @company end |
#country ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def country @country end |
#locality ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def locality @locality end |
#name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def name @name end |
#postal_code ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def postal_code @postal_code end |
#region ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def region @region end |
#save ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/market_town/checkout/models/address.rb', line 39 def save @save end |
Class Method Details
.validate!(address_attrs) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validates an address, throws InvalidError if invalid
28 29 30 31 32 33 34 35 |
# File 'lib/market_town/checkout/models/address.rb', line 28 def self.validate!(address_attrs) address = new(address_attrs) if address.invalid? raise InvalidError.new(address: address_attrs, errors: address.errors.) end end |