Class: Io::Flow::V0::Models::FtpFile

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

The FTP File represents a file uploaded to the FTP Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ FtpFile

Returns a new instance of FtpFile.



33686
33687
33688
33689
33690
33691
33692
33693
33694
33695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33686

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :source, :name, :directory, :url, :created_at], 'FtpFile')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @source = (x = opts.delete(:source); x.is_a?(::Io::Flow::V0::Models::FtpFileSource) ? x : ::Io::Flow::V0::Models::FtpFileSource.apply(x))
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @directory = HttpClient::Preconditions.assert_class('directory', opts.delete(:directory), String)
  @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String)
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



33684
33685
33686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33684

def created_at
  @created_at
end

#directoryObject (readonly)

Returns the value of attribute directory.



33684
33685
33686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33684

def directory
  @directory
end

#idObject (readonly)

Returns the value of attribute id.



33684
33685
33686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33684

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



33684
33685
33686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33684

def name
  @name
end

#sourceObject (readonly)

Returns the value of attribute source.



33684
33685
33686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33684

def source
  @source
end

#urlObject (readonly)

Returns the value of attribute url.



33684
33685
33686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33684

def url
  @url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



33701
33702
33703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33701

def copy(incoming={})
  FtpFile.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



33705
33706
33707
33708
33709
33710
33711
33712
33713
33714
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33705

def to_hash
  {
    :id => id,
    :source => source.value,
    :name => name,
    :directory => directory,
    :url => url,
    :created_at => created_at
  }
end

#to_jsonObject



33697
33698
33699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33697

def to_json
  JSON.dump(to_hash)
end