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 +4 -4
- data/README.md +6 -0
- data/changes.txt +3 -0
- data/lib/reviews_catcher/base_service.rb +8 -18
- data/lib/reviews_catcher/version.rb +1 -1
- data/reviews_catcher.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fadc03bb07b6cf073379b6f1681709ab55f95cbf
|
4
|
+
data.tar.gz: ea91a3931ba707d85c8625d1ea6500810ce0ed4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/changes.txt
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
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
|
15
|
-
|
13
|
+
def auth
|
14
|
+
'api_key=' + @client.api_key
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
19
|
-
|
17
|
+
def url(action)
|
18
|
+
@client.base_url + action
|
20
19
|
end
|
21
20
|
|
22
21
|
def get(action)
|
23
|
-
|
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 ==
|
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 ==
|
38
|
+
if response.code == 200
|
49
39
|
response
|
50
40
|
else
|
51
41
|
fail InvalidApiRequestError.new("invalid response from API (CODE: #{response.code})")
|
data/reviews_catcher.gemspec
CHANGED
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.
|
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
|