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.
5773 5774 5775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5773 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
5805 5806 5807 5808 5809 5810 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5805 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
5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5777 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
5798 5799 5800 5801 5802 5803 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5798 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
5791 5792 5793 5794 5795 5796 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5791 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 |