Class: Airbrake::Request
- Inherits:
-
Object
- Object
- Airbrake::Request
- Includes:
- Grouppable, HashKeyable, Ignorable, Mergeable, Stashable
- Defined in:
- lib/airbrake-ruby/request.rb
Overview
Request holds request data that powers route stats.
Instance Attribute Summary collapse
Attributes included from Ignorable
Instance Method Summary collapse
- #cargo ⇒ Object
- #destination ⇒ Object
-
#initialize(method:, route:, status_code:, timing: nil, time: Time.now) ⇒ Request
constructor
A new instance of Request.
- #to_h ⇒ Object
Methods included from Grouppable
Methods included from Mergeable
Methods included from Stashable
Methods included from Ignorable
Methods included from HashKeyable
Constructor Details
#initialize(method:, route:, status_code:, timing: nil, time: Time.now) ⇒ Request
Returns a new instance of Request.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/airbrake-ruby/request.rb', line 16 def initialize( method:, route:, status_code:, timing: nil, time: Time.now ) @time_utc = TimeTruncate.utc_truncate_minutes(time) @method = method @route = route @status_code = status_code @timing = timing @time = time end |
Instance Attribute Details
#method ⇒ Object
14 15 16 |
# File 'lib/airbrake-ruby/request.rb', line 14 def method @method end |
#route ⇒ Object
14 15 16 |
# File 'lib/airbrake-ruby/request.rb', line 14 def route @route end |
#status_code ⇒ Object
14 15 16 |
# File 'lib/airbrake-ruby/request.rb', line 14 def status_code @status_code end |
#time ⇒ Object
14 15 16 |
# File 'lib/airbrake-ruby/request.rb', line 14 def time @time end |
#timing ⇒ Object
14 15 16 |
# File 'lib/airbrake-ruby/request.rb', line 14 def timing @timing end |
Instance Method Details
#cargo ⇒ Object
35 36 37 |
# File 'lib/airbrake-ruby/request.rb', line 35 def cargo 'routes' end |
#destination ⇒ Object
31 32 33 |
# File 'lib/airbrake-ruby/request.rb', line 31 def destination 'routes-stats' end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/airbrake-ruby/request.rb', line 39 def to_h { 'method' => method, 'route' => route, 'statusCode' => status_code, 'time' => @time_utc, }.delete_if { |_key, val| val.nil? } end |