Class: TingYun::Agent::Transaction::RequestAttributes
- Inherits:
-
Object
- Object
- TingYun::Agent::Transaction::RequestAttributes
- Defined in:
- lib/ting_yun/agent/transaction/request_attributes.rb
Constant Summary collapse
- HTTP_ACCEPT_HEADER_KEY =
'HTTP_ACCEPT'.freeze
Instance Attribute Summary collapse
-
#accept ⇒ Object
readonly
Returns the value of attribute accept.
-
#content_length ⇒ Object
readonly
Returns the value of attribute content_length.
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#referer ⇒ Object
readonly
Returns the value of attribute referer.
-
#request_method ⇒ Object
readonly
Returns the value of attribute request_method.
-
#request_path ⇒ Object
readonly
Returns the value of attribute request_path.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #assign_agent_attributes(attributes) ⇒ Object
-
#initialize(request) ⇒ RequestAttributes
constructor
A new instance of RequestAttributes.
Constructor Details
#initialize(request) ⇒ RequestAttributes
Returns a new instance of RequestAttributes.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 15 def initialize request @header = request.env @request_path = path_from_request request @referer = referer_from_request request @accept = attribute_from_env request, HTTP_ACCEPT_HEADER_KEY @content_length = content_length_from_request request @host = attribute_from_request request, :host @port = port_from_request request @user_agent = attribute_from_request request, :user_agent @request_method = attribute_from_request request, :request_method @cookie = (request) end |
Instance Attribute Details
#accept ⇒ Object (readonly)
Returns the value of attribute accept.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def accept @accept end |
#content_length ⇒ Object (readonly)
Returns the value of attribute content_length.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def content_length @content_length end |
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def @cookie end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def header @header end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def port @port end |
#referer ⇒ Object (readonly)
Returns the value of attribute referer.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def referer @referer end |
#request_method ⇒ Object (readonly)
Returns the value of attribute request_method.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def request_method @request_method end |
#request_path ⇒ Object (readonly)
Returns the value of attribute request_path.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def request_path @request_path end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
10 11 12 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 10 def user_agent @user_agent end |
Instance Method Details
#assign_agent_attributes(attributes) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ting_yun/agent/transaction/request_attributes.rb', line 28 def assign_agent_attributes(attributes) attributes.add_agent_attribute :request_path, request_path attributes.add_agent_attribute :referer, referer attributes.add_agent_attribute :accept, accept attributes.add_agent_attribute :contentLength, content_length attributes.add_agent_attribute :host, host attributes.add_agent_attribute :port, port attributes.add_agent_attribute :userAgent, user_agent attributes.add_agent_attribute :method, request_method end |