Class: Line::Bot::V2::MessagingApi::FlexImage
- Inherits:
-
FlexComponent
- Object
- FlexComponent
- Line::Bot::V2::MessagingApi::FlexImage
- Defined in:
- lib/line/bot/v2/messaging_api/model/flex_image.rb
Overview
Instance Attribute Summary collapse
- #action ⇒ Action?
-
#align ⇒ String?
(‘start’|‘end’|‘center’) Alignment style in horizontal direction.
-
#animated ⇒ Boolean?
When this is ‘true`, an animated image (APNG) plays.
-
#aspect_mode ⇒ String?
(‘fit’|‘cover’) The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match.
-
#aspect_ratio ⇒ String?
Aspect ratio of the image.
-
#background_color ⇒ String?
Background color of the image.
-
#flex ⇒ Integer?
The ratio of the width or height of this component within the parent box.
-
#gravity ⇒ String?
(‘top’|‘bottom’|‘center’) Alignment style in vertical direction.
-
#margin ⇒ String?
The minimum amount of space to include before this component in its parent container.
-
#offset_bottom ⇒ String?
Offset.
-
#offset_end ⇒ String?
Offset.
-
#offset_start ⇒ String?
Offset.
-
#offset_top ⇒ String?
Offset.
-
#position ⇒ String?
(‘relative’|‘absolute’) Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd.
-
#size ⇒ String?
The maximum image width.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ String
Image URL (Max character limit: 2000) Protocol: HTTPS (TLS 1.2 or later) Image format: JPEG or PNG Maximum image size: 1024×1024 pixels Maximum file size: 10 MB (300 KB when the animated property is true).
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::MessagingApi::FlexImage
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:, flex: nil, margin: nil, position: nil, offset_top: nil, offset_bottom: nil, offset_start: nil, offset_end: nil, align: nil, gravity: nil, size: 'md', aspect_ratio: nil, aspect_mode: nil, background_color: nil, action: nil, animated: false, **dynamic_attributes) ⇒ FlexImage
constructor
A new instance of FlexImage.
Constructor Details
#initialize(url:, flex: nil, margin: nil, position: nil, offset_top: nil, offset_bottom: nil, offset_start: nil, offset_end: nil, align: nil, gravity: nil, size: 'md', aspect_ratio: nil, aspect_mode: nil, background_color: nil, action: nil, animated: false, **dynamic_attributes) ⇒ FlexImage
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 86 def initialize( url:, flex: nil, margin: nil, position: nil, offset_top: nil, offset_bottom: nil, offset_start: nil, offset_end: nil, align: nil, gravity: nil, size: 'md', aspect_ratio: nil, aspect_mode: nil, background_color: nil, action: nil, animated: false, **dynamic_attributes ) @type = "image" @url = url @flex = flex @margin = margin @position = position @offset_top = offset_top @offset_bottom = offset_bottom @offset_start = offset_start @offset_end = offset_end @align = align @gravity = gravity @size = size @aspect_ratio = aspect_ratio @aspect_mode = aspect_mode @background_color = background_color @action = action.is_a?(Line::Bot::V2::MessagingApi::Action) || action.nil? ? action : Line::Bot::V2::MessagingApi::Action.create(**action) # steep:ignore @animated = animated 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?
65 66 67 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 65 def action @action end |
#align ⇒ String?
47 48 49 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 47 def align @align end |
#animated ⇒ Boolean?
68 69 70 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 68 def animated @animated end |
#aspect_mode ⇒ String?
59 60 61 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 59 def aspect_mode @aspect_mode end |
#aspect_ratio ⇒ String?
56 57 58 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 56 def aspect_ratio @aspect_ratio end |
#background_color ⇒ String?
62 63 64 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 62 def background_color @background_color end |
#flex ⇒ Integer?
26 27 28 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 26 def flex @flex end |
#gravity ⇒ String?
50 51 52 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 50 def gravity @gravity end |
#margin ⇒ String?
29 30 31 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 29 def margin @margin end |
#offset_bottom ⇒ String?
38 39 40 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 38 def offset_bottom @offset_bottom end |
#offset_end ⇒ String?
44 45 46 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 44 def offset_end @offset_end end |
#offset_start ⇒ String?
41 42 43 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 41 def offset_start @offset_start end |
#offset_top ⇒ String?
35 36 37 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 35 def offset_top @offset_top end |
#position ⇒ String?
32 33 34 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 32 def position @position end |
#size ⇒ String?
53 54 55 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 53 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_image.rb', line 20 def type @type end |
#url ⇒ String
23 24 25 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 23 def url @url end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::MessagingApi::FlexImage
Create an instance of the class from a hash
140 141 142 143 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 140 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
147 148 149 150 151 152 153 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 147 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
156 157 158 |
# File 'lib/line/bot/v2/messaging_api/model/flex_image.rb', line 156 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |