class Line::Bot::V2::MessagingApi::FlexImage
@see developers.line.biz/en/reference/messaging-api/#f-image
Attributes
@!attribute [rw] action
@return [Action,nil]
@!attribute [rw] align
@return [String,nil] ('start'|'end'|'center') Alignment style in horizontal direction.
@!attribute [rw] animated
@return [Boolean,nil] When this is `true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can't send messages that exceed this limit. This is `false` by default. Animated images larger than 300 KB aren't played back.
@!attribute [rw] aspect_mode
@return [String,nil] ('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.
@!attribute [rw] aspect_ratio
@return [String,nil] Aspect ratio of the image. `{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`.
@!attribute [rw] background_color
@return [String,nil] Background color of the image. Use a hexadecimal color code.
@!attribute [rw] flex
@return [Integer,nil] The ratio of the width or height of this component within the parent box.
@!attribute [rw] gravity
@return [String,nil] ('top'|'bottom'|'center') Alignment style in vertical direction.
@!attribute [rw] margin
@return [String,nil] The minimum amount of space to include before this component in its parent container.
@!attribute [rw] offset_bottom
@return [String,nil] Offset.
@!attribute [rw] offset_end
@return [String,nil] Offset.
@!attribute [rw] offset_start
@return [String,nil] Offset.
@!attribute [rw] offset_top
@return [String,nil] Offset.
@!attribute [rw] position
@return [String,nil] ('relative'|'absolute') Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative.
@!attribute [rw] size
@return [String,nil] The maximum image width. This is md by default.
@!attribute [r] type
@return [String]
@!attribute [rw] url
@return [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)
Public Class Methods
Source
# 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
Create an instance of the class from a hash @param args [Hash] Hash containing all the required attributes @return [Line::Bot::V2::MessagingApi::FlexImage] Instance of the class
Source
# 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
@param 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) @param flex [Integer,nil] The ratio of the width or height of this component within the parent box. @param margin [String,nil] The minimum amount of space to include before this component in its parent container. @param position [String,nil] (‘relative’|‘absolute’) Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: ‘relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative. @param offset_top
[String,nil] Offset. @param offset_bottom
[String,nil] Offset. @param offset_start
[String,nil] Offset. @param offset_end
[String,nil] Offset. @param align [String,nil] (’start’|‘end’|‘center’) Alignment style in horizontal direction. @param gravity [String,nil] (‘top’|‘bottom’|‘center’) Alignment style in vertical direction. @param size [String,nil] The maximum image width. This is md by default. @param aspect_ratio
[String,nil] Aspect ratio of the image. ‘{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`. @param aspect_mode
[String,nil] (’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. @param background_color
[String,nil] Background color of the image. Use a hexadecimal color code. @param action [Action, Hash[Symbol, untyped], nil] @param animated [Boolean,nil] When this is ‘true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can’t send messages that exceed this limit. This is ‘false` by default. Animated images larger than 300 KB aren’t played back.
Public Instance Methods
Source
# 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
@param other [Object] Object to compare @return [Boolean] true if the objects are equal, false otherwise
Source
# 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
@return [Integer] Hash code of the object