itunes-search 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -7,20 +7,20 @@ This was created for use on musicxray.com if you think you can do better send yo
7
7
  gem install itunes-search
8
8
 
9
9
  == Usage
10
-
11
- base = Itunes::Base.new
12
-
13
- search_object = base.search("term"=>"The Killers")
10
+ <code>
11
+ base = Itunes::Base.new
12
+ search_object = base.search("term"=>"The Killers")
13
+ </code>
14
14
 
15
15
  # get an array of the search_objects
16
+ <code>
17
+ results = search_object.results
18
+ results.each do |result|
19
+ puts result.trackViewUrl
20
+ end
16
21
 
17
- results = search_object.results
18
-
19
- results.each do |result|
20
- puts result.trackViewUrl
21
- end
22
-
23
- puts result.attributes
22
+ puts result.attributes
23
+ </code>
24
24
 
25
25
 
26
26
  == Note on Patches/Pull Requests
data/Rakefile CHANGED
@@ -38,7 +38,7 @@ rescue LoadError
38
38
  end
39
39
  end
40
40
 
41
- task :test => :check_dependencies
41
+ #task :test => :check_dependencies
42
42
 
43
43
  task :default => :test
44
44
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{itunes-search}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jeff durand"]
@@ -1,21 +1,17 @@
1
1
  module ItunesSearch
2
-
3
-
4
2
  @endpoint = "http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsSearch"
5
-
6
3
  def self.endpoint=(ep)
7
4
  @endpoint = ep
8
5
  end
9
6
  def self.endpoint
10
7
  @endpoint
11
8
  end
12
-
9
+ def search(*args)
10
+ ItunesSearch::Search.new(*args)
11
+ end
13
12
  class Base
14
-
15
13
  def search(*args)
16
- return ItunesSearch::Search.new(*args)
14
+ ItunesSearch::Search.new(*args)
17
15
  end
18
-
19
16
  end
20
-
21
17
  end
@@ -5,13 +5,11 @@ module ItunesSearch
5
5
  attr_accessor :options, :result_hash, :json
6
6
 
7
7
  def initialize(*args)
8
- @options = args.inject({}) { |result, element| element.merge(result); element }
8
+ @options = args.inject({}) { |element, result| result.merge(element); result }
9
9
  end
10
10
 
11
- def results
12
- ra = []
13
- ra = to_hash["results"].collect {|r| OpenStruct.new(r) } unless to_hash["results"].empty?
14
- return ra
11
+ def results
12
+ to_hash.empty? ? [] : to_hash["results"].collect { |r| OpenStruct.new(r) }
15
13
  end
16
14
 
17
15
  protected
@@ -9,6 +9,11 @@ class TestItunesSearch < Test::Unit::TestCase
9
9
  setup do
10
10
  @base = Base.new()
11
11
  end
12
+ context "module method" do
13
+ should "be able to search without creating object" do
14
+ assert search("term"=>"The Killers").results.first.trackViewUrl!=""
15
+ end
16
+ end
12
17
  context "Band exists on itunes" do
13
18
  setup do
14
19
  @so = @base.search("term"=>"The Killers")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - jeff durand