Class: Io::Flow::V0::Clients::ImportTemplates
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ImportTemplates
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #get(organization) ⇒ Object
-
#initialize(client) ⇒ ImportTemplates
constructor
A new instance of ImportTemplates.
- #post(organization, import_template_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ ImportTemplates
Returns a new instance of ImportTemplates.
6469 6470 6471 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6469 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization) ⇒ Object
6473 6474 6475 6476 6477 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6473 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
6479 6480 6481 6482 6483 6484 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6479 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 |