reclame_aqui 0.0.2 → 1.0.0
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 +4 -4
- data/.gitignore +1 -0
- data/Dockerfile +12 -0
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/docker-compose.yml +9 -0
- data/lib/reclame_aqui/invalid_website_exception.rb +5 -0
- data/lib/reclame_aqui/reputation_by_website.rb +44 -40
- data/lib/reclame_aqui/version.rb +3 -1
- data/reclame_aqui.gemspec +16 -14
- data/spec/reclame_aqui/reputation_by_website_spec.rb +31 -34
- metadata +19 -34
- data/.rvmrc +0 -1
- data/reclame_aqui-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 747f2238e433feda52fb1a1d2a33c37b7abe6c7d
|
4
|
+
data.tar.gz: 6277f3053b4dfd0a81a461d99a183939f81b99c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d9bbb656416cd8aa8535d76000222421301d06a469f8cbc56bdc92b06f8d55b217e4b9daf38229a3a0c1f83d636d1a09ef16edfd51756a11e71f8d818031f58
|
7
|
+
data.tar.gz: 1c625ba83036fe472e15929b9b1419053a519f3ac26de6c7b2447a7431680c143719fa73f59942a92e3ad1e8d2118b4552f08ddc60f501ec1bb08876270ffa46
|
data/Dockerfile
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ReclameAqui
|
2
2
|
|
3
|
-
A gem that verify the reputation of a company
|
3
|
+
A gem that verify the reputation of a company on ReclameAqui(http://reclameaqui.com.br/).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
ReclameAqui.reputation("http://
|
23
|
+
ReclameAqui.reputation("http://ricardoeletro.com.br")
|
24
24
|
|
25
25
|
## Contributors
|
26
26
|
Pedro Dias( https://github.com/pdf13 )
|
data/docker-compose.yml
ADDED
@@ -1,47 +1,51 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
@website = website
|
6
|
-
end
|
3
|
+
require 'json'
|
4
|
+
require_relative 'invalid_website_exception'
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
rescue
|
13
|
-
{ error: true, reputation: {} }
|
6
|
+
module ReclameAqui
|
7
|
+
class ReputationByWebsite
|
8
|
+
def initialize(website)
|
9
|
+
@website = website
|
14
10
|
end
|
15
|
-
end
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
def reputation
|
13
|
+
begin
|
14
|
+
response = do_request
|
15
|
+
format_response JSON.parse(response.body)
|
16
|
+
rescue
|
17
|
+
raise ReclameAqui::InvalidWebsiteException
|
18
|
+
end
|
19
|
+
end
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
21
|
+
private
|
22
|
+
|
23
|
+
def do_request
|
24
|
+
uri = URI.parse 'http://app02.reclameaqui.com.br/reputacao'
|
25
|
+
http = Net::HTTP.new uri.host, uri.port
|
26
|
+
http.post uri.path, "url=#{@website}", {}
|
27
|
+
end
|
28
|
+
|
29
|
+
def format_response data
|
30
|
+
reputation = data['reputacao']
|
31
|
+
status = reputation['status'] || []
|
32
|
+
{
|
33
|
+
id: reputation['empresa_id'].to_i,
|
34
|
+
name: reputation['nome_empresa'],
|
35
|
+
period: reputation['periodo'].to_i,
|
36
|
+
status: status['status_id'].to_i,
|
37
|
+
complaints: reputation['reclamacoes'].to_i,
|
38
|
+
answered: reputation['respondidas'].to_i,
|
39
|
+
not_answered: reputation['nao_respondidas'].to_i,
|
40
|
+
measured: reputation['avaliadas'].to_i,
|
41
|
+
solution_index: reputation['indice_solucao'].to_i,
|
42
|
+
would_return: reputation['voltaria_fazer_negocio'].to_i,
|
43
|
+
grade: reputation['nota_consumidor'].to_i,
|
44
|
+
time_to_response: reputation['tempo_resposta'],
|
45
|
+
chat: reputation['chat'].to_i,
|
46
|
+
fone: reputation['fone'].to_i,
|
47
|
+
show_selo: reputation['show_selo'].to_i
|
44
48
|
}
|
45
|
-
|
49
|
+
end
|
46
50
|
end
|
47
|
-
end
|
51
|
+
end
|
data/lib/reclame_aqui/version.rb
CHANGED
data/reclame_aqui.gemspec
CHANGED
@@ -1,25 +1,27 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'reclame_aqui/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'reclame_aqui'
|
8
9
|
spec.version = ReclameAqui::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
10
|
+
spec.authors = ['Gabriel Givigier']
|
11
|
+
spec.email = ['gabriel@givigier.com.br']
|
12
|
+
spec.summary = 'Company verification on ReclameAqui.'
|
13
|
+
spec.description = 'A gem that verify the reputation of a company on ReclameAqui.'
|
14
|
+
spec.homepage = 'https://github.com/givigier/reclame_aqui'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3')
|
15
17
|
|
16
18
|
spec.files = `git ls-files -z`.split("\x0")
|
17
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_dependency 'json', '~> 2.1.0'
|
20
24
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.1.0"
|
24
|
-
spec.add_development_dependency "json", "~> 1.8.2"
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.16.3'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.8.0'
|
25
27
|
end
|
@@ -1,87 +1,84 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
context "when passing an invalid website" do
|
5
|
-
let!(:reclame_aqui){ ReclameAqui::ReputationByWebsite.new("http://").get_reputation }
|
6
|
-
let!(:error){ reclame_aqui[:error] }
|
7
|
-
let!(:reputation){ reclame_aqui[:reputation] }
|
3
|
+
require 'spec_helper'
|
8
4
|
|
9
|
-
|
10
|
-
|
5
|
+
describe ReclameAqui::ReputationByWebsite do
|
6
|
+
context 'when passing an invalid website' do
|
7
|
+
let(:reclame_aqui) do
|
8
|
+
ReclameAqui::ReputationByWebsite.new('http://')
|
11
9
|
end
|
12
10
|
|
13
|
-
it
|
14
|
-
expect
|
11
|
+
it 'should raise an InvalidWebsiteException' do
|
12
|
+
expect { reclame_aqui.reputation }
|
13
|
+
.to raise_exception(ReclameAqui::InvalidWebsiteException)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
|
-
context
|
19
|
-
let
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
it "should return a hash with error equal false" do
|
24
|
-
expect(error).to eq false
|
17
|
+
context 'when passing a valid website' do
|
18
|
+
let(:reclame_aqui) do
|
19
|
+
ReclameAqui::ReputationByWebsite
|
20
|
+
.new('http://ricardoeletro.com.br')
|
25
21
|
end
|
22
|
+
let!(:reputation) { reclame_aqui.reputation }
|
26
23
|
|
27
|
-
it
|
24
|
+
it 'should return the reputation with id' do
|
28
25
|
expect(reputation[:id]).to eq 10708
|
29
26
|
end
|
30
27
|
|
31
|
-
it
|
32
|
-
expect(reputation[:name]).to eq
|
28
|
+
it 'should return the reputation with name' do
|
29
|
+
expect(reputation[:name]).to eq 'Ricardo Eletro - Loja Online'
|
33
30
|
end
|
34
31
|
|
35
|
-
it
|
32
|
+
it 'should return the reputation with period' do
|
36
33
|
expect(reputation[:period]).to_not eq nil
|
37
34
|
end
|
38
35
|
|
39
|
-
it
|
36
|
+
it 'should return the reputation with status' do
|
40
37
|
expect(reputation[:status]).to_not eq nil
|
41
38
|
end
|
42
39
|
|
43
|
-
it
|
40
|
+
it 'should return the reputation with complaints' do
|
44
41
|
expect(reputation[:complaints]).to_not eq nil
|
45
42
|
end
|
46
43
|
|
47
|
-
it
|
44
|
+
it 'should return the reputation with answered' do
|
48
45
|
expect(reputation[:answered]).to_not eq nil
|
49
46
|
end
|
50
47
|
|
51
|
-
it
|
48
|
+
it 'should return the reputation with not_answered' do
|
52
49
|
expect(reputation[:not_answered]).to_not eq nil
|
53
50
|
end
|
54
51
|
|
55
|
-
it
|
52
|
+
it 'should return the reputation with measured' do
|
56
53
|
expect(reputation[:measured]).to_not eq nil
|
57
54
|
end
|
58
55
|
|
59
|
-
it
|
56
|
+
it 'should return the reputation with solution_index' do
|
60
57
|
expect(reputation[:solution_index]).to_not eq nil
|
61
58
|
end
|
62
59
|
|
63
|
-
it
|
60
|
+
it 'should return the reputation with would_return' do
|
64
61
|
expect(reputation[:would_return]).to_not eq nil
|
65
62
|
end
|
66
63
|
|
67
|
-
it
|
64
|
+
it 'should return the reputation with grade' do
|
68
65
|
expect(reputation[:grade]).to_not eq nil
|
69
66
|
end
|
70
67
|
|
71
|
-
it
|
68
|
+
it 'should return the reputation with time_to_response' do
|
72
69
|
expect(reputation[:time_to_response]).to_not eq nil
|
73
70
|
end
|
74
71
|
|
75
|
-
it
|
72
|
+
it 'should return the reputation with chat' do
|
76
73
|
expect(reputation[:chat]).to_not eq nil
|
77
74
|
end
|
78
75
|
|
79
|
-
it
|
76
|
+
it 'should return the reputation with fone' do
|
80
77
|
expect(reputation[:fone]).to_not eq nil
|
81
78
|
end
|
82
79
|
|
83
|
-
it
|
80
|
+
it 'should return the reputation with show_selo' do
|
84
81
|
expect(reputation[:show_selo]).to_not eq nil
|
85
82
|
end
|
86
83
|
end
|
87
|
-
end
|
84
|
+
end
|
metadata
CHANGED
@@ -1,91 +1,76 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reclame_aqui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Givigier
|
8
|
-
- Pedro Dias
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: json
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
type: :
|
19
|
+
version: 2.1.0
|
20
|
+
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - "~>"
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
26
|
+
version: 2.1.0
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
28
|
+
name: bundler
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - "~>"
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
33
|
+
version: 1.16.3
|
35
34
|
type: :development
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
40
|
+
version: 1.16.3
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: rspec
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
45
44
|
requirements:
|
46
45
|
- - "~>"
|
47
46
|
- !ruby/object:Gem::Version
|
48
|
-
version: 3.
|
47
|
+
version: 3.8.0
|
49
48
|
type: :development
|
50
49
|
prerelease: false
|
51
50
|
version_requirements: !ruby/object:Gem::Requirement
|
52
51
|
requirements:
|
53
52
|
- - "~>"
|
54
53
|
- !ruby/object:Gem::Version
|
55
|
-
version: 3.
|
56
|
-
|
57
|
-
name: json
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 1.8.2
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 1.8.2
|
70
|
-
description: A gem that verify the reputation of a company in ReclameAqui.
|
54
|
+
version: 3.8.0
|
55
|
+
description: A gem that verify the reputation of a company on ReclameAqui.
|
71
56
|
email:
|
72
|
-
- gabriel@
|
73
|
-
- pedro@agrid.com.br
|
57
|
+
- gabriel@givigier.com.br
|
74
58
|
executables: []
|
75
59
|
extensions: []
|
76
60
|
extra_rdoc_files: []
|
77
61
|
files:
|
78
62
|
- ".gitignore"
|
79
63
|
- ".rspec"
|
80
|
-
-
|
64
|
+
- Dockerfile
|
81
65
|
- Gemfile
|
82
66
|
- LICENSE.txt
|
83
67
|
- README.md
|
84
68
|
- Rakefile
|
69
|
+
- docker-compose.yml
|
85
70
|
- lib/reclame_aqui.rb
|
71
|
+
- lib/reclame_aqui/invalid_website_exception.rb
|
86
72
|
- lib/reclame_aqui/reputation_by_website.rb
|
87
73
|
- lib/reclame_aqui/version.rb
|
88
|
-
- reclame_aqui-0.0.1.gem
|
89
74
|
- reclame_aqui.gemspec
|
90
75
|
- spec/reclame_aqui/reputation_by_website_spec.rb
|
91
76
|
- spec/reclame_aqui_spec.rb
|
@@ -102,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
87
|
requirements:
|
103
88
|
- - ">="
|
104
89
|
- !ruby/object:Gem::Version
|
105
|
-
version: '
|
90
|
+
version: '2.3'
|
106
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
92
|
requirements:
|
108
93
|
- - ">="
|
@@ -110,10 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
95
|
version: '0'
|
111
96
|
requirements: []
|
112
97
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.6.3
|
114
99
|
signing_key:
|
115
100
|
specification_version: 4
|
116
|
-
summary: Company verification
|
101
|
+
summary: Company verification on ReclameAqui.
|
117
102
|
test_files:
|
118
103
|
- spec/reclame_aqui/reputation_by_website_spec.rb
|
119
104
|
- spec/reclame_aqui_spec.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm --create use ruby-2.1.5@reclame_aqui
|
data/reclame_aqui-0.0.1.gem
DELETED
Binary file
|