itunes-search-rb 0.3 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/itunes-search.gemspec +1 -1
- data/lib/itunes-search/base.rb +16 -2
- data/lib/itunes-search/search.rb +6 -3
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3
|
1
|
+
0.3.2
|
data/itunes-search.gemspec
CHANGED
data/lib/itunes-search/base.rb
CHANGED
@@ -5,8 +5,22 @@ module ItunesSearch
|
|
5
5
|
class Base
|
6
6
|
attr_accessor :search_type
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
# @media - movie, podcast, music, musicVideo, audiobook, shortFilm, tvShow, software, ebook, all
|
9
|
+
|
10
|
+
# The following entities are available for each media type:
|
11
|
+
# movie: movieArtist, movie
|
12
|
+
# podcast: podcastAuthor, podcast
|
13
|
+
# music: musicArtist, musicTrack, album, musicVideo, mix, song
|
14
|
+
# Please note that "musicTrack" can include both songs and music videos in the results
|
15
|
+
# musicVideo: musicArtist, musicVideo
|
16
|
+
# audiobook: audiobookAuthor, audiobook
|
17
|
+
# shortFilm: shortFilmArtist, shortFilm
|
18
|
+
# tvShow: tvEpisode, tvSeason
|
19
|
+
# software: software, iPadSoftware, macSoftware
|
20
|
+
# ebook: ebook
|
21
|
+
# all: movie, album, allArtist, podcast, musicVideo, mix, audiobook, tvSeason, allTrack
|
22
|
+
def search(search_type, query, media="all", entity="allTrack", limit=50)
|
23
|
+
return ItunesSearch::Search.new(search_type, CGI::escape(query), media, entity, limit)
|
10
24
|
end
|
11
25
|
end
|
12
26
|
end
|
data/lib/itunes-search/search.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
module ItunesSearch
|
2
2
|
|
3
3
|
class Search
|
4
|
-
attr_accessor :query, :result_hash, :json, :search_type
|
4
|
+
attr_accessor :query, :media, :entity, :limit, :result_hash, :json, :search_type
|
5
5
|
alias :original_method_missing :method_missing
|
6
6
|
|
7
|
-
def initialize(search_type, query)
|
7
|
+
def initialize(search_type, query, media, entity, limit)
|
8
8
|
self.search_type = search_type
|
9
9
|
self.query = query
|
10
|
+
self.media = media
|
11
|
+
self.entity = entity
|
12
|
+
self.limit = limit
|
10
13
|
end
|
11
14
|
def fetch
|
12
|
-
itunes_search_url = "#{ItunesSearch::ENDPOINT}/?#{self.search_type}=#{self.query}"
|
15
|
+
itunes_search_url = "#{ItunesSearch::ENDPOINT}/?#{self.search_type}=#{self.query}&media=#{media}&entity=#{entity}&limit=#{limit}"
|
13
16
|
puts "itunes_search_url: #{itunes_search_url}"
|
14
17
|
self.json = RestClient.get(itunes_search_url)
|
15
18
|
puts self.json
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itunes-search-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Caleb Adam Haye
|