Class: Google::Search::Item::Video

Inherits:
Google::Search::Item show all
Defined in:
lib/google-search/item/video.rb

Instance Attribute Summary collapse

Attributes inherited from Google::Search::Item

#content, #index, #thumbnail_height, #thumbnail_uri, #thumbnail_width, #title, #uri, #visible_uri

Instance Method Summary collapse

Methods inherited from Google::Search::Item

class_for

Constructor Details

#initialize(hash) ⇒ Video

Initialize with hash.



35
36
37
38
39
40
41
42
# File 'lib/google-search/item/video.rb', line 35

def initialize hash
  super
  @rating = hash['rating'].to_f
  @type = hash['videoType']
  @publisher = hash['publisher']
  @published = DateTime.parse hash['published']
  @duration = hash['duration'].to_i
end

Instance Attribute Details

#durationObject (readonly)

Duration in seconds.



30
31
32
# File 'lib/google-search/item/video.rb', line 30

def duration
  @duration
end

#publishedObject (readonly)

Published DateTime.



25
26
27
# File 'lib/google-search/item/video.rb', line 25

def published
  @published
end

#publisherObject (readonly)

Publisher.



20
21
22
# File 'lib/google-search/item/video.rb', line 20

def publisher
  @publisher
end

#ratingObject (readonly)

Rating float.



10
11
12
# File 'lib/google-search/item/video.rb', line 10

def rating
  @rating
end

#typeObject (readonly)

Video type.



15
16
17
# File 'lib/google-search/item/video.rb', line 15

def type
  @type
end