Sha256: a6455ea000a5ac4a1ca6bd66b44756aa35f0e9a8184d387040744c88995f2f81
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
module Buzzsprout class Client include HTTParty format :json base_uri "http://www.buzzsprout.com" # List all the episodes for a podcast # # @param [Fixnum] podcast_id The ID for the podcast # @param [Array<String>] tags An array of tags to filter episodes # @return [Array<Episode>] A list of episodes matching the query def self.episodes(podcast_id, tags=[]) query = {} tags = tags.join(",") if tags.is_a?(Array) query[:tags] = tags if tags and not tags.empty? response = self.get("/#{podcast_id}.json", :query => query) response.map{|item| Buzzsprout::Episode.new(item['episode'])} end # Retrieve episode details # # @param [Fixnum] podcast_id The ID for the podcast # @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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
buzzsprout-0.0.4 | lib/buzzsprout/client.rb |
buzzsprout-0.0.3 | lib/buzzsprout/client.rb |