Skip to content

michelada/ruby-jet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Jet

Build Status CircleCI Dependency Status Gem Version

Jet API service calls implemented in Ruby.

Basic Usage

require 'Jet'

jet_client = Jet.client(merchant_id: 'your_merch_id', api_user: 'your_api_user', secret: 'your_secret')

Products

Jet Products API

Product Attributes

attrs = {
  product_title: 'My Product',
  ASIN:           '12345ABCDE',
  brand:          "My Product's Brand",
  manufacturer:   "My Product's Manufacturer",
  main_image_url: 'https://c2.q-assets.com/images/products/p/asj/asj-077_1z.jpg',
  bullets:        [ 'This is bullet line 1',
                    'This is bullet line 2',
                  ],
  product_description: 'This is a terrific product that everyone should own.',
  multipack_quantity: 1
}

Call products.update_product to add a new product or update an existing one. If the SKU is new, a new product will be created.

response = jet_client.products.update_product('MyNewSku123', attrs)

Retrieve an existing product

product = jet_client.products.get_product('MyNewSku123')

Set the price on a product

response = jet_client.products.update_price('MyNewSku123', price: 30.95)

Update the inventory

response = jet_client.products.update_inventory(
  'MyNewSku123',
  fulfillment_nodes: [
    { fulfillment_node_id: 'node1234', quantity: 100 },
    { fulfillment_node_id: 'node5678', quantity: 20 }
  ]
)

Retrieve Orders

Jet Orders API

get_orders defaults to 'ready' status

response = jet_client.orders.get_orders
ready_orders = response['order_urls']

Retrieve acknowledged orders

response = jet_client.orders.get_orders(:acknowledged)
acknowledged_orders = response['order_urls']

Other status options are:

:created
:ready
:acknowledged
:inprogress
:complete

Retrieve a specific order

order_url = ready_orders.first
order = jet_client.orders.get_order(order_url)

Acknowledge an Order

Jet Acknowledge Order API

jet_order_id = order['merchant_order_id']
response = jet_client.orders.acknowledge_order(
  jet_order_id,
  acknowledgement_status: 'accepted',
  alt_order_id: '232145', # optional
  order_items: [
    { order_item_acknowledgement_status: 'fulfillable',
      order_item_id: 'b81f073b18f548b892f6d4497af16297',
      alt_order_item_id: '554443322' # optional
    }
  ]
)

Mark Order as shipped Jet Ship Order API

response = jet_client.orders.ship_order(
  jet_order_id,
  alt_order_id: '232145', # optional
  shipments: [
    {
      alt_shipment_id: '11223344', #optional
      shipment_tracking_number: '1Z12342452342',
      response_shipment_date: 0.days.from_now,
      response_shipment_method: 'ups_ground',
      expected_delivery_date: 4.days.from_now,
      ship_from_zip_code: '12061',
      carrier_pick_up_date: 1.days.from_now,
      carrier: 'UPS',
      shipment_items: [
        { shipment_item_id: '76-s2507-i1810',
          alt_shipment_item_id: '129900120', # optional
          merchant_sku: 'MyNewSku123',
          response_shipment_sku_quantity: 1
        }
      ]
    }
  ]
)

About

Jet API service calls implemented in Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%