Class: Models::Consignment

Inherits:
Base
  • Object
show all
Defined in:
lib/models/consignment.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #data

Instance Method Summary collapse

Methods inherited from Base

#base_record, path, #records, schema, stream, subclasses, #transform

Instance Method Details

#extra_recordsObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/models/consignment.rb', line 32

def extra_records
  return [] unless data['deleted_at'].nil?
  products = client.get("consignments/#{data['id']}/products")['data']
  Array(products).flatten.map do |product|
    ConsignmentProduct.new(
      product.merge('consignment_id' => data['id']),
      client
    )
  end
end