Class: Net::SFTP::Response

### Home Classes Methods

### In Files

- lib/net/sftp/response.rb

### Parent

Object

### Methods

- #[]
- #eof?
- #ok?
- #to_s
- #to_str

### Included Modules

- Net::SFTP::Constants::StatusCodes

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Net
- Net::SFTP
- Net::SFTP::Constants
- Net::SFTP::Constants::ACE
- Net::SFTP::Constants::ACE::Flag
- Net::SFTP::Constants::ACE::Mask
- Net::SFTP::Constants::ACE::Type
- Net::SFTP::Constants::LockTypes
- Net::SFTP::Constants::OpenFlags
- Net::SFTP::Constants::OpenFlags::FV1
- Net::SFTP::Constants::OpenFlags::FV5
- Net::SFTP::Constants::OpenFlags::FV6
- Net::SFTP::Constants::PacketTypes
- Net::SFTP::Constants::RenameFlags
- Net::SFTP::Constants::StatusCodes
- Net::SFTP::Exception
- Net::SFTP::Operations
- Net::SFTP::Operations::Dir
- Net::SFTP::Operations::Download
- Net::SFTP::Operations::File
- Net::SFTP::Operations::FileFactory
- Net::SFTP::Operations::Upload
- Net::SFTP::Packet
- Net::SFTP::Protocol
- Net::SFTP::Protocol::Base
- Net::SFTP::Protocol::V01
- Net::SFTP::Protocol::V01::Attributes
- Net::SFTP::Protocol::V01::Base
- Net::SFTP::Protocol::V01::Name
- Net::SFTP::Protocol::V02
- Net::SFTP::Protocol::V02::Base
- Net::SFTP::Protocol::V03
- Net::SFTP::Protocol::V03::Base
- Net::SFTP::Protocol::V04
- Net::SFTP::Protocol::V04::Attributes
- Net::SFTP::Protocol::V04::Base
- Net::SFTP::Protocol::V04::Name
- Net::SFTP::Protocol::V05
- Net::SFTP::Protocol::V05::Base
- Net::SFTP::Protocol::V06
- Net::SFTP::Protocol::V06::Attributes
- Net::SFTP::Protocol::V06::Base
- Net::SFTP::Request
- Net::SFTP::Response
- Net::SFTP::Session
- Net::SFTP::StatusException
- Net::SFTP::Version
- Net::SSH
- Net::SSH::Connection
- Net::SSH::Connection::Session

No matching classes.

# Net::SFTP::Response

Encapsulates a response from the remote server, to a specific client request. Response objects are passed as parameters to callbacks when you are performing asynchronous operations; when you call Net::SFTP::Request#wait, you can get the corresponding response object via Net::SFTP::Request#response.

    sftp.open("/path/to/file") do |response|
      p response.ok?
      p response[:handle]
    end

    sftp.loop

### Constants

MAP

### Attributes

code[R]

The numeric code, one of the FX_* constants

data[R]

A hash of request-specific data, such as a file handle or attribute information

message[R]

The textual message for this response (possibly blank)

request[R]

The request object that this object is in response to

### Public Instance Methods

[](key) click to toggle source

Retrieve the data item with the given `key`. The key is converted to a symbol before being used to lookup the value.

    # File lib/net/sftp/response.rb, line 41
    def [](key)
      data[key.to_sym]
    end

eof?() click to toggle source

Returns `true` if the status code is FX_EOF; `false` otherwise.

    # File lib/net/sftp/response.rb, line 63
    def eof?
      code == FX_EOF
    end

ok?() click to toggle source

Returns `true` if the status code is FX_OK; `false` otherwise.

    # File lib/net/sftp/response.rb, line 58
    def ok?
      code == FX_OK
    end

to_s() click to toggle source

Returns a textual description of this response, including the status code and name.

    # File lib/net/sftp/response.rb, line 47
    def to_s
      if message && !message.empty? && message.downcase != MAP[code]
        "#{message} (#{MAP[code]}, #{code})"
      else
        "#{MAP[code]} (#{code})"
      end
    end

Also aliased as: to_str
to_str() click to toggle source
Alias for: to_s

[Validate]

Generated with the Darkfish Rdoc Generator 2.