podcast_api 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -0
- data/Gemfile.lock +34 -0
- data/README.md +10982 -7
- data/RakeFile +9 -0
- data/examples/Gemfile.lock +3 -3
- data/examples/sample.rb +8 -0
- data/lib/errors.rb +1 -4
- data/lib/podcast_api.rb +18 -3
- data/lib/version.rb +1 -1
- data/podcast_api.gemspec +1 -0
- data/rakefile.rb +9 -0
- metadata +8 -3
data/RakeFile
ADDED
data/examples/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
podcast_api (1.0
|
4
|
+
podcast_api (1.1.0)
|
5
5
|
httparty
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
httparty (0.
|
10
|
+
httparty (0.20.0)
|
11
11
|
mime-types (~> 3.0)
|
12
12
|
multi_xml (>= 0.5.2)
|
13
13
|
mime-types (3.3.1)
|
14
14
|
mime-types-data (~> 3.2015)
|
15
|
-
mime-types-data (3.2021.
|
15
|
+
mime-types-data (3.2021.0901)
|
16
16
|
multi_xml (0.6.0)
|
17
17
|
|
18
18
|
PLATFORMS
|
data/examples/sample.rb
CHANGED
@@ -24,6 +24,14 @@ else
|
|
24
24
|
puts "Next billing date: #{response.headers['X-Listenapi-NextBillingDate']}"
|
25
25
|
end
|
26
26
|
|
27
|
+
# response = client.spellcheck(q: 'evergrand stok')
|
28
|
+
# puts JSON.parse(response.body)
|
29
|
+
|
30
|
+
# response = client.fetch_related_searches(q: 'evergrande')
|
31
|
+
# puts JSON.parse(response.body)
|
32
|
+
|
33
|
+
# response = client.fetch_trending_searches()
|
34
|
+
# puts JSON.parse(response.body)
|
27
35
|
|
28
36
|
# response = client.typeahead(q: 'startup', show_podcasts: 1)
|
29
37
|
# puts JSON.parse(response.body)
|
data/lib/errors.rb
CHANGED
data/lib/podcast_api.rb
CHANGED
@@ -14,14 +14,15 @@ module PodcastApi
|
|
14
14
|
@@BASE_URL_PROD = 'https://listen-api.listennotes.com/api/v2'
|
15
15
|
@@BASE_URL_TEST = 'https://listen-api-test.listennotes.com/api/v2'
|
16
16
|
|
17
|
+
attr_reader :base_url
|
18
|
+
|
17
19
|
def initialize(api_key: nil, user_agent: nil)
|
18
20
|
@api_key = api_key
|
19
21
|
@base_url = api_key ? @@BASE_URL_PROD : @@BASE_URL_TEST
|
20
22
|
@headers = {
|
21
|
-
'X-ListenAPI-Key' => @api_key,
|
23
|
+
'X-ListenAPI-Key' => @api_key ? @api_key : '',
|
22
24
|
'User-Agent' => user_agent ? user_agent : "podcasts-api-ruby #{VERSION}"
|
23
25
|
}
|
24
|
-
puts @headers
|
25
26
|
end
|
26
27
|
|
27
28
|
protected
|
@@ -60,6 +61,18 @@ module PodcastApi
|
|
60
61
|
return send_http_request('get', "#{@base_url}/typeahead", {query: kwargs, headers: @headers})
|
61
62
|
end
|
62
63
|
|
64
|
+
def spellcheck(**kwargs)
|
65
|
+
return send_http_request('get', "#{@base_url}/spellcheck", {query: kwargs, headers: @headers})
|
66
|
+
end
|
67
|
+
|
68
|
+
def fetch_related_searches(**kwargs)
|
69
|
+
return send_http_request('get', "#{@base_url}/related_searches", {query: kwargs, headers: @headers})
|
70
|
+
end
|
71
|
+
|
72
|
+
def fetch_trending_searches(**kwargs)
|
73
|
+
return send_http_request('get', "#{@base_url}/trending_searches", {query: kwargs, headers: @headers})
|
74
|
+
end
|
75
|
+
|
63
76
|
def fetch_best_podcasts(**kwargs)
|
64
77
|
return send_http_request('get', "#{@base_url}/best_podcasts", {query: kwargs, headers: @headers})
|
65
78
|
end
|
@@ -75,10 +88,12 @@ module PodcastApi
|
|
75
88
|
end
|
76
89
|
|
77
90
|
def batch_fetch_podcasts(**kwargs)
|
91
|
+
@headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
78
92
|
return send_http_request('post', "#{@base_url}/podcasts", {body: kwargs, headers: @headers})
|
79
93
|
end
|
80
94
|
|
81
95
|
def batch_fetch_episodes(**kwargs)
|
96
|
+
@headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
82
97
|
return send_http_request('post', "#{@base_url}/episodes", {body: kwargs, headers: @headers})
|
83
98
|
end
|
84
99
|
|
@@ -88,7 +103,6 @@ module PodcastApi
|
|
88
103
|
end
|
89
104
|
|
90
105
|
def fetch_curated_podcasts_lists(**kwargs)
|
91
|
-
id = kwargs.delete(:id)
|
92
106
|
return send_http_request('get', "#{@base_url}/curated_podcasts", {query: kwargs, headers: @headers})
|
93
107
|
end
|
94
108
|
|
@@ -128,6 +142,7 @@ module PodcastApi
|
|
128
142
|
end
|
129
143
|
|
130
144
|
def submit_podcast(**kwargs)
|
145
|
+
@headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
131
146
|
return send_http_request('post', "#{@base_url}/podcasts/submit", {body: kwargs, headers: @headers})
|
132
147
|
end
|
133
148
|
|
data/lib/version.rb
CHANGED
data/podcast_api.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.required_ruby_version = ">= 2.3.0"
|
11
11
|
s.summary = "Ruby bindings for the Listen Notes Podcast API"
|
12
12
|
s.description = "Listen Notes is the best podcast search engine and api. " \
|
13
|
+
"This is the official Ruby Gem for the Listen Notes Podcast API. " \
|
13
14
|
"See https://www.listennotes.com/api/ for details."
|
14
15
|
s.author = "Listen Notes, Inc."
|
15
16
|
s.email = "hello@listennotes.com"
|
data/rakefile.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: podcast_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Listen Notes, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -24,15 +24,19 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: Listen Notes is the best podcast search engine and api.
|
27
|
+
description: Listen Notes is the best podcast search engine and api. This is the
|
28
|
+
official Ruby Gem for the Listen Notes Podcast API. See https://www.listennotes.com/api/
|
28
29
|
for details.
|
29
30
|
email: hello@listennotes.com
|
30
31
|
executables: []
|
31
32
|
extensions: []
|
32
33
|
extra_rdoc_files: []
|
33
34
|
files:
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
34
37
|
- LICENSE
|
35
38
|
- README.md
|
39
|
+
- RakeFile
|
36
40
|
- examples/Gemfile
|
37
41
|
- examples/Gemfile.lock
|
38
42
|
- examples/sample.rb
|
@@ -40,6 +44,7 @@ files:
|
|
40
44
|
- lib/podcast_api.rb
|
41
45
|
- lib/version.rb
|
42
46
|
- podcast_api.gemspec
|
47
|
+
- rakefile.rb
|
43
48
|
homepage: https://www.listennotes.com/api/
|
44
49
|
licenses:
|
45
50
|
- MIT
|