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.
6977 6978 6979 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6977 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
7009 7010 7011 7012 7013 7014 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7009 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
6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6981 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
7002 7003 7004 7005 7006 7007 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7002 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
6995 6996 6997 6998 6999 7000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6995 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 |