Class: Mingle::Http::NetHttpMingleRpcClient

Inherits:
BitGirder::Core::BitGirderClass show all
Includes:
Codec, Service
Defined in:
lib/mingle/http.rb

Overview

Simple blocking client using ruby builtin http lib

Constant Summary

Constants included from BitGirder::Core::BitGirderMethods

BitGirder::Core::BitGirderMethods::PARAM_TYPE_ARG, BitGirder::Core::BitGirderMethods::PARAM_TYPE_ENVVAR, BitGirder::Core::BitGirderMethods::PARAM_TYPE_KEY

Instance Method Summary collapse

Methods included from BitGirder::Core::BitGirderMethods

argv_to_argh, check_fail_prefix, class_name_to_sym, code, compares_to, console, ext_to_class_name, ext_to_sym, has_env, has_key, has_keys, nonnegative, not_nil, positive, raisef, set_from_key, set_var, split_argv, sym_to_cli_switch, sym_to_ext_id, to_bool, unpack_argv_array, unpack_argv_hash, warn

Methods included from BitGirder::Core::BitGirderStructure

#==, included

Instance Method Details

#call(*argv) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/mingle/http.rb', line 104

def call( *argv )
    
    mv = MingleServices.as_mingle_struct( get_mg_req( argv ) )
    req = create_request( mv )

    resp = 
        Net::HTTP.new( @location.host, @location.port ).start do |http|
            http.request( req )
        end
 
    react( :response_received, resp )

    case resp
        when Net::HTTPOK then as_service_response( resp.body )
        else raise "Got non-OK response: #{resp} (#{resp.body})"
    end
end