Class: NicoQuery::ObjectMapper::VideoArray::Video
- Inherits:
-
Object
- Object
- NicoQuery::ObjectMapper::VideoArray::Video
- Defined in:
- lib/nicoquery/object_mapper/video_array.rb
Instance Method Summary collapse
- #comment_num ⇒ Object
- #community? ⇒ Boolean
- #community_id ⇒ Object
- #description ⇒ Object
- #first_retrieve ⇒ Object
-
#initialize(parsed_xml) ⇒ Video
constructor
A new instance of Video.
- #length ⇒ Object
- #movie_type ⇒ Object
- #mylist_counter ⇒ Object
-
#publish_date ⇒ Object
alias.
- #size_low ⇒ Object
- #tags ⇒ Object
- #thread_id ⇒ Object
- #thumbnail_url ⇒ Object
- #title ⇒ Object
- #video_id ⇒ Object
- #view_counter ⇒ Object
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_num ⇒ Object
79 80 81 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 79 def comment_num @hash['thread']['num_res'].to_i end |
#community? ⇒ Boolean
34 35 36 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 34 def community? @hash['thread']['community_id'].present? end |
#community_id ⇒ Object
91 92 93 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 91 def community_id @hash['thread']['community_id'].to_i end |
#description ⇒ Object
50 51 52 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 50 def description @_description ||= Description.new @hash['video']['description'] end |
#first_retrieve ⇒ Object
58 59 60 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 58 def first_retrieve @hash['video']['first_retrieve'].to_time end |
#length ⇒ Object
66 67 68 69 |
# 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 ⇒ Object
71 72 73 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 71 def movie_type @hash['video']['movie_type'] end |
#mylist_counter ⇒ Object
83 84 85 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 83 def mylist_counter @hash['video']['mylist_counter'].to_i end |
#publish_date ⇒ Object
alias
62 63 64 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 62 def publish_date # alias first_retrieve end |
#size_low ⇒ Object
87 88 89 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 87 def size_low @hash['video']['size_low'].to_i end |
#tags ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 95 def 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 ⇒ Object
42 43 44 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 42 def thread_id @hash['thread']['id'].to_i end |
#thumbnail_url ⇒ Object
54 55 56 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 54 def thumbnail_url @hash['video']['thumbnail_url'] end |
#title ⇒ Object
46 47 48 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 46 def title @hash['video']['title'] end |
#video_id ⇒ Object
38 39 40 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 38 def video_id @hash['video']['id'] end |
#view_counter ⇒ Object
75 76 77 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 75 def view_counter @hash['video']['view_counter'].to_i end |