Class: Snap::Api::Shipments

Inherits:
Object
  • Object
show all
Extended by:
Client
Includes:
HTTParty
Defined in:
lib/snap/api/shipments.rb

Overview

Interact with Snapfulfil’s shipments endpoint.

Class Method Summary collapse

Methods included from Client

client, delete, get, post, put, snoop_for_errors, wrap_response

Class Method Details

.create(options) ⇒ Object



16
17
18
19
# File 'lib/snap/api/shipments.rb', line 16

def self.create(options)
  shipment = Snap::Shipment.new(options)
  client.post('/shipments', body: shipment.to_json)
end

.destroy(id:) ⇒ Object



12
13
14
# File 'lib/snap/api/shipments.rb', line 12

def self.destroy(id:)
  client.delete("/shipments/#{id}")
end

.find(id:) ⇒ Object



8
9
10
# File 'lib/snap/api/shipments.rb', line 8

def self.find(id:)
  client.get("/shipments/#{id}")
end

.modelObject



29
30
31
# File 'lib/snap/api/shipments.rb', line 29

def self.model
  Snap::Shipment
end

.update(options) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/snap/api/shipments.rb', line 21

def self.update(options)
  shipment = Snap::Shipment.new(options)
  client.put(
    "/shipments/#{shipment.ShipmentId}",
    body: shipment.to_json
  )
end