lib/buzzsprout/client.rb in buzzsprout-0.0.2 vs lib/buzzsprout/client.rb in buzzsprout-0.0.3
- old
+ new
@@ -24,8 +24,17 @@
# @param [Fixnum] episode_id The ID for the episode
# @return [Episode] A list of episodes matching the query
def self.episode(podcast_id, episode_id)
Buzzsprout::Episode.new(self.get("/#{podcast_id}/#{episode_id}.json")['episode'])
end
+
+ # Retrieve episode details
+ #
+ # @param [Fixnum] url URL of the episode
+ # @return [Episode] A list of episodes matching the query
+ def self.episode_from_url(url)
+ podcast_id, episode_id = url.split("/").map{|seg| seg.to_i}.reject{|i| i < 1 }
+ self.episode(podcast_id, episode_id)
+ end
end
end
\ No newline at end of file