Class: OneApm::Support::HTTPClients::CurbRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/one_apm/support/http_clients/curb_wrappers.rb

Instance Method Summary collapse

Constructor Details

#initialize(curlobj) ⇒ CurbRequest

Returns a new instance of CurbRequest.



8
9
10
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 8

def initialize( curlobj )
  @curlobj = curlobj
end

Instance Method Details

#[](key) ⇒ Object



28
29
30
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 28

def []( key )
  @curlobj.headers[ key ]
end

#[]=(key, value) ⇒ Object



32
33
34
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 32

def []=( key, value )
  @curlobj.headers[ key ] = value
end

#bodyObject



44
45
46
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 44

def body
  @curlobj._oa_http_params
end

#hostObject



16
17
18
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 16

def host
  self["host"] || self["Host"] || self.uri.host
end

#methodObject



24
25
26
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 24

def method
  @curlobj._oa_http_verb
end

#paramsObject



52
53
54
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 52

def params
  post_params.merge(query)
end

#portObject



20
21
22
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 20

def port
  self["port"] || self["port"] || self.uri.port
end

#post_paramsObject



48
49
50
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 48

def post_params
  body.nil?? {} :  CGI.parse(body)
end

#queryObject



40
41
42
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 40

def query
  @uri.query.nil?? {} : CGI.parse(@uri.query)
end

#typeObject



12
13
14
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 12

def type
  'Curb'
end

#uriObject



36
37
38
# File 'lib/one_apm/support/http_clients/curb_wrappers.rb', line 36

def uri
  @uri ||= OneApm::Support::HTTPClients::URIUtil.parse_url(@curlobj.url)
end