class NicoQuery::ObjectMapper::VideoArray::Video

Public Class Methods

new(parsed_xml) click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 30
def initialize(parsed_xml)
  @hash = parsed_xml
end

Public Instance Methods

comment_num() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 79
def comment_num
  @hash['thread']['num_res'].to_i
end
community?() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 34
def community?
  @hash['thread']['community_id'].present?
end
community_id() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 91
def community_id
  @hash['thread']['community_id'].to_i
end
description() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 50
def description
  @_description ||= Description.new @hash['video']['description']
end
first_retrieve() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 58
def first_retrieve
  @hash['video']['first_retrieve'].to_time
end
length() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 66
def length
  string = @hash['video']['length'].split(':')
  string[0].to_i * 60 + string[1].to_i
end
movie_type() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 71
def movie_type
  @hash['video']['movie_type']
end
mylist_counter() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 83
def mylist_counter
  @hash['video']['mylist_counter'].to_i
end
publish_date() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 62
def publish_date # alias
  first_retrieve
end
size_low() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 87
def size_low
  @hash['video']['size_low'].to_i
end
tags() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 95
def tags
  tag_obj = @hash['tags']['tag_info']

  if tag_obj.nil?
    tag_array = []
  elsif tag_obj.instance_of? Array
    tag_array = tag_obj
  else
    tag_array = [ tag_obj ]
  end

  tag_array.each_with_object([]) do |tag, array|
    array << { text: tag['tag'] }
  end
end
thread_id() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 42
def thread_id
  @hash['thread']['id'].to_i
end
thumbnail_url() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 54
def thumbnail_url
  @hash['video']['thumbnail_url']
end
title() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 46
def title
  @hash['video']['title']
end
video_id() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 38
def video_id
  @hash['video']['id']
end
view_counter() click to toggle source
# File lib/nicoquery/object_mapper/video_array.rb, line 75
def view_counter
  @hash['video']['view_counter'].to_i
end