Class: Io::Flow::V0::Clients::FtpFiles
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::FtpFiles
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_id(organization, id) ⇒ Object
- #get(organization, incoming = {}) ⇒ Object
- #get_by_id(organization, id) ⇒ Object
-
#initialize(client) ⇒ FtpFiles
constructor
A new instance of FtpFiles.
- #post(organization, ftp_file_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ FtpFiles
Returns a new instance of FtpFiles.
6132 6133 6134 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6132 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
6164 6165 6166 6167 6168 6169 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6164 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)}/ftp/files/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6136 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) }), :name => (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', 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? ? "name" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/ftp/files").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::FtpFile.new(x) } end |
#get_by_id(organization, id) ⇒ Object
6157 6158 6159 6160 6161 6162 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6157 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)}/ftp/files/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::FtpFile.new(r) end |
#post(organization, ftp_file_form) ⇒ Object
6150 6151 6152 6153 6154 6155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6150 def post(organization, ftp_file_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = ftp_file_form; x.is_a?(::Io::Flow::V0::Models::FtpFileForm) ? x : ::Io::Flow::V0::Models::FtpFileForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/ftp/files").with_json(ftp_file_form.to_json).post ::Io::Flow::V0::Models::FtpFile.new(r) end |