Sha256: 91a03dc9e5d294ed8e9377f6f937f087aabc5cd161c4a622a46a416049174569

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

module Zelda
  class Zender < Zelda::Base
    class << self
      # Find a Zender by code, such as +NL1+ or +101+.
      def find(code)
        attrs = Request.get("zenders/#{code}")['zender'] rescue nil
        attrs ? new(attrs) : nil
      end
      
      # Find all Zenders.
      def all
        Request.get("zenders")['zenders']
      end
    end
    
    def to_s
      name
    end

    # Return all Series for this Zender.
    def series
      Zelda::Request.get("zenders/#{id}/series")['zender']['series']['serie'].map do |attrs|
        Zelda::Serie.new(attrs)
      end
    end

    # Return Series for this Zender that have broadcasts in the future.
    def current_series
      Zelda::Request.get("zenders/#{id}/current_series")['zender']['series']['serie'].map do |attrs|
        Zelda::Serie.new(attrs)
      end
    end  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zelda-1.2.1 lib/zelda/zender.rb