Class: Spina::Shop::StoreAddress

Inherits:
Object
  • Object
show all
Defined in:
app/services/spina/shop/store_address.rb

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ StoreAddress

Returns a new instance of StoreAddress.



4
5
6
# File 'app/services/spina/shop/store_address.rb', line 4

def initialize(order)
  @order = order
end

Instance Method Details

#store!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/spina/shop/store_address.rb', line 8

def store!
  @order.customer.addresses.create(
    first_name: @order.first_name,
    last_name: @order.last_name,
    postal_code: @order.billing_postal_code,
    city: @order.billing_city,
    country_id: @order.billing_country_id,
    house_number: @order.billing_house_number,
    house_number_addition: @order.billing_house_number_addition,
    street1: @order.billing_street1,
    street2: @order.billing_street2
  )
end