Class: NicoQuery::ObjectMapper::VideoArray::Video

Inherits:
Object
  • Object
show all
Defined in:
lib/nicoquery/object_mapper/video_array.rb

Instance Method Summary collapse

Constructor Details

#initialize(parsed_xml) ⇒ Video

Returns a new instance of Video.



30
31
32
# File 'lib/nicoquery/object_mapper/video_array.rb', line 30

def initialize(parsed_xml)
  @hash = parsed_xml
end

Instance Method Details

#comment_numObject



71
72
73
# File 'lib/nicoquery/object_mapper/video_array.rb', line 71

def comment_num
  @hash['video']['comment_num'].to_i
end

#descriptionObject



42
43
44
# File 'lib/nicoquery/object_mapper/video_array.rb', line 42

def description
  @_description ||= Description.new @hash['video']['description']
end

#first_retrieveObject



50
51
52
# File 'lib/nicoquery/object_mapper/video_array.rb', line 50

def first_retrieve
  @hash['video']['first_retrieve'].to_time
end

#lengthObject



58
59
60
61
# File 'lib/nicoquery/object_mapper/video_array.rb', line 58

def length
  string = @hash['video']['length'].split(':')
  string[0].to_i * 60 + string[1].to_i
end

#movie_typeObject



63
64
65
# File 'lib/nicoquery/object_mapper/video_array.rb', line 63

def movie_type
  @hash['video']['movie_type']
end

#mylist_counterObject



75
76
77
# File 'lib/nicoquery/object_mapper/video_array.rb', line 75

def mylist_counter
  @hash['video']['mylist_counter'].to_i
end

#publish_dateObject

alias



54
55
56
# File 'lib/nicoquery/object_mapper/video_array.rb', line 54

def publish_date # alias
  first_retrieve
end

#size_lowObject



79
80
81
# File 'lib/nicoquery/object_mapper/video_array.rb', line 79

def size_low
  @hash['video']['size_low'].to_i
end

#tagsObject



83
84
85
86
87
# File 'lib/nicoquery/object_mapper/video_array.rb', line 83

def tags
  @hash['tags']['tag_info'].each_with_object([]) do |tag, array|
    array << { text: tag['tag'] }
  end
end

#thumbnail_urlObject



46
47
48
# File 'lib/nicoquery/object_mapper/video_array.rb', line 46

def thumbnail_url
  @hash['video']['thumbnail_url']
end

#titleObject



38
39
40
# File 'lib/nicoquery/object_mapper/video_array.rb', line 38

def title
  @hash['video']['title']
end

#video_idObject



34
35
36
# File 'lib/nicoquery/object_mapper/video_array.rb', line 34

def video_id
  @hash['video']['id']
end

#view_counterObject



67
68
69
# File 'lib/nicoquery/object_mapper/video_array.rb', line 67

def view_counter
  @hash['video']['view_counter'].to_i
end