Class: Io::Flow::V0::Models::FtpAccount

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

Overview

The FTP Account is your username and password to access this FTP server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ FtpAccount

Returns a new instance of FtpAccount.



38562
38563
38564
38565
38566
38567
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38562

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:server, :user], 'FtpAccount')
  @server = (x = opts.delete(:server); x.is_a?(::Io::Flow::V0::Models::FtpServer) ? x : ::Io::Flow::V0::Models::FtpServer.new(x))
  @user = (x = opts.delete(:user); x.is_a?(::Io::Flow::V0::Models::FtpUser) ? x : ::Io::Flow::V0::Models::FtpUser.new(x))
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



38560
38561
38562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38560

def server
  @server
end

#userObject (readonly)

Returns the value of attribute user.



38560
38561
38562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38560

def user
  @user
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38573
38574
38575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38573

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

#to_hashObject



38577
38578
38579
38580
38581
38582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38577

def to_hash
  {
    :server => server.to_hash,
    :user => user.to_hash
  }
end

#to_jsonObject



38569
38570
38571
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38569

def to_json
  JSON.dump(to_hash)
end