omdb_gateway 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10aa39b61cf6bd1915c2534dedee43d0f782b5f9e2a893fead2a9204ee0f50cb
4
- data.tar.gz: 6fcfb7b6f133d0130781b81697587f99bd3ecf1da43af2a1e8409f07993a01f1
3
+ metadata.gz: 230e53f455cca3a7d5801604af692419d17709689591af407635997a7cb032b0
4
+ data.tar.gz: b6de9d371da571aafbca6a9f6991ea8fff6b7c4c7cb088d6e51c530718c3d92a
5
5
  SHA512:
6
- metadata.gz: '09ab6d032b29e15dd69fc51cec498f02291c4b5f23bd8b6ea9566f55b25d11b06502bf443c4ee18683e7c1a6786e445b004f6eb8cbfe037f29233a212903a01c'
7
- data.tar.gz: 247d9aa167e87cd8559f37a75dea46c3711d9fe6033a3386125ebc3ecede5f2e9f946b2be32487f50eae2f5c535b08146ef3f147841255789c3cec04b7e46f16
6
+ metadata.gz: 9c5e3419f056813368bc5c1f21554c1ff68b3c932e177381f5741a16eec22b352fce962102de5b54e3b36d53403d163cc080054ca39d09cd8ca51108698f476a
7
+ data.tar.gz: 123921436a0170445b35aeea0bb7ebbc0a2c6d91cd75cd9b4213007fbb89ac971119d79d2fb0517b119fbaf1c65eb067c16a9cef5cc7149bdd11b1ce74d7708f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omdb_gateway (0.1.0)
4
+ omdb_gateway (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -10,15 +10,7 @@ module OmdbGateway
10
10
  end
11
11
 
12
12
  def fetch
13
- @response ||= RestClient.get(url)
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
@@ -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
- @response ||= RestClient.get(url)
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
@@ -1,3 +1,3 @@
1
1
  module OmdbGateway
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omdb_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neeraj Kumar