reviews_catcher 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f4b47ea90bf150d41c52e9386000037ec554fd5
4
- data.tar.gz: 5c1d642799381206437218a8b9925401cb39e74f
3
+ metadata.gz: fadc03bb07b6cf073379b6f1681709ab55f95cbf
4
+ data.tar.gz: ea91a3931ba707d85c8625d1ea6500810ce0ed4b
5
5
  SHA512:
6
- metadata.gz: 5b64ca263172e1afdd5503b4cd1dead8057d3a5db19ff605a8aa5e44bb85702e6ad3c69992cdfefedcec08c854e440c7ca5cba5894147d0d29ec55530ff29264
7
- data.tar.gz: 51fd80eefc31ebfb5b431b69a8fee16dbd64ba81eb6dfda795881fe384564da9a8b523d89ee3f8aafb1c7c16e32c933213aca511a36df0188dda513e236195a4
6
+ metadata.gz: 7c7fccd47655dea21e164f0fda29a0a231f4fd4141eef8c87a0c1fea673a84fff83ee11124f57e2d02e38a76c9e86176b9257b762031944a1d834e1bbfae2961
7
+ data.tar.gz: 31b43b60de4e09316f4129e57b9731ba451658486b03883afdb0f8be62501c439be9195291e5f28d97470d28f7db75cee9941fda90391cfe4335c17cfc0433dd
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Ruby bindings for the Reviews Catcher API.
4
4
 
5
+ [![Build Status](https://travis-ci.org/reviewscatcher/reviewscatcher-ruby.svg?branch=master)](https://travis-ci.org/reviewscatcher/reviewscatcher-ruby)
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/reviews_catcher.svg)](https://badge.fury.io/rb/reviews_catcher)
8
+
9
+ [![Coverage Status](https://coveralls.io/repos/github/reviewscatcher/reviewscatcher-ruby/badge.svg?branch=master)](https://coveralls.io/github/reviewscatcher/reviewscatcher-ruby?branch=master)
10
+
5
11
  ## Instalation
6
12
 
7
13
  ```ruby
@@ -1,3 +1,6 @@
1
+ 0.0.2
2
+ - switched to http lib instead of net/http
3
+
1
4
  0.0.1
2
5
  - initial version
3
6
  - updated repo url in gemspec
@@ -1,5 +1,4 @@
1
- require 'net/http'
2
- require 'uri'
1
+ require 'http'
3
2
  require 'json'
4
3
 
5
4
  module ReviewsCatcher
@@ -11,31 +10,22 @@ module ReviewsCatcher
11
10
  @client = client
12
11
  end
13
12
 
14
- def uri(action)
15
- URI.parse(@client.base_url + action)
13
+ def auth
14
+ 'api_key=' + @client.api_key
16
15
  end
17
16
 
18
- def authorization_header_value
19
- "api_key=#{@client.api_key}"
17
+ def url(action)
18
+ @client.base_url + action
20
19
  end
21
20
 
22
21
  def get(action)
23
- uri = self.uri(action)
24
-
25
- http = Net::HTTP.new(uri.host, uri.port)
26
- http.open_timeout = 3 # in seconds
27
- http.read_timeout = 3 # in seconds
28
-
29
- request = Net::HTTP::Get.new(uri.request_uri)
30
- request['Authorization'] = authorization_header_value
31
-
32
- http.request(request)
22
+ HTTP.auth(auth).get(url(action))
33
23
  end
34
24
 
35
25
  def get_api_rating
36
26
  response = get('/api/v1/rating')
37
27
 
38
- if response.code == '200'
28
+ if response.code == 200
39
29
  response
40
30
  else
41
31
  fail InvalidApiRequestError.new("invalid response from API (CODE: #{response.code})")
@@ -45,7 +35,7 @@ module ReviewsCatcher
45
35
  def get_api_reviews
46
36
  response = get('/api/v1/reviews')
47
37
 
48
- if response.code == '200'
38
+ if response.code == 200
49
39
  response
50
40
  else
51
41
  fail InvalidApiRequestError.new("invalid response from API (CODE: #{response.code})")
@@ -1,3 +1,3 @@
1
1
  module ReviewsCatcher
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'webmock'
27
27
  spec.add_development_dependency 'forgery'
28
28
  spec.add_development_dependency 'coveralls'
29
+ spec.add_dependency 'http'
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviews_catcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Valentino
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: http
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Ruby bindings for the ReviewsCatcher API (http://wwww.reviewscatcher.io)
112
126
  email:
113
127
  - brunovalentino@gmail.com