Class: Line::Bot::V2::MessagingApi::FlexBubble
- Inherits:
-
FlexContainer
- Object
- FlexContainer
- Line::Bot::V2::MessagingApi::FlexBubble
- Defined in:
- lib/line/bot/v2/messaging_api/model/flex_bubble.rb
Instance Attribute Summary collapse
- #action ⇒ Action?
- #body ⇒ FlexBox?
-
#direction ⇒ String?
(‘ltr’|‘rtl’).
- #footer ⇒ FlexBox?
- #header ⇒ FlexBox?
- #hero ⇒ FlexComponent?
-
#size ⇒ String?
(‘nano’|‘micro’|‘deca’|‘hecto’|‘kilo’|‘mega’|‘giga’).
- #styles ⇒ FlexBubbleStyles?
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::MessagingApi::FlexBubble
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(direction: nil, styles: nil, header: nil, hero: nil, body: nil, footer: nil, size: nil, action: nil, **dynamic_attributes) ⇒ FlexBubble
constructor
A new instance of FlexBubble.
Constructor Details
#initialize(direction: nil, styles: nil, header: nil, hero: nil, body: nil, footer: nil, size: nil, action: nil, **dynamic_attributes) ⇒ FlexBubble
Returns a new instance of FlexBubble.
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 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 53 def initialize( direction: nil, styles: nil, header: nil, hero: nil, body: nil, footer: nil, size: nil, action: nil, **dynamic_attributes ) @type = "bubble" @direction = direction @styles = styles.is_a?(Line::Bot::V2::MessagingApi::FlexBubbleStyles) || styles.nil? ? styles : Line::Bot::V2::MessagingApi::FlexBubbleStyles.create(**styles) # steep:ignore @header = header.is_a?(Line::Bot::V2::MessagingApi::FlexBox) || header.nil? ? header : Line::Bot::V2::MessagingApi::FlexBox.create(**header) # steep:ignore @hero = hero.is_a?(Line::Bot::V2::MessagingApi::FlexComponent) || hero.nil? ? hero : Line::Bot::V2::MessagingApi::FlexComponent.create(**hero) # steep:ignore @body = body.is_a?(Line::Bot::V2::MessagingApi::FlexBox) || body.nil? ? body : Line::Bot::V2::MessagingApi::FlexBox.create(**body) # steep:ignore @footer = .is_a?(Line::Bot::V2::MessagingApi::FlexBox) || .nil? ? : Line::Bot::V2::MessagingApi::FlexBox.create(**) # steep:ignore @size = size @action = action.is_a?(Line::Bot::V2::MessagingApi::Action) || action.nil? ? action : Line::Bot::V2::MessagingApi::Action.create(**action) # steep:ignore 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 ⇒ Action?
43 44 45 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 43 def action @action end |
#body ⇒ FlexBox?
34 35 36 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 34 def body @body end |
#direction ⇒ String?
Returns (‘ltr’|‘rtl’).
22 23 24 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 22 def direction @direction end |
#footer ⇒ FlexBox?
37 38 39 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 37 def @footer end |
#header ⇒ FlexBox?
28 29 30 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 28 def header @header end |
#hero ⇒ FlexComponent?
31 32 33 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 31 def hero @hero end |
#size ⇒ String?
Returns (‘nano’|‘micro’|‘deca’|‘hecto’|‘kilo’|‘mega’|‘giga’).
40 41 42 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 40 def size @size end |
#styles ⇒ FlexBubbleStyles?
25 26 27 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 25 def styles @styles end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
19 20 21 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 19 def type @type end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::MessagingApi::FlexBubble
Create an instance of the class from a hash
91 92 93 94 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 91 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.
98 99 100 101 102 103 104 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 98 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.
107 108 109 |
# File 'lib/line/bot/v2/messaging_api/model/flex_bubble.rb', line 107 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |