Class: Line::Bot::V2::Webhook::ScenarioResult
- Inherits:
-
Object
- Object
- Line::Bot::V2::Webhook::ScenarioResult
- Defined in:
- lib/line/bot/v2/webhook/model/scenario_result.rb
Overview
Instance Attribute Summary collapse
-
#action_results ⇒ Array[ActionResult]?
Execution result of individual operations specified in action.
-
#ble_notification_payload ⇒ String?
Data contained in notification.
-
#end_time ⇒ Integer
Timestamp for when execution of scenario was completed (milliseconds, LINE app time).
-
#error_reason ⇒ String?
Error reason.
-
#result_code ⇒ String
Scenario execution completion status.
-
#revision ⇒ Integer?
Revision number of the scenario set containing the executed scenario.
-
#scenario_id ⇒ String?
Scenario ID executed.
-
#start_time ⇒ Integer
Timestamp for when execution of scenario action started (milliseconds, LINE app time).
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::Webhook::ScenarioResult
Create an instance of the class from a hash.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
True if the objects are equal, false otherwise.
-
#hash ⇒ Integer
Hash code of the object.
-
#initialize(scenario_id: nil, revision: nil, start_time:, end_time:, result_code:, action_results: nil, ble_notification_payload: nil, error_reason: nil, **dynamic_attributes) ⇒ ScenarioResult
constructor
A new instance of ScenarioResult.
Constructor Details
#initialize(scenario_id: nil, revision: nil, start_time:, end_time:, result_code:, action_results: nil, ble_notification_payload: nil, error_reason: nil, **dynamic_attributes) ⇒ ScenarioResult
Returns a new instance of ScenarioResult.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 49 def initialize( scenario_id: nil, revision: nil, start_time:, end_time:, result_code:, action_results: nil, ble_notification_payload: nil, error_reason: nil, **dynamic_attributes ) @scenario_id = scenario_id @revision = revision @start_time = start_time @end_time = end_time @result_code = result_code @action_results = action_results&.map do |item| if item.is_a?(Hash) Line::Bot::V2::Webhook::ActionResult.create(**item) # steep:ignore InsufficientKeywordArguments else item end end @ble_notification_payload = ble_notification_payload @error_reason = error_reason dynamic_attributes.each do |key, value| self.class.attr_accessor key if value.is_a?(Hash) struct_klass = Struct.new(*value.keys.map(&:to_sym)) struct_values = value.map { |_k, v| v.is_a?(Hash) ? Line::Bot::V2::Utils.hash_to_struct(v) : v } instance_variable_set("@#{key}", struct_klass.new(*struct_values)) else instance_variable_set("@#{key}", value) end end end |
Instance Attribute Details
#action_results ⇒ Array[ActionResult]?
Returns Execution result of individual operations specified in action. Only included when things.result.resultCode is success.
33 34 35 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 33 def action_results @action_results end |
#ble_notification_payload ⇒ String?
Returns Data contained in notification.
36 37 38 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 36 def ble_notification_payload @ble_notification_payload end |
#end_time ⇒ Integer
Returns Timestamp for when execution of scenario was completed (milliseconds, LINE app time).
27 28 29 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 27 def end_time @end_time end |
#error_reason ⇒ String?
Returns Error reason.
39 40 41 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 39 def error_reason @error_reason end |
#result_code ⇒ String
Returns Scenario execution completion status.
30 31 32 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 30 def result_code @result_code end |
#revision ⇒ Integer?
Returns Revision number of the scenario set containing the executed scenario.
21 22 23 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 21 def revision @revision end |
#scenario_id ⇒ String?
Returns Scenario ID executed.
18 19 20 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 18 def scenario_id @scenario_id end |
#start_time ⇒ Integer
Returns Timestamp for when execution of scenario action started (milliseconds, LINE app time).
24 25 26 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 24 def start_time @start_time end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::Webhook::ScenarioResult
Create an instance of the class from a hash
92 93 94 95 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 92 def self.create(args) # steep:ignore symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args) return new(**symbolized_args) # steep:ignore end |
Instance Method Details
#==(other) ⇒ Boolean
Returns true if the objects are equal, false otherwise.
99 100 101 102 103 104 105 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 99 def ==(other) return false unless self.class == other.class instance_variables.all? do |var| instance_variable_get(var) == other.instance_variable_get(var) end end |
#hash ⇒ Integer
Returns Hash code of the object.
108 109 110 |
# File 'lib/line/bot/v2/webhook/model/scenario_result.rb', line 108 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |