omdb_gateway 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/omdb_gateway/movie_request.rb +1 -9
- data/lib/omdb_gateway/request.rb +11 -0
- data/lib/omdb_gateway/search_request.rb +1 -8
- data/lib/omdb_gateway/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 230e53f455cca3a7d5801604af692419d17709689591af407635997a7cb032b0
|
4
|
+
data.tar.gz: b6de9d371da571aafbca6a9f6991ea8fff6b7c4c7cb088d6e51c530718c3d92a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c5e3419f056813368bc5c1f21554c1ff68b3c932e177381f5741a16eec22b352fce962102de5b54e3b36d53403d163cc080054ca39d09cd8ca51108698f476a
|
7
|
+
data.tar.gz: 123921436a0170445b35aeea0bb7ebbc0a2c6d91cd75cd9b4213007fbb89ac971119d79d2fb0517b119fbaf1c65eb067c16a9cef5cc7149bdd11b1ce74d7708f
|
data/Gemfile.lock
CHANGED
@@ -10,15 +10,7 @@ module OmdbGateway
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def fetch
|
13
|
-
|
14
|
-
if @format.present? && @format.to_sym == :json
|
15
|
-
return JSON.parse(@response.body).with_indifferent_access
|
16
|
-
elsif @format.present? && @format.to_sym == :xml
|
17
|
-
@response.body
|
18
|
-
else
|
19
|
-
response_hash = JSON.parse(@response.body)
|
20
|
-
Response.new(response_hash)
|
21
|
-
end
|
13
|
+
super(Response)
|
22
14
|
end
|
23
15
|
|
24
16
|
private
|
data/lib/omdb_gateway/request.rb
CHANGED
@@ -12,6 +12,17 @@ module OmdbGateway
|
|
12
12
|
@api_version = params[:api_version] || 1
|
13
13
|
end
|
14
14
|
|
15
|
+
def fetch(response_klass)
|
16
|
+
@response ||= RestClient.get(url)
|
17
|
+
if @format.present? && @format.to_sym == :json
|
18
|
+
JSON.parse(@response.body).with_indifferent_access
|
19
|
+
elsif @format.present? && @format.to_sym == :xml
|
20
|
+
@response.body
|
21
|
+
else
|
22
|
+
response_klass.send(:new, JSON.parse(@response.body))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
15
26
|
protected
|
16
27
|
|
17
28
|
def url
|
@@ -10,14 +10,7 @@ module OmdbGateway
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def fetch
|
13
|
-
|
14
|
-
if @format.present? && @format.to_sym == :json
|
15
|
-
JSON.parse(@response.body)
|
16
|
-
elsif @format.present? && @format.to_sym == :xml
|
17
|
-
@response.body
|
18
|
-
else
|
19
|
-
CollectionResponse.new(JSON.parse(@response.body))
|
20
|
-
end
|
13
|
+
super(CollectionResponse)
|
21
14
|
end
|
22
15
|
|
23
16
|
private
|
data/lib/omdb_gateway/version.rb
CHANGED