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:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash



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
157
158
159
160
161
162
163
164
165
166
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 115

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?(:'mime_type')
    self.mime_type = attributes[:'mime_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

#filename ⇒ Object

Returns the value of attribute filename.



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

def filename
  @filename
end

#id ⇒ Object

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

#mime_type ⇒ Object

MIME type of the media when Zernio knows it. On Instagram and Facebook it is set for shares resolved by content type (originalType: \"unsupported_type\").



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

def mime_type
  @mime_type
end

#original_type ⇒ Object

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. originalType: \"unsupported_type\" marks a share Meta did not classify, resolved by content type: refreshUrl cannot re-mint it (Meta answers is_unsupported with no attachments for the message node), so download it when the message.received webhook arrives.



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

def original_type
  @original_type
end

#payload ⇒ Object

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



40
41
42
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 40

def payload
  @payload
end

#preview_url ⇒ Object

Returns the value of attribute preview_url.



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

def preview_url
  @preview_url
end

#refresh_url ⇒ Object

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, except for an attachment with originalType: \"unsupported_type\": Meta cannot re-serve those, so the endpoint answers 404 once the url has expired.



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

def refresh_url
  @refresh_url
end

#type ⇒ Object

On Instagram and Facebook a shared reel, post or ad reaches Zernio with no type of its own (Meta's unsupported_type) and is resolved from the media's Content-Type at ingest into image, video, audio or file with originalType: \"unsupported_type\". unsupported_type is returned only when the CDN could not be classified in time.



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

def type
  @type
end

#url ⇒ Object

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.



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

def url
  @url
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping 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_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



85
86
87
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 85

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 65

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

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 226

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_nullable ⇒ Object

List of attributes with nullable: true



105
106
107
108
109
110
111
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 105

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

.openapi_types ⇒ Object

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 90

def self.openapi_types
  {
    :'id' => :'String',
    :'type' => :'String',
    :'original_type' => :'String',
    :'mime_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:

  • Object (Object) —

    to be compared



197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 197

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      type == o.type &&
      original_type == o.original_type &&
      mime_type == o.mime_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:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


213
214
215
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 213

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



219
220
221
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 219

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

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



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

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

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 248

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:

  • (Boolean) —

    true if the model is valid



178
179
180
181
182
183
# File 'lib/zernio-sdk/models/get_inbox_conversation_messages200_response_messages_inner_attachments_inner.rb', line 178

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