Class: Ipodcastly::Server::Episode
- Inherits:
-
Object
- Object
- Ipodcastly::Server::Episode
- Includes:
- HTTParty
- Defined in:
- lib/ipodcastly/server/episode.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#podcast_id ⇒ Object
readonly
Returns the value of attribute podcast_id.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(id, podcast_id, title, position, duration = 0) ⇒ Episode
constructor
A new instance of Episode.
- #save ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(id, podcast_id, title, position, duration = 0) ⇒ Episode
Returns a new instance of Episode.
10 11 12 13 14 15 16 |
# File 'lib/ipodcastly/server/episode.rb', line 10 def initialize(id, podcast_id, title, position, duration = 0) @id = id @podcast_id = podcast_id @title = title @position = position @duration = duration end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
8 9 10 |
# File 'lib/ipodcastly/server/episode.rb', line 8 def duration @duration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/ipodcastly/server/episode.rb', line 8 def id @id end |
#podcast_id ⇒ Object (readonly)
Returns the value of attribute podcast_id.
8 9 10 |
# File 'lib/ipodcastly/server/episode.rb', line 8 def podcast_id @podcast_id end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
8 9 10 |
# File 'lib/ipodcastly/server/episode.rb', line 8 def position @position end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/ipodcastly/server/episode.rb', line 8 def title @title end |
Instance Method Details
#save ⇒ Object
29 30 31 32 |
# File 'lib/ipodcastly/server/episode.rb', line 29 def save response = self.class.post("/episodes.json", :body => to_param) response.code == 200 end |
#to_param ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ipodcastly/server/episode.rb', line 18 def to_param { :podcast_id => podcast_id, :episode => { :title => title, :position => position.to_i, :duration => duration.to_i } } end |