Class: Hprose::HttpClient
Constant Summary
Constants included from ResultMode
ResultMode::Normal, ResultMode::Raw, ResultMode::RawWithEndTag, ResultMode::Serialized
Constants included from Tags
Tags::TagArgument, Tags::TagBytes, Tags::TagCall, Tags::TagClass, Tags::TagClosebrace, Tags::TagDate, Tags::TagDouble, Tags::TagEmpty, Tags::TagEnd, Tags::TagError, Tags::TagFalse, Tags::TagFunctions, Tags::TagGuid, Tags::TagInfinity, Tags::TagInteger, Tags::TagList, Tags::TagLong, Tags::TagMap, Tags::TagNaN, Tags::TagNeg, Tags::TagNine, Tags::TagNull, Tags::TagObject, Tags::TagOpenbrace, Tags::TagPoint, Tags::TagPos, Tags::TagQuote, Tags::TagRef, Tags::TagResult, Tags::TagSemicolon, Tags::TagString, Tags::TagTime, Tags::TagTrue, Tags::TagUTC, Tags::TagUTF8Char, Tags::TagZero
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#keepalive ⇒ Object
Returns the value of attribute keepalive.
-
#keepalive_timeout ⇒ Object
Returns the value of attribute keepalive_timeout.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Attributes inherited from Client
Instance Method Summary collapse
-
#initialize(uri = nil) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #proxy=(proxy) ⇒ Object
Methods inherited from Client
#[], __new__, #add_filter, #filter, #filter=, inherited, #invoke, new, #onerror, #onerror=, #remove_filter, #use_service
Constructor Details
#initialize(uri = nil) ⇒ HttpClient
Returns a new instance of HttpClient.
30 31 32 33 34 35 36 37 38 |
# File 'lib/hprose/httpclient.rb', line 30 def initialize(uri = nil) super Net::HTTP.version_1_2 @http = Net::HTTP @header = {} @timeout = 30 @keepalive = true @keepalive_timeout = 300 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Hprose::Client
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
39 40 41 |
# File 'lib/hprose/httpclient.rb', line 39 def header @header end |
#keepalive ⇒ Object
Returns the value of attribute keepalive.
40 41 42 |
# File 'lib/hprose/httpclient.rb', line 40 def keepalive @keepalive end |
#keepalive_timeout ⇒ Object
Returns the value of attribute keepalive_timeout.
40 41 42 |
# File 'lib/hprose/httpclient.rb', line 40 def keepalive_timeout @keepalive_timeout end |
#timeout ⇒ Object
Returns the value of attribute timeout.
40 41 42 |
# File 'lib/hprose/httpclient.rb', line 40 def timeout @timeout end |
Instance Method Details
#proxy=(proxy) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hprose/httpclient.rb', line 41 def proxy=(proxy) @http = case proxy when Net::HTTP then proxy when String then uri = URI.parse(proxy) Net::HTTP::Proxy(uri.host, uri.port, uri.user, uri.password) else proxy.superclass == Net::HTTP ? proxy : Net::HTTP end end |