Class: Deliveries::Address
- Inherits:
-
Object
- Object
- Deliveries::Address
- Defined in:
- lib/deliveries/address.rb
Direct Known Subclasses
CollectionPoint, Couriers::CorreosExpress::Address, Couriers::MondialRelay::Address, Couriers::MondialRelayDual::Address, Couriers::Spring::Address
Constant Summary collapse
- COUNTRY_PHONE_PREFIXES =
{ be: 32, fr: 33, es: 34, it: 39, gb: 44, de: 49, pt: 351 }.freeze
- COUNTRY_TRUNK_PREFIXES =
{ be: 0, fr: 0, es: nil, it: nil, gb: 0, de: 0, pt: nil }.freeze
Instance Attribute Summary collapse
-
#address_id ⇒ Object
Returns the value of attribute address_id.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#postcode ⇒ Object
Returns the value of attribute postcode.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
Instance Method Summary collapse
- #courierize(courier_id) ⇒ Object
-
#initialize(**attributes) ⇒ Address
constructor
A new instance of Address.
Constructor Details
#initialize(**attributes) ⇒ Address
Returns a new instance of Address.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/deliveries/address.rb', line 24 def initialize(**attributes) self.name = attributes[:name] self.email = attributes[:email] self.phone = attributes[:phone] self.country = attributes[:country] self.state = attributes[:state] self.city = attributes[:city] self.street = attributes[:street] self.postcode = attributes[:postcode] self.address_id = attributes[:address_id] end |
Instance Attribute Details
#address_id ⇒ Object
Returns the value of attribute address_id.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def address_id @address_id end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def email @email end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def phone @phone end |
#postcode ⇒ Object
Returns the value of attribute postcode.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def postcode @postcode end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
3 4 5 |
# File 'lib/deliveries/address.rb', line 3 def street @street end |
Instance Method Details
#courierize(courier_id) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/deliveries/address.rb', line 36 def courierize(courier_id) courier_address = %(Deliveries::Couriers::#{courier_id.to_s.camelize}::Address).safe_constantize.new instance_variables.each do |iv| courier_address.instance_variable_set(iv, instance_variable_get(iv)) end courier_address end |