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 CHANGED
@@ -1 +1 @@
1
- 0.3
1
+ 0.3.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{itunes-search-rb}
8
- s.version = "0.3"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Caleb Adam Haye"]
@@ -5,8 +5,22 @@ module ItunesSearch
5
5
  class Base
6
6
  attr_accessor :search_type
7
7
 
8
- def search(search_type, query)
9
- return ItunesSearch::Search.new(search_type, CGI::escape(query))
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
@@ -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: 13
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- version: "0.3"
9
+ - 2
10
+ version: 0.3.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Caleb Adam Haye