Class: Heracles::Wrapper::NotificationResponse
- Inherits:
-
Object
- Object
- Heracles::Wrapper::NotificationResponse
- Extended by:
- MethodDecorators
- Defined in:
- lib/heracles-wrapper/notification_response.rb
Instance Attribute Summary collapse
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#job_status ⇒ Object
readonly
Returns the value of attribute job_status.
-
#notification_payload ⇒ Object
readonly
Returns the value of attribute notification_payload.
-
#one_time_notification_key ⇒ Object
readonly
Returns the value of attribute one_time_notification_key.
Instance Method Summary collapse
-
#initialize(raw_params) ⇒ NotificationResponse
constructor
A new instance of NotificationResponse.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to?(method_name) ⇒ Boolean
Constructor Details
#initialize(raw_params) ⇒ NotificationResponse
Returns a new instance of NotificationResponse.
23 24 25 26 27 28 29 |
# File 'lib/heracles-wrapper/notification_response.rb', line 23 def initialize(raw_params) params = HashWithIndifferentAccess.new(raw_params) @notification_payload = HashWithIndifferentAccess.new(params.fetch(:notification_payload)) @job_id = params.fetch(:job_id).to_i @job_status = params.fetch(:job_status).to_sym @one_time_notification_key = params.fetch(:one_time_notification_key, nil) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
31 32 33 34 35 |
# File 'lib/heracles-wrapper/notification_response.rb', line 31 def method_missing(method_name, *args, &block) super rescue NoMethodError @notification_payload.send(method_name, *args, &block) end |
Instance Attribute Details
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
12 13 14 |
# File 'lib/heracles-wrapper/notification_response.rb', line 12 def job_id @job_id end |
#job_status ⇒ Object (readonly)
Returns the value of attribute job_status.
12 13 14 |
# File 'lib/heracles-wrapper/notification_response.rb', line 12 def job_status @job_status end |
#notification_payload ⇒ Object (readonly)
Returns the value of attribute notification_payload.
12 13 14 |
# File 'lib/heracles-wrapper/notification_response.rb', line 12 def notification_payload @notification_payload end |
#one_time_notification_key ⇒ Object (readonly)
Returns the value of attribute one_time_notification_key.
12 13 14 |
# File 'lib/heracles-wrapper/notification_response.rb', line 12 def one_time_notification_key @one_time_notification_key end |
Instance Method Details
#respond_to?(method_name) ⇒ Boolean
37 38 39 |
# File 'lib/heracles-wrapper/notification_response.rb', line 37 def respond_to?(method_name) super || @notification_payload.respond_to?(method_name) end |