Sha256: a432c169a094fca281b28fd5abba11bf41831b122a6643f3a3c2dfa522bb31cd

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

module PodcastIndex
  module Api
    class Podcasts
      extend Request

      class << self
        def by_feed_id(id:)
          response = get("/podcasts/byfeedid", id: id)
          JSON.parse(response.body)
        end

        def by_feed_url(url:)
          response = get("/podcasts/byfeedurl", url: url)
          JSON.parse(response.body)
        end

        def by_itunes_id(id:)
          response = get("/podcasts/byitunesid", id: id)
          JSON.parse(response.body)
        end

        def by_guid(guid:)
          response = get("/podcasts/byguid", guid: guid)
          JSON.parse(response.body)
        end

        def by_tag(tag:)
          params = {}.tap { |p| p[tag] = true }
          response = get("/podcasts/bytag", params)
          JSON.parse(response.body)
        end

        def by_medium(medium:)
          response = get("/podcasts/bymedium", medium: medium)
          JSON.parse(response.body)
        end

        def trending(max: nil, since: nil, lang: nil, cat: nil, notcat: nil)
          response = get("/podcasts/trending", max: max, since: since, lang: lang, cat: cat, notcat: notcat)
          JSON.parse(response.body)
        end

        def dead
          response = get("/podcasts/dead", {})
          JSON.parse(response.body)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
podcast_index-0.5.0 lib/podcast_index/api/podcasts.rb
podcast_index-0.4.0 lib/podcast_index/api/podcasts.rb
podcast_index-0.3.0 lib/podcast_index/api/podcasts.rb
podcast_index-0.2.1 lib/podcast_index/api/podcasts.rb
podcast_index-0.2.0 lib/podcast_index/api/podcasts.rb