Skip to content

Commit

Permalink
Add fetch_audience_for_podcast function.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbinf committed Jul 28, 2022
1 parent b1943f8 commit d84cb3b
Show file tree
Hide file tree
Showing 6 changed files with 3,366 additions and 2,502 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
podcast_api (1.1.1)
podcast_api (1.1.4)
httparty

GEM
Expand Down
5,848 changes: 3,349 additions & 2,499 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
podcast_api (1.1.1)
podcast_api (1.1.4)
httparty

GEM
Expand Down
5 changes: 5 additions & 0 deletions lib/podcast_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def submit_podcast(**kwargs)
def delete_podcast(**kwargs)
id = kwargs.delete(:id)
return send_http_request('delete', "#{@base_url}/podcasts/#{id}", {query: kwargs, headers: @headers})
end

def fetch_audience_for_podcast(**kwargs)
id = kwargs.delete(:id)
return send_http_request('get', "#{@base_url}/podcasts/#{id}/audience", {query: kwargs, headers: @headers})
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module PodcastApi
VERSION = "1.1.1"
VERSION = "1.1.4"
end
9 changes: 9 additions & 0 deletions tests/podcast_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,14 @@ def test_fetch_recommendations_for_episode_with_mock
assert_equal response.request.http_method, Net::HTTP::Get
assert_equal response.request.path.path, "/api/v2/episodes/#{id}/recommendations"
assert response['recommendations'].length > 0
end

def test_fetch_audience_for_podcast_with_mock
id = 'abcde'
client = PodcastApi::Client.new
response = client.fetch_audience_for_podcast(id: id)
assert_equal response.request.http_method, Net::HTTP::Get
assert_equal response.request.path.path, "/api/v2/podcasts/#{id}/audience"
assert response['by_regions'].length > 0
end
end

0 comments on commit d84cb3b

Please sign in to comment.