Class: Cosmo::API::Job
- Inherits:
-
Object
- Object
- Cosmo::API::Job
- Defined in:
- lib/cosmo/api/job.rb,
sig/cosmo/api/job.rbs
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#stream ⇒ ::String
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #data ⇒ Hash[Symbol, untyped]?
- #execute_at ⇒ ::Integer?
- #headers ⇒ Hash[::String, ::String]?
-
#initialize(stream, message) ⇒ Job
constructor
A new instance of Job.
- #seq ⇒ ::Integer, ::String
- #subject ⇒ ::String
- #timestamp ⇒ ::String?
- #x_stream ⇒ ::String?
- #x_subject ⇒ ::String?
Constructor Details
#initialize(stream, message) ⇒ Job
Returns a new instance of Job.
8 9 10 11 |
# File 'lib/cosmo/api/job.rb', line 8 def initialize(stream, ) @stream = stream @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/cosmo/api/job.rb', line 6 def @message end |
#stream ⇒ ::String (readonly)
Returns the value of attribute stream.
6 7 8 |
# File 'lib/cosmo/api/job.rb', line 6 def stream @stream end |
Instance Method Details
#data ⇒ Hash[Symbol, untyped]?
13 14 15 |
# File 'lib/cosmo/api/job.rb', line 13 def data @data ||= Utils::Json.parse(@message.data) end |
#execute_at ⇒ ::Integer?
25 26 27 |
# File 'lib/cosmo/api/job.rb', line 25 def execute_at headers&.dig("X-Execute-At")&.to_i end |
#headers ⇒ Hash[::String, ::String]?
21 22 23 |
# File 'lib/cosmo/api/job.rb', line 21 def headers @message.headers end |
#seq ⇒ ::Integer, ::String
17 18 19 |
# File 'lib/cosmo/api/job.rb', line 17 def seq @message.seq end |
#subject ⇒ ::String
37 38 39 |
# File 'lib/cosmo/api/job.rb', line 37 def subject @message.subject end |
#timestamp ⇒ ::String?
41 42 43 |
# File 'lib/cosmo/api/job.rb', line 41 def headers&.dig("Nats-Time-Stamp") end |
#x_stream ⇒ ::String?
29 30 31 |
# File 'lib/cosmo/api/job.rb', line 29 def x_stream headers&.dig("X-Stream") end |
#x_subject ⇒ ::String?
33 34 35 |
# File 'lib/cosmo/api/job.rb', line 33 def x_subject headers&.dig("X-Subject") end |