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.



4776
4777
4778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4776

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

Instance Method Details

#get(organization) ⇒ Object



4780
4781
4782
4783
4784
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4780

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



4786
4787
4788
4789
4790
4791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4786

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