class Youtube::FieldParameterValidator

FieldParameterValidator Model.

Attributes

int64[RW]

TODO: Write general description for this method @return [Long]

object[RW]

TODO: Write general description for this method @return [Object]

precision[RW]

TODO: Write general description for this method @return [Float]

string[R]

TODO: Write general description for this method @return [List of String]

unix_format_date_time[RW]

TODO: Write general description for this method @return [DateTime]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/youtube/models/field_parameter_validator.rb, line 61
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  precision = hash['Precision']
  unix_format_date_time = Time.at(hash['UnixFormatDateTime']).utc.to_datetime if
    hash['UnixFormatDateTime']
  object = hash['Object']
  int64 = hash['Int64']
  string = hash['String']

  # Create object from extracted values.
  FieldParameterValidator.new(precision,
                              unix_format_date_time,
                              object,
                              int64,
                              string)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/youtube/models/field_parameter_validator.rb, line 31
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['precision'] = 'Precision'
  @_hash['string'] = 'String'
  @_hash['unix_format_date_time'] = 'UnixFormatDateTime'
  @_hash['object'] = 'Object'
  @_hash['int64'] = 'Int64'
  @_hash
end
new(precision = nil, unix_format_date_time = nil, object = nil, int64 = nil, string = nil) click to toggle source
# File lib/youtube/models/field_parameter_validator.rb, line 41
def initialize(precision = nil,
               unix_format_date_time = nil,
               object = nil,
               int64 = nil,
               string = nil)
  @precision = precision
  @string = string
  @unix_format_date_time = unix_format_date_time
  @object = object
  @int64 = int64
  def unix_format_date_time.to_s
    to_time.utc.to_i.to_s
  end

  def unix_format_date_time.to_json(_options = {})
    to_time.utc.to_i.to_json
  end
end