itunes-search 0.2.4 → 0.2.5
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 +14 -5
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
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.5"
|
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-
|
12
|
+
s.date = %q{2011-06-09}
|
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,6 +10,7 @@ module ItunesSearch
|
|
10
10
|
self.options.merge!(arg)
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
13
14
|
def method_missing(method_name,*args)
|
14
15
|
if args.size == 1
|
15
16
|
self.options.merge!({"#{method_name.to_s.gsub("=","")}"=>args.first.to_s})
|
@@ -21,21 +22,29 @@ module ItunesSearch
|
|
21
22
|
end
|
22
23
|
original_method_missing method_name, args
|
23
24
|
end
|
25
|
+
|
24
26
|
def fetch
|
25
27
|
#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
|
+
|
26
35
|
uri = URI.parse("#{ItunesSearch::ENDPOINT}?#{self.options.to_url_params}")
|
27
|
-
resp =
|
36
|
+
resp = http.start(uri.host,uri.port) do |http|
|
28
37
|
http.open_timeout=5
|
29
38
|
http.read_timeout=5
|
30
39
|
http.get("#{uri.path}?#{self.options.to_url_params}")
|
31
40
|
end
|
32
|
-
self.json=resp.body
|
41
|
+
self.json = resp.body
|
33
42
|
end
|
43
|
+
|
34
44
|
def results
|
35
45
|
ra = []
|
36
|
-
|
37
|
-
|
38
|
-
return ra
|
46
|
+
|
47
|
+
self.to_hash["results"].collect {|r| ItunesSearch::Result.new(r)} unless self.to_hash["results"].empty?
|
39
48
|
end
|
40
49
|
|
41
50
|
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.5
|
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-
|
13
|
+
date: 2011-06-09 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: shoulda
|