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
- #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
- #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
71 72 73 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 71 def comment_num @hash['video']['comment_num'].to_i end |
#description ⇒ Object
42 43 44 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 42 def description @_description ||= Description.new @hash['video']['description'] end |
#first_retrieve ⇒ Object
50 51 52 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 50 def first_retrieve @hash['video']['first_retrieve'].to_time end |
#length ⇒ Object
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_type ⇒ Object
63 64 65 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 63 def movie_type @hash['video']['movie_type'] end |
#mylist_counter ⇒ Object
75 76 77 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 75 def mylist_counter @hash['video']['mylist_counter'].to_i end |
#publish_date ⇒ Object
alias
54 55 56 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 54 def publish_date # alias first_retrieve end |
#size_low ⇒ Object
79 80 81 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 79 def size_low @hash['video']['size_low'].to_i end |
#tags ⇒ Object
83 84 85 86 87 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 83 def @hash['tags']['tag_info'].each_with_object([]) do |tag, array| array << { text: tag['tag'] } end end |
#thumbnail_url ⇒ Object
46 47 48 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 46 def thumbnail_url @hash['video']['thumbnail_url'] end |
#title ⇒ Object
38 39 40 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 38 def title @hash['video']['title'] end |
#video_id ⇒ Object
34 35 36 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 34 def video_id @hash['video']['id'] end |
#view_counter ⇒ Object
67 68 69 |
# File 'lib/nicoquery/object_mapper/video_array.rb', line 67 def view_counter @hash['video']['view_counter'].to_i end |