Sha256: 4aba2198184f4083c975e5da19a658c9f03aede3b82c21f81616a628583843d4
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module Zelda class Serie < Zelda::Base class << self def search(query) Request.get("series/search/#{query}")['series'] end def find(id) attrs = Request.get("series/#{id}")['serie'] rescue nil attrs ? new(attrs) : nil end def all Request.get("series") end end def afleveringen(van=nil, tot=nil) get_afleveringen(:van => van, :tot => tot) end def upcoming_afleveringen get_afleveringen(:collection => "upcoming") end def past_afleveringen get_afleveringen(:collection => "past") end private def get_afleveringen(*args) @options = args.last.is_a?(::Hash) ? args.pop : {} Request.get(url)["afleveringen"].map do |vars| Zelda::Aflevering.new(vars) end end def url if collection = @options[:collection] [ "series", serieid, "afleveringen", collection ].join("/") elsif @options[:van] && @options[:tot] van, tot = @options[:van], @options[:tot] [ "series", serieid, "afleveringen" ].join("/") + "?van=#{van.to_i}&tot=#{tot.to_i}" else [ "series", serieid, "afleveringen" ].join("/") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bartzon-zelda-0.0.5 | lib/zelda/serie.rb |