itunes-search 0.2.5 → 0.2.6
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 +2 -2
- data/lib/itunes-search/search.rb +5 -14
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/itunes-search.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{itunes-search}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.6"
|
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"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-15}
|
13
13
|
s.description = %q{Pretty simple interface for the itunes search api will return results as array of results objects and offer reasonable accessor methods variables}
|
14
14
|
s.email = %q{jeff.durand@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/itunes-search/search.rb
CHANGED
@@ -10,7 +10,6 @@ module ItunesSearch
|
|
10
10
|
self.options.merge!(arg)
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
14
13
|
def method_missing(method_name,*args)
|
15
14
|
if args.size == 1
|
16
15
|
self.options.merge!({"#{method_name.to_s.gsub("=","")}"=>args.first.to_s})
|
@@ -22,29 +21,21 @@ module ItunesSearch
|
|
22
21
|
end
|
23
22
|
original_method_missing method_name, args
|
24
23
|
end
|
25
|
-
|
26
24
|
def fetch
|
27
25
|
#puts "#{ItunesSearch::ENDPOINT}?#{self.options.to_url_params}"
|
28
|
-
if ENV['http_proxy']
|
29
|
-
proxy_uri = URI.parse(ENV['http_proxy'])
|
30
|
-
http = Net::HTTP.Proxy(proxy_uri.host, proxy_uri.port)
|
31
|
-
else
|
32
|
-
http = Net::HTTP
|
33
|
-
end
|
34
|
-
|
35
26
|
uri = URI.parse("#{ItunesSearch::ENDPOINT}?#{self.options.to_url_params}")
|
36
|
-
resp =
|
27
|
+
resp = Net::HTTP.start(uri.host,uri.port) do |http|
|
37
28
|
http.open_timeout=5
|
38
29
|
http.read_timeout=5
|
39
30
|
http.get("#{uri.path}?#{self.options.to_url_params}")
|
40
31
|
end
|
41
|
-
self.json
|
32
|
+
self.json=resp.body
|
42
33
|
end
|
43
|
-
|
44
34
|
def results
|
45
35
|
ra = []
|
46
|
-
|
47
|
-
|
36
|
+
ra = self.to_hash["results"].collect {|r| ItunesSearch::Result.new(r)} unless self.to_hash["results"].empty?
|
37
|
+
puts ra.inspect
|
38
|
+
return ra
|
48
39
|
end
|
49
40
|
|
50
41
|
def to_hash
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: itunes-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- jeff durand
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-15 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: shoulda
|