Class: Io::Flow::V0::Clients::Exports
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Exports
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_id(organization, id) ⇒ Object
-
#get(organization, incoming = {}) ⇒ Object
Search exports.
-
#get_by_id(organization, id) ⇒ Object
Get a single export.
-
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each export, including deletion.
-
#initialize(client) ⇒ Exports
constructor
A new instance of Exports.
-
#post(organization, export_form) ⇒ Object
Create an export.
Constructor Details
#initialize(client) ⇒ Exports
Returns a new instance of Exports.
6860 6861 6862 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6860 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
6911 6912 6913 6914 6915 6916 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6911 def delete_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/exports/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
Search exports. Always paginated.
6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6865 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :created_by_user_id => (x = opts.delete(:created_by_user_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('created_by_user_id', x, String)), :discriminator => (x = opts.delete(:discriminator); x.nil? ? nil : HttpClient::Preconditions.assert_class('discriminator', x, String)), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/exports").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Export.new(x) } end |
#get_by_id(organization, id) ⇒ Object
Get a single export.
6904 6905 6906 6907 6908 6909 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6904 def get_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/exports/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::Export.new(r) end |
#get_versions(organization, incoming = {}) ⇒ Object
Provides visibility into recent changes of each export, including deletion.
6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6889 def get_versions(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :export_id => (x = opts.delete(:export_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('export_id', x, Array).map { |v| HttpClient::Preconditions.assert_class('export_id', v, String) }), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "journal_timestamp" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/exports/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ExportVersion.new(x) } end |
#post(organization, export_form) ⇒ Object
Create an export.
6881 6882 6883 6884 6885 6886 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6881 def post(organization, export_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = export_form; x.is_a?(::Io::Flow::V0::Models::ExportForm) ? x : ::Io::Flow::V0::Models::ExportForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/exports").with_json(export_form.to_json).post ::Io::Flow::V0::Models::Export.new(r) end |