Sha256: dd8e89af0a48eea3db2a2348007e4ea135d9ef5a1ad1b7458099e335efbf61b1

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

module Zelda
  class Serie
    class << self
      def search(query)
        Request.get("series/search/#{query}")['series']
      end
      
      def find(id)
        new Request.get("series/#{id}")
      end
      
      def all
        Request.get("series")
      end
    end
  
    def initialize(attrs={})
      @attrs = attrs
    end
    
    def name
      @attrs["serie"]["name"]
    end
  
    def serieid
      @attrs["serie"]["serieid"]
    end
  
    def afleveringen
      @afleveringen ||= get_afleveringen()
    end

    def upcoming_afleveringen
      @upcoming_afleveringen ||= get_afleveringen("upcoming")
    end
  
    def past_afleveringen
      @past_afleveringen ||= get_afleveringen("past")
    end
  
    private
      def get_afleveringen(timestamp=nil)
        url = [ "series", serieid, "afleveringen", timestamp ].join("/")

        objects = []
        Request.get(url)["afleveringen"].each do |vars|
          objects << Zelda::Aflevering.new(vars)
        end
        objects
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bartzon-zelda-0.0.2 lib/zelda/serie.rb
bartzon-zelda-0.0.3 lib/zelda/serie.rb