Class: Enklawa::Api::Program
- Inherits:
-
Struct
- Object
- Struct
- Enklawa::Api::Program
- Defined in:
- lib/enklawa/api/program.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#category_id ⇒ Object
Returns the value of attribute category_id.
-
#description ⇒ Object
Returns the value of attribute description.
-
#episodes ⇒ Object
Returns the value of attribute episodes.
-
#id ⇒ Object
Returns the value of attribute id.
-
#live ⇒ Object
Returns the value of attribute live.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #<<(episode) ⇒ Object
- #feed_url ⇒ Object
- #image ⇒ Object
-
#initialize ⇒ Program
constructor
A new instance of Program.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Program
6 7 8 |
# File 'lib/enklawa/api/program.rb', line 6 def initialize self.episodes = [] end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author
3 4 5 |
# File 'lib/enklawa/api/program.rb', line 3 def @author end |
#base_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/enklawa/api/program.rb', line 4 def base_url @base_url end |
#category_id ⇒ Object
Returns the value of attribute category_id
3 4 5 |
# File 'lib/enklawa/api/program.rb', line 3 def category_id @category_id end |
#description ⇒ Object
Returns the value of attribute description
3 4 5 |
# File 'lib/enklawa/api/program.rb', line 3 def description @description end |
#episodes ⇒ Object
Returns the value of attribute episodes.
4 5 6 |
# File 'lib/enklawa/api/program.rb', line 4 def episodes @episodes end |
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/enklawa/api/program.rb', line 3 def id @id end |
#live ⇒ Object
Returns the value of attribute live
3 4 5 |
# File 'lib/enklawa/api/program.rb', line 3 def live @live end |
#name ⇒ Object
Returns the value of attribute name
3 4 5 |
# File 'lib/enklawa/api/program.rb', line 3 def name @name end |
Instance Method Details
#<<(episode) ⇒ Object
18 19 20 |
# File 'lib/enklawa/api/program.rb', line 18 def <<(episode) self.episodes << episode end |
#feed_url ⇒ Object
22 23 24 |
# File 'lib/enklawa/api/program.rb', line 22 def feed_url File.join([base_url, "/program#{self.id}.xml"]) end |
#image ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/enklawa/api/program.rb', line 10 def image if base_url.match("enklawa") File.join([base_url, "/images/programs/#{id}.jpg"]) else File.join([base_url, "/images/programs/240/#{id}.jpg"]) end end |
#to_h ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/enklawa/api/program.rb', line 26 def to_h { id: id, name: name, description: description, author: , live: live, image: image, feed_url: feed_url, category_id: category_id, episodes: episodes.map(&:to_h) } end |