Class: Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse
- Inherits:
-
Object
- Object
- Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse
- Defined in:
- lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb,
sig/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rbs
Overview
Summary of impression and click statistics for a rich menu created via the Messaging API.
Instance Attribute Summary collapse
-
#clicks ⇒ Array[GetRichMenuInsightSummaryResponseClick]?
Click metrics for each tappable area of the rich menu.
- #impression ⇒ GetRichMenuInsightSummaryResponseImpression?
-
#metrics_from ⇒ String?
Start date (JST) of the period actually covered by the returned metrics.
-
#metrics_to ⇒ String?
End date (JST) of the period actually covered by the returned metrics.
-
#rich_menu_id ⇒ String
Rich menu ID.
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse
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(rich_menu_id:, metrics_from: nil, metrics_to: nil, impression: nil, clicks: nil, **dynamic_attributes) ⇒ Object constructor
Constructor Details
#initialize(rich_menu_id:, metrics_from: nil, metrics_to: nil, impression: nil, clicks: nil, **dynamic_attributes) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 37 def initialize( rich_menu_id:, metrics_from: nil, metrics_to: nil, impression: nil, clicks: nil, **dynamic_attributes ) @rich_menu_id = @metrics_from = metrics_from @metrics_to = metrics_to @impression = impression.is_a?(Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponseImpression) || impression.nil? ? impression : Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponseImpression.create(**impression) @clicks = clicks&.map do |item| if item.is_a?(Hash) Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponseClick.create(**item) else item end end 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
#clicks ⇒ Array[GetRichMenuInsightSummaryResponseClick]?
Returns Click metrics for each tappable area of the rich menu.
30 31 32 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 30 def clicks @clicks end |
#impression ⇒ GetRichMenuInsightSummaryResponseImpression?
27 28 29 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 27 def impression @impression end |
#metrics_from ⇒ String?
Returns Start date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260213).
21 22 23 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 21 def metrics_from @metrics_from end |
#metrics_to ⇒ String?
Returns End date (JST) of the period actually covered by the returned metrics. Format: yyyyMMdd (e.g. 20260215).
24 25 26 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 24 def metrics_to @metrics_to end |
#rich_menu_id ⇒ String
Returns Rich menu ID.
18 19 20 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 18 def @rich_menu_id end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse
Create an instance of the class from a hash
74 75 76 77 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 74 def self.create(args) symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args) return new(**symbolized_args) # steep:ignore InsufficientKeywordArguments end |
Instance Method Details
#==(other) ⇒ Boolean
Returns true if the objects are equal, false otherwise.
81 82 83 84 85 86 87 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 81 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.
90 91 92 |
# File 'lib/line/bot/v2/insight/model/get_rich_menu_insight_summary_response.rb', line 90 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |