Sha256: 988f1ed99b3719e976f073ff8ab2949d0948e13a471b715d4b4c6090ab527109

Contents?: true

Size: 1.49 KB

Versions: 6

Compression:

Stored size: 1.49 KB

Contents

require "nicoquery/api/mylist_rss"
require "nicoquery/object_mapper/mylist_rss"
require "nicoquery/object/movie"


module NicoQuery
  module Object
    class Mylist
      attr_accessor :movies

      [
        'title',
        'mylist_id',
        'url',
        'link',
        'description',
        'publish_date',
        'last_build_date',
        'creator',
      ].each do |field_name|
        define_method(field_name) { @hash.meta.send field_name }
      end

      def initialize(mylist_id)
        @movies = []
        @mylist_id = mylist_id
        source = (NicoQuery::Api::MylistRSS.new mylist_id).get

        @hash = NicoQuery::ObjectMapper::MylistRSS.new source

        return if @hash.items.nil?
        @hash.items.map do |item|
          movie = NicoQuery::Object::Movie.new item.video_id
          movie.set_mylist_rss_source item
          @movies.push movie
        end
      end
    end
  end
end


# <title>マイリスト to_test‐ニコニコ動画</title>
# <link>http://www.nicovideo.jp/mylist/38369702</link>
# <atom:link rel="self" type="application/rss+xml" href="http://www.nicovideo.jp/mylist/38369702?rss=2.0"/>
# <description></description>
# <pubDate>Sat, 17 Aug 2013 22:51:40 +0900</pubDate>
# <lastBuildDate>Sat, 17 Aug 2013 22:51:40 +0900</lastBuildDate>
# <generator>ニコニコ動画</generator>
# <dc:creator>うえおに</dc:creator>
# <language>ja-jp</language>
# <copyright>(c) niwango, inc. All rights reserved.</copyright>
# <docs>http://blogs.law.harvard.edu/tech/rss</docs>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nicoquery-0.1.4 lib/nicoquery/object/mylist.rb
nicoquery-0.1.3 lib/nicoquery/object/mylist.rb
nicoquery-0.1.2 lib/nicoquery/object/mylist.rb
nicoquery-0.1.1 lib/nicoquery/object/mylist.rb
nicoquery-0.1.0 lib/nicoquery/object/mylist.rb
nicoquery-0.0.3 lib/nicoquery/object/mylist.rb