# # Autogenerated by Thrift Compiler (2.4.0-upfluence) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # require 'thrift' require 'base/base_service_types' module Base module BaseService SERVICE = 'BaseService'.freeze NAMESPACE = ''.freeze class Client def initialize(client) @client = ::Thrift.build_client(client) end def self.from_provider(provider) Client.new(provider.build(NAMESPACE, SERVICE)) end def greeting(english) result = @client.call_binary( 'greeting', Greeting_args.new(english: english), Greeting_result ) return result.success unless result.success.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result') result end end class Processor include ::Thrift::Processor def self.from_provider(handler, provider) provider.build(NAMESPACE, SERVICE, Processor, handler) end def process_greeting(seqid, iprot, oprot) args = read_args(iprot, Greeting_args) result = @middleware.handle_binary('greeting', args) do |args| result = Greeting_result.new() result.success = @handler.greeting(args.english) result end write_result(result, oprot, 'greeting', seqid) end end # HELPER FUNCTIONS AND STRUCTURES class Greeting_args include ::Thrift::Struct, ::Thrift::Struct_Union NAME = 'greeting_args'.freeze NAMESPACE = ''.freeze THRIFT_FIELD_INDEX_ENGLISH = 1 FIELDS = { THRIFT_FIELD_INDEX_ENGLISH => {type: ::Thrift::Types::BOOL, name: 'english'} } def struct_fields; FIELDS; end def validate end ::Thrift::Struct.generate_accessors self ::Thrift.register_struct_type self end class Greeting_result include ::Thrift::Struct, ::Thrift::Struct_Union NAME = 'greeting_result'.freeze NAMESPACE = ''.freeze THRIFT_FIELD_INDEX_SUCCESS = 0 FIELDS = { THRIFT_FIELD_INDEX_SUCCESS => {type: ::Thrift::Types::STRUCT, name: 'success', class: ::Base::Hello} } def struct_fields; FIELDS; end def validate end ::Thrift::Struct.generate_accessors self ::Thrift.register_struct_type self end ::Thrift.register_service_type(self) end end