Class: Zernio::ListTikTokCommercialMusic200ResponseTracksInner

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

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 = {}) ⇒ ListTikTokCommercialMusic200ResponseTracksInner

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 92

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ListTikTokCommercialMusic200ResponseTracksInner` 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::ListTikTokCommercialMusic200ResponseTracksInner`. 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?(:'commercial_music_id')
    self.commercial_music_id = attributes[:'commercial_music_id']
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#artistObject

Returns the value of attribute artist.



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

def artist
  @artist
end

#clipObject

Returns the value of attribute clip.



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

def clip
  @clip
end

#commercial_music_idObject

TikTok's commercial_music_id, for reference only



22
23
24
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 22

def commercial_music_id
  @commercial_music_id
end

#duration_secObject

Returns the value of attribute duration_sec.



28
29
30
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 28

def duration_sec
  @duration_sec
end

#genresObject

Returns the value of attribute genres.



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

def genres
  @genres
end

#idObject

The id to send as musicSoundId (the full track's song clip id). TikTok rejects the commercial music id itself at publish time.



19
20
21
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 19

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#preview_urlObject

Preview audio of the full track



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

def preview_url
  @preview_url
end

#rankObject

Position in the trending chart, 1 first



38
39
40
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 38

def rank
  @rank
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



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

def thumbnail_url
  @thumbnail_url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



59
60
61
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 59

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



64
65
66
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 64

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 43

def self.attribute_map
  {
    :'id' => :'id',
    :'commercial_music_id' => :'commercialMusicId',
    :'name' => :'name',
    :'artist' => :'artist',
    :'duration_sec' => :'durationSec',
    :'genres' => :'genres',
    :'preview_url' => :'previewUrl',
    :'thumbnail_url' => :'thumbnailUrl',
    :'rank' => :'rank',
    :'clip' => :'clip'
  }
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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 196

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



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

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 69

def self.openapi_types
  {
    :'id' => :'String',
    :'commercial_music_id' => :'String',
    :'name' => :'String',
    :'artist' => :'String',
    :'duration_sec' => :'Integer',
    :'genres' => :'Array<String>',
    :'preview_url' => :'String',
    :'thumbnail_url' => :'String',
    :'rank' => :'Integer',
    :'clip' => :'ListTikTokCommercialMusic200ResponseTracksInnerClip'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 166

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      commercial_music_id == o.commercial_music_id &&
      name == o.name &&
      artist == o.artist &&
      duration_sec == o.duration_sec &&
      genres == o.genres &&
      preview_url == o.preview_url &&
      thumbnail_url == o.thumbnail_url &&
      rank == o.rank &&
      clip == o.clip
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


183
184
185
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 183

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



189
190
191
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 189

def hash
  [id, commercial_music_id, name, artist, duration_sec, genres, preview_url, thumbnail_url, rank, clip].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



151
152
153
154
155
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 151

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:

  • (Hash)

    Returns the object in the form of hash



218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 218

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



159
160
161
162
# File 'lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb', line 159

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end