Class: Io::Flow::V0::Clients::ImportTemplates

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ImportTemplates

Returns a new instance of ImportTemplates.



5477
5478
5479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5477

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

Instance Method Details

#get(organization) ⇒ Object



5481
5482
5483
5484
5485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5481

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

#post(organization, import_template_form) ⇒ Object



5487
5488
5489
5490
5491
5492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5487

def post(organization, import_template_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = import_template_form; x.is_a?(::Io::Flow::V0::Models::ImportTemplateForm) ? x : ::Io::Flow::V0::Models::ImportTemplateForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/import/templates").with_json(import_template_form.to_json).post
  ::Io::Flow::V0::Models::ImportTemplateExample.new(r)
end