# # Autogenerated by Thrift Compiler (0.9.2) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING #
require 'thrift' require '<%= @app_name %>_types'
module Thrift
module <%= @app_name.capitalize %> class Client include ::Thrift::Client def ping() send_ping() return recv_ping() end def send_ping() send_message('ping', Ping_args) end def recv_ping() result = receive_message(Ping_result) return result.success unless result.success.nil? raise result.failure unless result.failure.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'ping failed: unknown result') end end class Processor include ::Thrift::Processor def process_ping(seqid, iprot, oprot) args = read_args(iprot, Ping_args) result = Ping_result.new() begin result.success = @handler.ping() rescue ::Thrift::OperationFailed => failure result.failure = failure end write_result(result, oprot, 'ping', seqid) end end # HELPER FUNCTIONS AND STRUCTURES class Ping_args include ::Thrift::Struct, ::Thrift::Struct_Union FIELDS = { } def struct_fields; FIELDS; end def validate end ::Thrift::Struct.generate_accessors self end class Ping_result include ::Thrift::Struct, ::Thrift::Struct_Union SUCCESS = 0 FAILURE = 1 FIELDS = { SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, FAILURE => {:type => ::Thrift::Types::STRUCT, :name => 'failure', :class => ::Thrift::OperationFailed} } def struct_fields; FIELDS; end def validate end ::Thrift::Struct.generate_accessors self end end
end