Class: Ipodcastly::Server::Podcast
- Inherits:
-
Object
- Object
- Ipodcastly::Server::Podcast
- Includes:
- HTTParty
- Defined in:
- lib/ipodcastly/server/podcast.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #episodes ⇒ Object
-
#initialize(id, title, url) ⇒ Podcast
constructor
A new instance of Podcast.
Constructor Details
#initialize(id, title, url) ⇒ Podcast
Returns a new instance of Podcast.
10 11 12 13 14 |
# File 'lib/ipodcastly/server/podcast.rb', line 10 def initialize(id, title, url) @id = id @title = title @url = url end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/ipodcastly/server/podcast.rb', line 8 def id @id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/ipodcastly/server/podcast.rb', line 8 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/ipodcastly/server/podcast.rb', line 8 def url @url end |
Class Method Details
.all ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/ipodcastly/server/podcast.rb', line 26 def self.all response = get('/podcasts.json') if response.code == 200 response.map { |p| new(p['id'], p['title'], p['url']) } else [] end end |
.find_by_title(title) ⇒ Object
36 37 38 |
# File 'lib/ipodcastly/server/podcast.rb', line 36 def self.find_by_title(title) all.detect { |p| p.title == title } end |