Class: Zernio::GetInboxConversationMessages200ResponseMessagesInnerAttachmentsInner

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ GetInboxConversationMessages200ResponseMessagesInnerAttachmentsInner

Initializes the object

Parameters:

  • (defaults to: {})

    Model attributes in the form of hash



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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 109

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetInboxConversationMessages200ResponseMessagesInnerAttachmentsInner` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetInboxConversationMessages200ResponseMessagesInnerAttachmentsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'original_type')
    self.original_type = attributes[:'original_type']
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.key?(:'refresh_url')
    self.refresh_url = attributes[:'refresh_url']
  end

  if attributes.key?(:'filename')
    self.filename = attributes[:'filename']
  end

  if attributes.key?(:'preview_url')
    self.preview_url = attributes[:'preview_url']
  end

  if attributes.key?(:'payload')
    if (value = attributes[:'payload']).is_a?(Hash)
      self.payload = value
    end
  end
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



31
32
33
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 31

def filename
  @filename
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 18

def id
  @id
end

#original_typeObject

Instagram and Facebook only, and present only when it differs from type. Meta's own type before normalization: ig_reel and reel become video, while ig_post, post, ig_story and story_mention become share. A story mention is type: \"share\" with originalType: \"story_mention\"; render on this field, since share alone is ambiguous.



23
24
25
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 23

def original_type
  @original_type
end

#payloadObject

Template content (title, subtitle, image, buttons) when type is template



36
37
38
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 36

def payload
  @payload
end

#preview_urlObject

Returns the value of attribute preview_url.



33
34
35
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 33

def preview_url
  @preview_url
end

#refresh_urlObject

Instagram and Facebook only. Endpoint that resolves this attachment to a working url every time, re-minting it from Meta when the stored one has expired. Safe to store and render indefinitely.



29
30
31
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 29

def refresh_url
  @refresh_url
end

#typeObject

Returns the value of attribute type.



20
21
22
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 20

def type
  @type
end

#urlObject

Direct media link. On Instagram and Facebook this is a signed Meta CDN url that EXPIRES: use it now, do not store it. Persist refreshUrl instead.



26
27
28
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 26

def url
  @url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



75
76
77
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 75

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



80
81
82
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 80

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 61

def self.attribute_map
  {
    :'id' => :'id',
    :'type' => :'type',
    :'original_type' => :'originalType',
    :'url' => :'url',
    :'refresh_url' => :'refreshUrl',
    :'filename' => :'filename',
    :'preview_url' => :'previewUrl',
    :'payload' => :'payload'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • Model attributes in the form of hash

Returns:

  • Returns the model itself



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 215

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



99
100
101
102
103
104
105
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 99

def self.openapi_nullable
  Set.new([
    :'refresh_url',
    :'filename',
    :'preview_url',
  ])
end

.openapi_typesObject

Attribute type mapping.



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 85

def self.openapi_types
  {
    :'id' => :'String',
    :'type' => :'String',
    :'original_type' => :'String',
    :'url' => :'String',
    :'refresh_url' => :'String',
    :'filename' => :'String',
    :'preview_url' => :'String',
    :'payload' => :'Hash<String, Object>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • to be compared



187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 187

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      type == o.type &&
      original_type == o.original_type &&
      url == o.url &&
      refresh_url == o.refresh_url &&
      filename == o.filename &&
      preview_url == o.preview_url &&
      payload == o.payload
end

#eql?(o) ⇒ Boolean

Parameters:

  • to be compared

Returns:

See Also:

  • `==` method


202
203
204
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 202

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • Hash code



208
209
210
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 208

def hash
  [id, type, original_type, url, refresh_url, filename, preview_url, payload].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



160
161
162
163
164
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 160

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • Returns the object in the form of hash



237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 237

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • true if the model is valid



168
169
170
171
172
173
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 168

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  type_validator = EnumAttributeValidator.new('String', ["image", "video", "audio", "file", "sticker", "share", "template"])
  return false unless type_validator.valid?(@type)
  true
end