class Genba::Client::Orders

Public Class Methods

new(client) click to toggle source
# File lib/genba/client/orders.rb, line 6
def initialize(client)
  @client = client
end

Public Instance Methods

get(order_id, headers: {}) click to toggle source

Retrieve an order

# File lib/genba/client/orders.rb, line 19
def get(order_id, headers: {})
  @client.rest_get_with_token("/orders/#{order_id}", {}, headers)
end
get_by_ctid(ctid, headers: {}) click to toggle source

Retrieve and order based on your Client transaction ID

# File lib/genba/client/orders.rb, line 32
def get_by_ctid(ctid, headers: {})
  @client.rest_get_with_token("/orders/ctid/#{ctid}", {}, headers)
end
perform(order_request, headers: {}, options: {}) click to toggle source

Order a product key

# File lib/genba/client/orders.rb, line 11
def perform(order_request, headers: {}, options: {})
  errors = Genba::OrderRequest.new.call(order_request).messages
  raise errors.inspect unless errors.empty?

  @client.rest_post_with_token('/orders', order_request, headers, options)
end
perform_action(order_id, action_request, headers: {}, options: {}) click to toggle source

Perform an action on a product, like ‘Return’

# File lib/genba/client/orders.rb, line 24
def perform_action(order_id, action_request, headers: {}, options: {})
  errors = Genba::ActionRequest.new.call(action_request).messages
  raise errors.inspect unless errors.empty?

  @client.rest_post_with_token("/orders/#{order_id}", action_request, headers)
end