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.



7196
7197
7198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7196

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

Instance Method Details

#get(organization) ⇒ Object



7200
7201
7202
7203
7204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7200

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



7206
7207
7208
7209
7210
7211
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7206

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