Class: Zernio::GetYoutubeCaptions200Response

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/get_youtube_captions200_response.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 = {}) ⇒ GetYoutubeCaptions200Response

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 123

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



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

def 
  @account_id
end

#available_tracksObject

Every track on the video, so you can re-request another language. On a cached read this is the listing as it stood when we downloaded, so a language added to the video since then appears only after a refresh=true or when you request that language directly.



47
48
49
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 47

def available_tracks
  @available_tracks
end

#cuesObject

Timed cues. Present when format is json. Auto-generated cues overlap in time by design (captions roll), so start can precede the previous cue's end.



41
42
43
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 41

def cues
  @cues
end

#fetched_atObject

When the stored copy was downloaded from YouTube.



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

def fetched_at
  @fetched_at
end

#languageObject

The language of the returned track.



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

def language
  @language
end

#sourceObject

cache when served from our stored copy, youtube when this call spent the quota units.



32
33
34
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 32

def source
  @source
end

#srtObject

Raw SubRip body. Present when format is srt.



44
45
46
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 44

def srt
  @srt
end

#textObject

The whole transcript as one paragraph, no timings.



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

def text
  @text
end

#track_idObject

YouTube's own caption track id.



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

def track_id
  @track_id
end

#track_kindObject

asr is YouTube's auto-generated track; standard was uploaded by the channel.



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

def track_kind
  @track_kind
end

#video_idObject

Returns the value of attribute video_id.



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

def video_id
  @video_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



89
90
91
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 89

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



94
95
96
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 94

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 72

def self.attribute_map
  {
    :'account_id' => :'accountId',
    :'video_id' => :'videoId',
    :'language' => :'language',
    :'track_id' => :'trackId',
    :'track_kind' => :'trackKind',
    :'source' => :'source',
    :'fetched_at' => :'fetchedAt',
    :'text' => :'text',
    :'cues' => :'cues',
    :'srt' => :'srt',
    :'available_tracks' => :'availableTracks'
  }
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



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 258

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



116
117
118
119
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 116

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

.openapi_typesObject

Attribute type mapping.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 99

def self.openapi_types
  {
    :'account_id' => :'String',
    :'video_id' => :'String',
    :'language' => :'String',
    :'track_id' => :'String',
    :'track_kind' => :'String',
    :'source' => :'String',
    :'fetched_at' => :'Time',
    :'text' => :'String',
    :'cues' => :'Array<GetYoutubeCaptions200ResponseCuesInner>',
    :'srt' => :'String',
    :'available_tracks' => :'Array<GetYoutubeCaptions200ResponseAvailableTracksInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      video_id == o.video_id &&
      language == o.language &&
      track_id == o.track_id &&
      track_kind == o.track_kind &&
      source == o.source &&
      fetched_at == o.fetched_at &&
      text == o.text &&
      cues == o.cues &&
      srt == o.srt &&
      available_tracks == o.available_tracks
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


245
246
247
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 245

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



251
252
253
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 251

def hash
  [, video_id, language, track_id, track_kind, source, fetched_at, text, cues, srt, available_tracks].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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



280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 280

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



196
197
198
199
200
201
202
203
# File 'lib/zernio-sdk/models/get_youtube_captions200_response.rb', line 196

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  track_kind_validator = EnumAttributeValidator.new('String', ["asr", "standard"])
  return false unless track_kind_validator.valid?(@track_kind)
  source_validator = EnumAttributeValidator.new('String', ["cache", "youtube"])
  return false unless source_validator.valid?(@source)
  true
end