Class: Line::Bot::V2::MessagingApi::FlexIcon
- Inherits:
-
FlexComponent
- Object
- FlexComponent
- Line::Bot::V2::MessagingApi::FlexIcon
- Defined in:
- lib/line/bot/v2/messaging_api/model/flex_icon.rb
Overview
Instance Attribute Summary collapse
- #aspect_ratio ⇒ String?
- #margin ⇒ String?
- #offset_bottom ⇒ String?
- #offset_end ⇒ String?
- #offset_start ⇒ String?
- #offset_top ⇒ String?
-
#position ⇒ String?
(‘relative’|‘absolute’).
- #scaling ⇒ Boolean?
- #size ⇒ String?
-
#type ⇒ Object
readonly
Returns the value of attribute type.
- #url ⇒ String
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::MessagingApi::FlexIcon
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(url:, size: nil, aspect_ratio: nil, margin: nil, position: nil, offset_top: nil, offset_bottom: nil, offset_start: nil, offset_end: nil, scaling: nil, **dynamic_attributes) ⇒ FlexIcon
constructor
A new instance of FlexIcon.
Constructor Details
#initialize(url:, size: nil, aspect_ratio: nil, margin: nil, position: nil, offset_top: nil, offset_bottom: nil, offset_start: nil, offset_end: nil, scaling: nil, **dynamic_attributes) ⇒ FlexIcon
Returns a new instance of FlexIcon.
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 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 62 def initialize( url:, size: nil, aspect_ratio: nil, margin: nil, position: nil, offset_top: nil, offset_bottom: nil, offset_start: nil, offset_end: nil, scaling: nil, **dynamic_attributes ) @type = "icon" @url = url @size = size @aspect_ratio = aspect_ratio @margin = margin @position = position @offset_top = offset_top @offset_bottom = offset_bottom @offset_start = offset_start @offset_end = offset_end @scaling = scaling 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
#aspect_ratio ⇒ String?
29 30 31 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 29 def aspect_ratio @aspect_ratio end |
#margin ⇒ String?
32 33 34 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 32 def margin @margin end |
#offset_bottom ⇒ String?
41 42 43 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 41 def offset_bottom @offset_bottom end |
#offset_end ⇒ String?
47 48 49 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 47 def offset_end @offset_end end |
#offset_start ⇒ String?
44 45 46 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 44 def offset_start @offset_start end |
#offset_top ⇒ String?
38 39 40 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 38 def offset_top @offset_top end |
#position ⇒ String?
Returns (‘relative’|‘absolute’).
35 36 37 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 35 def position @position end |
#scaling ⇒ Boolean?
50 51 52 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 50 def scaling @scaling end |
#size ⇒ String?
26 27 28 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 26 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
20 21 22 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 20 def type @type end |
#url ⇒ String
23 24 25 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 23 def url @url end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::MessagingApi::FlexIcon
Create an instance of the class from a hash
104 105 106 107 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 104 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.
111 112 113 114 115 116 117 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 111 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.
120 121 122 |
# File 'lib/line/bot/v2/messaging_api/model/flex_icon.rb', line 120 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |