Module: Thrift::Client

### Home Classes Methods

### In Files

- lib/thrift/client.rb

### Methods

- ::new
- #handle_exception
- #receive_message
- #send_message

### Files

- CHANGELOG
- README
- Makefile

### Class/Module Index

Quicksearch

- Thrift
- Thrift::ApplicationException
- Thrift::BaseProtocol
- Thrift::BaseProtocolFactory
- Thrift::BaseServer
- Thrift::BaseServerTransport
- Thrift::BaseTransport
- Thrift::BaseTransportFactory
- Thrift::BinaryProtocol
- Thrift::BinaryProtocolAcceleratedFactory
- Thrift::BinaryProtocolFactory
- Thrift::BufferedTransport
- Thrift::BufferedTransportFactory
- Thrift::Client
- Thrift::CompactProtocol
- Thrift::CompactProtocol::CompactTypes
- Thrift::CompactProtocolFactory
- Thrift::Deserializer
- Thrift::Exception
- Thrift::FramedTransport
- Thrift::FramedTransportFactory
- Thrift::HTTPClientTransport
- Thrift::IOStreamTransport
- Thrift::MemoryBufferTransport
- Thrift::MessageTypes
- Thrift::MongrelHTTPServer
- Thrift::MongrelHTTPServer::Handler
- Thrift::NonblockingServer
- Thrift::Processor
- Thrift::ProtocolException
- Thrift::Serializer
- Thrift::ServerSocket
- Thrift::SimpleServer
- Thrift::Socket
- Thrift::Struct
- Thrift::Struct_Union
- Thrift::ThreadPoolServer
- Thrift::ThreadedServer
- Thrift::TransportException
- Thrift::TransportUtils
- Thrift::TypeError
- Thrift::Types
- Thrift::UNIXServerSocket
- Thrift::UNIXSocket
- Thrift::Union
- Fixnum

No matching classes.

# Thrift::Client

### Public Class Methods

new(iprot, oprot=nil) click to toggle source

    # File lib/thrift/client.rb, line 22
    def initialize(iprot, oprot=nil)
      @iprot = iprot
      @oprot = oprot || iprot
      @seqid = 0
    end

### Public Instance Methods

handle_exception(mtype) click to toggle source

    # File lib/thrift/client.rb, line 53
    def handle_exception(mtype)
      if mtype == MessageTypes::EXCEPTION
        x = ApplicationException.new
        x.read(@iprot)
        @iprot.read_message_end
        raise x
      end
    end

receive_message(result_klass) click to toggle source

    # File lib/thrift/client.rb, line 44
    def receive_message(result_klass)
      fname, mtype, rseqid = @iprot.read_message_begin
      handle_exception(mtype)
      result = result_klass.new
      result.read(@iprot)
      @iprot.read_message_end
      result
    end

send_message(name, args_class, args = {}) click to toggle source

    # File lib/thrift/client.rb, line 28
    def send_message(name, args_class, args = {})
      @oprot.write_message_begin(name, MessageTypes::CALL, @seqid)
      data = args_class.new
      args.each do |k, v|
        data.send("#{k.to_s}=", v)
      end
      begin
        data.write(@oprot)
      rescue StandardError => e
        @oprot.trans.close
        raise e
      end
      @oprot.write_message_end
      @oprot.trans.flush
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.