Class: FacebookCommerce::FulfillmentApi

Inherits:
Api
  • Object
show all
Defined in:
lib/facebook_commerce.rb

Overview

Instance Attribute Summary

Attributes inherited from Api

#access_token, #cms_id, #logger

Instance Method Summary collapse

Methods inherited from Api

#initialize

Constructor Details

This class inherits a constructor from FacebookCommerce::Api

Instance Method Details

#attach_shipment(order_id, items, tracking_info, external_shipment_id = nil) ⇒ Object

Parameters:

  • order_id (String)

    Facebook order ID

  • items (Array<Hash>)

    Array of item hashes (retailer_id|product_id, quantity)

  • tracking_info (Hash)

    Tracking information (carrier, tracking_number, shipping_method_name)



131
132
133
134
135
136
137
138
139
140
# File 'lib/facebook_commerce.rb', line 131

def attach_shipment(order_id, items, tracking_info, external_shipment_id = nil)
  data = { 
    items: items.to_json,
    tracking_info: tracking_info.to_json,
    idempotency_key: SecureRandom.uuid
  }
  data[:external_shipment_id] = external_shipment_id if external_shipment_id

  post("#{order_id}/shipments", data)
end