Skip to content

Commit d84cb3b

Browse files
committed
Add fetch_audience_for_podcast function.
1 parent b1943f8 commit d84cb3b

File tree

6 files changed

+3366
-2502
lines changed

6 files changed

+3366
-2502
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
podcast_api (1.1.1)
4+
podcast_api (1.1.4)
55
httparty
66

77
GEM

README.md

Lines changed: 3349 additions & 2499 deletions
Large diffs are not rendered by default.

examples/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
podcast_api (1.1.1)
4+
podcast_api (1.1.4)
55
httparty
66

77
GEM

lib/podcast_api.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ def submit_podcast(**kwargs)
149149
def delete_podcast(**kwargs)
150150
id = kwargs.delete(:id)
151151
return send_http_request('delete', "#{@base_url}/podcasts/#{id}", {query: kwargs, headers: @headers})
152+
end
153+
154+
def fetch_audience_for_podcast(**kwargs)
155+
id = kwargs.delete(:id)
156+
return send_http_request('get', "#{@base_url}/podcasts/#{id}/audience", {query: kwargs, headers: @headers})
152157
end
153158
end
154159

lib/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module PodcastApi
4-
VERSION = "1.1.1"
4+
VERSION = "1.1.4"
55
end

tests/podcast_api_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,14 @@ def test_fetch_recommendations_for_episode_with_mock
211211
assert_equal response.request.http_method, Net::HTTP::Get
212212
assert_equal response.request.path.path, "/api/v2/episodes/#{id}/recommendations"
213213
assert response['recommendations'].length > 0
214+
end
215+
216+
def test_fetch_audience_for_podcast_with_mock
217+
id = 'abcde'
218+
client = PodcastApi::Client.new
219+
response = client.fetch_audience_for_podcast(id: id)
220+
assert_equal response.request.http_method, Net::HTTP::Get
221+
assert_equal response.request.path.path, "/api/v2/podcasts/#{id}/audience"
222+
assert response['by_regions'].length > 0
214223
end
215224
end

0 commit comments

Comments
 (0)