Class: OneApm::Support::HTTPClients::ExconHTTPRequest
- Inherits:
-
Object
- Object
- OneApm::Support::HTTPClients::ExconHTTPRequest
- Defined in:
- lib/one_apm/support/http_clients/excon_wrappers.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #body ⇒ Object
- #host ⇒ Object
-
#initialize(datum) ⇒ ExconHTTPRequest
constructor
A new instance of ExconHTTPRequest.
- #method ⇒ Object
- #params ⇒ Object
- #port ⇒ Object
- #post_params ⇒ Object
- #query ⇒ Object
- #type ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(datum) ⇒ ExconHTTPRequest
Returns a new instance of ExconHTTPRequest.
28 29 30 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 28 def initialize(datum) @datum = datum end |
Instance Method Details
#[](key) ⇒ Object
57 58 59 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 57 def [](key) @datum[:headers][key] end |
#[]=(key, value) ⇒ Object
61 62 63 64 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 61 def []=(key, value) @datum[:headers] ||= {} @datum[:headers][key] = value end |
#body ⇒ Object
74 75 76 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 74 def body @datum[:body] end |
#host ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 36 def host if hostname = (self['host'] || self['Host']) hostname.split(':').first else @datum[:host] end end |
#method ⇒ Object
53 54 55 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 53 def method @datum[:method].to_s.upcase end |
#params ⇒ Object
82 83 84 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 82 def params post_params.merge(query) end |
#port ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 44 def port if hostname = (self['host'] || self['Host']) hostname.split(':').last else @datum[:port] end end |
#post_params ⇒ Object
78 79 80 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 78 def post_params body.nil?? {} : CGI.parse(body) end |
#query ⇒ Object
70 71 72 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 70 def query uri.query.nil?? {} : CGI.parse(uri.query) end |
#type ⇒ Object
32 33 34 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 32 def type "Excon" end |
#uri ⇒ Object
66 67 68 |
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 66 def uri URI.parse("#{@datum[:scheme]}://#{@datum[:host]}:#{@datum[:port]}#{@datum[:path]}") end |