Class: Zelda::Zender

Inherits:
Base
  • Object
show all
Defined in:
lib/zelda/zender.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #method_missing

Constructor Details

This class inherits a constructor from Zelda::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Zelda::Base

Class Method Details

.allObject



9
10
11
# File 'lib/zelda/zender.rb', line 9

def all
  Request.get("zenders")
end

.find(id) ⇒ Object



4
5
6
7
# File 'lib/zelda/zender.rb', line 4

def find(id)
  attrs = Request.get("zenders/#{id}")
  attrs ? new(attrs) : nil
end

Instance Method Details

#codeObject



18
19
20
# File 'lib/zelda/zender.rb', line 18

def code
  attributes[:zender]["code"]
end

#current_seriesObject

Return Series for this Zender that have broadcasts in the future.



30
31
32
33
34
# File 'lib/zelda/zender.rb', line 30

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

#nameObject



14
15
16
# File 'lib/zelda/zender.rb', line 14

def name
  attributes[:zender]["name"]
end

#seriesObject

Return all Series for this Zender.



23
24
25
26
27
# File 'lib/zelda/zender.rb', line 23

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