Sha256: d72dcc5e1a9cfb90a387a7cb543848ba79246823afb13fc20430f04ba04cc68b

Contents?: true

Size: 738 Bytes

Versions: 21

Compression:

Stored size: 738 Bytes

Contents

require 'super_formatter/import'
require 'super_formatter/shopline/head'
require 'super_formatter/shopline/row'
require 'super_formatter/shopline/order'
module SuperFormatter
  module Shopline
    class Import < ::SuperFormatter::Import

      callable do
        build_rows!(Head, Row)

        self.orders = merged_orders!.values

        self.orders
      end

      protected

      def merged_orders!
        array = {}
        rows.each do |row|
          if array[row.order_id].present?
            # 存在 Merge Item
            array[row.order_id].merge!(row)
          else
            # 不存在建立 Order
            array[row.order_id] = Order.new(row)
          end
        end
        array
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
super_tools-2.1.0 lib/super_formatter/shopline/import.rb
super_tools-0.0.26 lib/super_formatter/shopline/import.rb
super_tools-0.0.25 lib/super_formatter/shopline/import.rb
super_tools-0.0.21 lib/super_formatter/shopline/import.rb
super_tools-0.0.20 lib/super_formatter/shopline/import.rb
super_tools-0.0.17 lib/super_formatter/shopline/import.rb
super_tools-0.0.15 lib/super_formatter/shopline/import.rb
super_tools-0.0.14 lib/super_formatter/shopline/import.rb
super_tools-0.0.13 lib/super_formatter/shopline/import.rb
super_tools-0.0.12 lib/super_formatter/shopline/import.rb
super_tools-0.0.11 lib/super_formatter/shopline/import.rb
super_tools-0.0.10 lib/super_formatter/shopline/import.rb
super_tools-0.0.9 lib/super_formatter/shopline/import.rb
super_tools-0.0.8 lib/super_formatter/shopline/import.rb
super_tools-0.0.7 lib/super_formatter/shopline/import.rb
super_tools-0.0.6 lib/super_formatter/shopline/import.rb
super_tools-0.0.5 lib/super_formatter/shopline/import.rb
super_tools-0.0.4 lib/super_formatter/shopline/import.rb
super_tools-0.0.3 lib/super_formatter/shopline/import.rb
super_tools-0.0.2 lib/super_formatter/shopline/import.rb