Class: Heracles::Wrapper::NotificationResponse

Inherits:
Object
  • Object
show all
Extended by:
MethodDecorators
Defined in:
lib/heracles-wrapper/notification_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ NotificationResponse

Returns a new instance of NotificationResponse.



22
23
24
25
26
27
# File 'lib/heracles-wrapper/notification_response.rb', line 22

def initialize(params)
  @notification_payload = params.fetch(:notification_payload).to_hash
  @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



29
30
31
32
33
# File 'lib/heracles-wrapper/notification_response.rb', line 29

def method_missing(method_name, *args, &block)
  super
rescue NoMethodError
  @notification_payload.send(method_name, *args, &block)
end

Instance Attribute Details

#job_idObject (readonly)

Returns the value of attribute job_id.



11
12
13
# File 'lib/heracles-wrapper/notification_response.rb', line 11

def job_id
  @job_id
end

#job_statusObject (readonly)

Returns the value of attribute job_status.



11
12
13
# File 'lib/heracles-wrapper/notification_response.rb', line 11

def job_status
  @job_status
end

#notification_payloadObject (readonly)

Returns the value of attribute notification_payload.



11
12
13
# File 'lib/heracles-wrapper/notification_response.rb', line 11

def notification_payload
  @notification_payload
end

#one_time_notification_keyObject (readonly)

Returns the value of attribute one_time_notification_key.



11
12
13
# File 'lib/heracles-wrapper/notification_response.rb', line 11

def one_time_notification_key
  @one_time_notification_key
end

Instance Method Details

#respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/heracles-wrapper/notification_response.rb', line 35

def respond_to?(method_name)
  super || @notification_payload.respond_to?(method_name)
end