Class: MusicTodayApiWrapper::Resources::Address
- Inherits:
-
Object
- Object
- MusicTodayApiWrapper::Resources::Address
- Defined in:
- lib/resources/address.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#selected_shipping ⇒ Object
Returns the value of attribute selected_shipping.
-
#shipping_options ⇒ Object
Returns the value of attribute shipping_options.
-
#street ⇒ Object
Returns the value of attribute street.
-
#street_second_line ⇒ Object
Returns the value of attribute street_second_line.
Class Method Summary collapse
Instance Method Summary collapse
- #as_hash ⇒ Object
-
#initialize(street, state, city, postal_code, country = 'US', street_second_line = '', shipping_options = [], selected_shipping = nil) ⇒ Address
constructor
rubocop:disable ParameterLists.
Constructor Details
#initialize(street, state, city, postal_code, country = 'US', street_second_line = '', shipping_options = [], selected_shipping = nil) ⇒ Address
rubocop:disable ParameterLists
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/resources/address.rb', line 16 def initialize(street, state, city, postal_code, country = 'US', street_second_line = '', = [], selected_shipping = nil) @street = street @state = state @street_second_line = street_second_line @city = city @postal_code = postal_code @country = country @shipping_options = @selected_shipping = selected_shipping end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def country @country end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def postal_code @postal_code end |
#selected_shipping ⇒ Object
Returns the value of attribute selected_shipping.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def selected_shipping @selected_shipping end |
#shipping_options ⇒ Object
Returns the value of attribute shipping_options.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def @shipping_options end |
#street ⇒ Object
Returns the value of attribute street.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def street @street end |
#street_second_line ⇒ Object
Returns the value of attribute street_second_line.
7 8 9 |
# File 'lib/resources/address.rb', line 7 def street_second_line @street_second_line end |
Class Method Details
.from_destinations(destinations) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/resources/address.rb', line 47 def self.from_destinations(destinations) destinations.map do |destination| customer = destination.customer address = new(customer.street, customer.state, customer.city, customer.zip_code) address.selected_shipping = destination.shipping_option address end end |
Instance Method Details
#as_hash ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/resources/address.rb', line 37 def as_hash { street: @street, street2: @street_second_line, state: @state, city: @city, postalCode: @postal_code, country: @country, shippingOptionType: @selected_shipping }.compact end |