Class: ShopifyTransporter::Shopify::Order
- Extended by:
- AttributesHelpers
- Defined in:
- lib/shopify_transporter/shopify/order.rb
Constant Summary
Constants inherited from Record
Record::METAFIELD_ATTRIBUTES, Record::METAFIELD_PREFIX
Class Method Summary collapse
Instance Method Summary collapse
Methods included from AttributesHelpers
add_prefix, attributes_present?, delete_empty_attributes, drop_prefix, map_from_key_to_val, normalize_keys, normalize_string, rename_fields, shopify_metafield_hash
Methods inherited from Record
has_values?, #initialize, #metafield_row_values
Constructor Details
This class inherits a constructor from ShopifyTransporter::Shopify::Record
Class Method Details
.columns ⇒ Object
40 41 42 43 44 |
# File 'lib/shopify_transporter/shopify/order.rb', line 40 def columns @columns ||= header.split(',').map do |header_column| normalize_string(header_column) end end |
.header ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/shopify_transporter/shopify/order.rb', line 13 def header [ 'Name', 'Email', 'Financial Status', 'Fulfillment Status', 'Currency', 'Buyer Accepts Marketing', 'Cancel Reason', 'Cancelled At', 'Closed At', 'Tags', 'Note', 'Phone', 'Referring Site', 'Processed At', 'Source name', 'Total weight', 'Total Tax', 'Shipping Company', 'Shipping Name', 'Shipping Phone', 'Shipping First Name', 'Shipping Last Name', 'Shipping Address1', 'Shipping Address2', 'Shipping City', 'Shipping Province', 'Shipping Province Code', 'Shipping Zip', 'Shipping Country', 'Shipping Country Code', 'Billing Company', 'Billing Name', 'Billing Phone', 'Billing First Name', 'Billing Last Name', 'Billing Address1', 'Billing Address2', 'Billing City', 'Billing Province', 'Billing Province Code', 'Billing Zip', 'Billing Country', 'Billing Country Code', 'Lineitem name', 'Lineitem quantity', 'Lineitem price', 'Lineitem sku', 'Lineitem requires shipping', 'Lineitem taxable', 'Lineitem fulfillment status', 'Tax 1 Title', 'Tax 1 Price', 'Tax 1 Rate', 'Tax 2 Title', 'Tax 2 Price', 'Tax 2 Rate', 'Tax 3 Title', 'Tax 3 Price', 'Tax 3 Rate', 'Transaction amount', 'Transaction kind', 'Transaction status', 'Shipping line code', 'Shipping line price', 'Shipping line title', 'Shipping line carrier identifier', 'Shipping Tax Price', 'Discount code', 'Discount amount', 'Discount type', 'Metafield Namespace', 'Metafield Key', 'Metafield Value', 'Metafield Value Type' ].to_csv end |
.keys ⇒ Object
36 37 38 |
# File 'lib/shopify_transporter/shopify/order.rb', line 36 def keys %w(name).freeze end |
Instance Method Details
#to_csv ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/shopify_transporter/shopify/order.rb', line 47 def to_csv CSV.generate do |csv| csv << top_level_row_values line_item_row_values.each { |row| csv << row } transaction_row_values.each { |row| csv << row } shipping_line_row_values.each { |row| csv << row } discount_row_values.each { |row| csv << row } .each { |row| csv << row } end end |