Code Monkey home page Code Monkey logo

ruby-jet's Introduction

Ruby Jet

Build Status CircleCI Dependency Status Code Climate Test Coverage 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
                                }
                              ]
                          }
                        ]
                      )

ruby-jet's People

Contributors

jasonwells avatar mike-ball avatar nbarthel avatar cotsog avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.