Class: ShopifyTransporter::Shopify::Customer

Inherits:
Record
  • Object
show all
Defined in:
lib/shopify_transporter/shopify/customer.rb

Constant Summary

Constants inherited from Record

Record::METAFIELD_ATTRIBUTES, Record::METAFIELD_PREFIX

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Record

has_values?, #initialize, #metafield_row_values

Constructor Details

This class inherits a constructor from ShopifyTransporter::Shopify::Record

Class Method Details

.columnsObject



18
19
20
21
22
23
24
25
# File 'lib/shopify_transporter/shopify/customer.rb', line 18

def columns
  %w(
    first_name last_name email phone accepts_marketing tags
    note tax_exempt company address1 address2 city province
    province_code zip country country_code metafield_namespace
    metafield_key metafield_value metafield_value_type
  ).freeze
end

.headerObject



10
11
12
# File 'lib/shopify_transporter/shopify/customer.rb', line 10

def header
  columns.map(&:titleize).to_csv
end

.keysObject



14
15
16
# File 'lib/shopify_transporter/shopify/customer.rb', line 14

def keys
  %w(email phone).freeze
end

Instance Method Details

#to_csvObject



28
29
30
31
32
33
34
# File 'lib/shopify_transporter/shopify/customer.rb', line 28

def to_csv
  CSV.generate do |csv|
    csv << top_level_row_values
    address_row_values.each { |row| csv << row }
    metafield_row_values.each { |row| csv << row }
  end
end