Class: Io::Flow::V0::Clients::Fulfillments

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Fulfillments

Returns a new instance of Fulfillments.



7090
7091
7092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7090

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get(organization, number) ⇒ Object



7094
7095
7096
7097
7098
7099
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7094

def get(organization, number)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('number', number, String)
  r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/fulfillments").get
  r.map { |x| ::Io::Flow::V0::Models::Fulfillment.new(x) }
end

#put_cancellations(organization, number, fulfillment_cancellation_form) ⇒ Object



7101
7102
7103
7104
7105
7106
7107
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7101

def put_cancellations(organization, number, fulfillment_cancellation_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('number', number, String)
  (x = fulfillment_cancellation_form; x.is_a?(::Io::Flow::V0::Models::FulfillmentCancellationForm) ? x : ::Io::Flow::V0::Models::FulfillmentCancellationForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/fulfillments/cancellations").with_json(fulfillment_cancellation_form.to_json).put
  ::Io::Flow::V0::Models::Fulfillment.new(r)
end

#put_complete_and_cancellations(organization, number, fulfillment_complete_cancellation_form) ⇒ Object



7109
7110
7111
7112
7113
7114
7115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7109

def put_complete_and_cancellations(organization, number, fulfillment_complete_cancellation_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('number', number, String)
  (x = fulfillment_complete_cancellation_form; x.is_a?(::Io::Flow::V0::Models::FulfillmentCompleteCancellationForm) ? x : ::Io::Flow::V0::Models::FulfillmentCompleteCancellationForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/fulfillments/complete/cancellations").with_json(fulfillment_complete_cancellation_form.to_json).put
  ::Io::Flow::V0::Models::Fulfillment.new(r)
end