fipextractor 0.0.1 → 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 +50 -50
- data/.rspec +3 -0
- data/.rspec_status +31 -0
- data/.travis.yml +7 -0
- data/Gemfile +7 -3
- data/LICENSE +21 -0
- data/README.md +88 -118
- data/Rakefile +6 -10
- data/fipextractor.gemspec +29 -21
- data/lib/fipextractor.rb +9 -40
- data/lib/fipextractor/brand.rb +24 -0
- data/lib/fipextractor/brand_response.rb +7 -0
- data/lib/fipextractor/converter/vehicle_type.rb +16 -0
- data/lib/fipextractor/model.rb +26 -0
- data/lib/fipextractor/model_response.rb +15 -0
- data/lib/fipextractor/model_through_year.rb +30 -0
- data/lib/fipextractor/model_through_year_response.rb +7 -0
- data/lib/fipextractor/model_year.rb +28 -0
- data/lib/fipextractor/model_year_response.rb +7 -0
- data/lib/fipextractor/reference_table.rb +10 -0
- data/lib/fipextractor/reference_table_response.rb +7 -0
- data/lib/fipextractor/request.rb +53 -0
- data/lib/fipextractor/resource.rb +10 -0
- data/lib/fipextractor/response.rb +16 -0
- data/lib/fipextractor/vehicle.rb +39 -0
- data/lib/fipextractor/vehicle_response.rb +7 -0
- data/lib/fipextractor/version.rb +3 -0
- metadata +67 -33
- data/lib/fipextractor/api_parameter/parameter_converter.rb +0 -39
- data/lib/fipextractor/api_parameter/parameter_validator.rb +0 -46
- data/lib/fipextractor/api_response/brand_response_converter.rb +0 -10
- data/lib/fipextractor/api_response/model_response_converter.rb +0 -45
- data/lib/fipextractor/api_response/model_through_year_response_converter.rb +0 -10
- data/lib/fipextractor/api_response/response_converter.rb +0 -60
- data/lib/fipextractor/api_response/response_converter_builder.rb +0 -22
- data/lib/fipextractor/fipe_api/api_factory.rb +0 -12
- data/lib/fipextractor/fipe_api/api_requester.rb +0 -49
- data/lib/fipextractor/fipe_api/api_response.rb +0 -23
- data/test/parameter_converter_spec.rb +0 -23
- data/test/parameter_validator_spec.rb +0 -67
- data/test/response_converter_spec.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947417125d10b74d823ed81ebc3834a8ac6d505d
|
4
|
+
data.tar.gz: 51ef7702055873c3db28fa3d088ed95c7144b209
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f57812ad1e28187eacddda651ca87db6844a2adee0058f862aa359cd25562b1bdfacfec04812e61cb0ac6f935a3342e19cc2c1c0417ec07ab89922bf695c43d
|
7
|
+
data.tar.gz: e634ac79351a2691182c9fd63e9c7aae1a05c540ea6f16c2048feb6df8da0dc1ad39ff96a7548d5f87e630be98a646285448b8ab0a6873bcc1fbc73e348ec873
|
data/.gitignore
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/spec/examples.txt
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
|
-
/tmp/
|
12
|
-
|
13
|
-
# Used by dotenv library to load environment variables.
|
14
|
-
# .env
|
15
|
-
|
16
|
-
## Specific to RubyMotion:
|
17
|
-
.dat*
|
18
|
-
.repl_history
|
19
|
-
build/
|
20
|
-
*.bridgesupport
|
21
|
-
build-iPhoneOS/
|
22
|
-
build-iPhoneSimulator/
|
23
|
-
|
24
|
-
## Specific to RubyMotion (use of CocoaPods):
|
25
|
-
#
|
26
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
-
#
|
30
|
-
# vendor/Pods/
|
31
|
-
|
32
|
-
## Documentation cache and generated files:
|
33
|
-
/.yardoc/
|
34
|
-
/_yardoc/
|
35
|
-
/doc/
|
36
|
-
/rdoc/
|
37
|
-
|
38
|
-
## Environment normalization:
|
39
|
-
/.bundle/
|
40
|
-
/vendor/bundle
|
41
|
-
/lib/bundler/man/
|
42
|
-
|
43
|
-
# for a library or gem, you might want to ignore these files since the code is
|
44
|
-
# intended to run in multiple environments; otherwise, check them in:
|
45
|
-
Gemfile.lock
|
46
|
-
# .ruby-version
|
47
|
-
# .ruby-gemset
|
48
|
-
|
49
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
-
.rvmrc
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/.rspec
ADDED
data/.rspec_status
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
--------------------------------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/lib/fipextractor/brand_spec.rb[1:1:1] | passed | 0.00105 seconds |
|
4
|
+
./spec/lib/fipextractor/brand_spec.rb[1:2:1] | passed | 0.00031 seconds |
|
5
|
+
./spec/lib/fipextractor/converter/vehicle_type_spec.rb[1:1:1:1] | passed | 0.00016 seconds |
|
6
|
+
./spec/lib/fipextractor/converter/vehicle_type_spec.rb[1:1:2:1] | passed | 0.00013 seconds |
|
7
|
+
./spec/lib/fipextractor/converter/vehicle_type_spec.rb[1:1:3:1] | passed | 0.00012 seconds |
|
8
|
+
./spec/lib/fipextractor/converter/vehicle_type_spec.rb[1:1:4:1] | passed | 0.00013 seconds |
|
9
|
+
./spec/lib/fipextractor/model_response_spec.rb[1:1:1] | passed | 0.00044 seconds |
|
10
|
+
./spec/lib/fipextractor/model_response_spec.rb[1:2:1] | passed | 0.00028 seconds |
|
11
|
+
./spec/lib/fipextractor/model_spec.rb[1:1:1] | passed | 0.00022 seconds |
|
12
|
+
./spec/lib/fipextractor/model_spec.rb[1:2:1] | passed | 0.0003 seconds |
|
13
|
+
./spec/lib/fipextractor/model_through_year_spec.rb[1:1:1] | passed | 0.0002 seconds |
|
14
|
+
./spec/lib/fipextractor/model_through_year_spec.rb[1:2:1:1] | passed | 0.00052 seconds |
|
15
|
+
./spec/lib/fipextractor/model_through_year_spec.rb[1:2:1:2:1] | passed | 0.00034 seconds |
|
16
|
+
./spec/lib/fipextractor/model_year_spec.rb[1:1:1] | passed | 0.00015 seconds |
|
17
|
+
./spec/lib/fipextractor/model_year_spec.rb[1:2:1] | passed | 0.00025 seconds |
|
18
|
+
./spec/lib/fipextractor/reference_table_spec.rb[1:1:1] | passed | 0.0002 seconds |
|
19
|
+
./spec/lib/fipextractor/request_spec.rb[1:1:1:1] | passed | 0.0072 seconds |
|
20
|
+
./spec/lib/fipextractor/request_spec.rb[1:1:2:1] | passed | 0.0016 seconds |
|
21
|
+
./spec/lib/fipextractor/request_spec.rb[1:2:1] | passed | 0.00311 seconds |
|
22
|
+
./spec/lib/fipextractor/request_spec.rb[1:3:1] | passed | 0.00017 seconds |
|
23
|
+
./spec/lib/fipextractor/request_spec.rb[1:4:1] | passed | 0.00035 seconds |
|
24
|
+
./spec/lib/fipextractor/request_spec.rb[1:5:1] | passed | 0.00079 seconds |
|
25
|
+
./spec/lib/fipextractor/request_spec.rb[1:6:1] | passed | 0.00022 seconds |
|
26
|
+
./spec/lib/fipextractor/request_spec.rb[1:7:1] | passed | 0.00043 seconds |
|
27
|
+
./spec/lib/fipextractor/resource_spec.rb[1:1:1] | passed | 0.0004 seconds |
|
28
|
+
./spec/lib/fipextractor/response_spec.rb[1:1:1:1] | passed | 0.00034 seconds |
|
29
|
+
./spec/lib/fipextractor/response_spec.rb[1:1:2:1] | passed | 0.00035 seconds |
|
30
|
+
./spec/lib/fipextractor/vehicle_spec.rb[1:1:1] | passed | 0.00023 seconds |
|
31
|
+
./spec/lib/fipextractor/vehicle_spec.rb[1:2:1] | passed | 0.00043 seconds |
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Henrique Aparecido Lavezzo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,118 +1,88 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
Output:
|
90
|
-
|
91
|
-
````ruby
|
92
|
-
{:brand_name=>"AGRALE", :brand_id=>"102"}
|
93
|
-
{:brand_name=>"CHEVROLET", :brand_id=>"103"}
|
94
|
-
{:brand_name=>"CICCOBUS", :brand_id=>"121"}
|
95
|
-
{:brand_name=>"DAF", :brand_id=>"197"}
|
96
|
-
{:brand_name=>"EFFA-JMC", :brand_id=>"179"}
|
97
|
-
{:brand_name=>"FIAT", :brand_id=>"104"}
|
98
|
-
{:brand_name=>"FORD", :brand_id=>"105"}
|
99
|
-
{:brand_name=>"FOTON", :brand_id=>"191"}
|
100
|
-
{:brand_name=>"GMC", :brand_id=>"106"}
|
101
|
-
{:brand_name=>"HYUNDAI", :brand_id=>"181"}
|
102
|
-
{:brand_name=>"IVECO", :brand_id=>"122"}
|
103
|
-
{:brand_name=>"MAN", :brand_id=>"184"}
|
104
|
-
{:brand_name=>"MARCOPOLO", :brand_id=>"108"}
|
105
|
-
{:brand_name=>"MASCARELLO", :brand_id=>"196"}
|
106
|
-
{:brand_name=>"MAXIBUS", :brand_id=>"194"}
|
107
|
-
{:brand_name=>"MERCEDES-BENZ", :brand_id=>"109"}
|
108
|
-
{:brand_name=>"NAVISTAR", :brand_id=>"110"}
|
109
|
-
{:brand_name=>"NEOBUS", :brand_id=>"111"}
|
110
|
-
{:brand_name=>"PUMA-ALFA", :brand_id=>"112"}
|
111
|
-
{:brand_name=>"SAAB-SCANIA", :brand_id=>"113"}
|
112
|
-
{:brand_name=>"SCANIA", :brand_id=>"114"}
|
113
|
-
{:brand_name=>"SHACMAN", :brand_id=>"193"}
|
114
|
-
{:brand_name=>"SINOTRUK", :brand_id=>"166"}
|
115
|
-
{:brand_name=>"VOLKSWAGEN", :brand_id=>"115"}
|
116
|
-
{:brand_name=>"VOLVO", :brand_id=>"116"}
|
117
|
-
{:brand_name=>"WALKBUS", :brand_id=>"144"}
|
118
|
-
````
|
1
|
+
# FipExtractor
|
2
|
+
|
3
|
+
Unofficial client gem for FIPE vehicle table.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line in your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'fipextractor', '~> 1.0'
|
11
|
+
```
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or
|
16
|
+
|
17
|
+
$ gem install fipextractor
|
18
|
+
|
19
|
+
## Implemented Calls
|
20
|
+
|
21
|
+
- [ReferenceTable](#referencetable)
|
22
|
+
- [Brand](#brand)
|
23
|
+
- [Model](#Model)
|
24
|
+
- [ModelYear](#modelyear)
|
25
|
+
- [ModelThroughYear](#modelthroughyear)
|
26
|
+
- [Vehicle](#vehicle)
|
27
|
+
|
28
|
+
### ReferenceTable
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
response = FipExtractor::ReferenceTable.new.call
|
32
|
+
response.all # array of reference tables id
|
33
|
+
```
|
34
|
+
|
35
|
+
### Brand
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
response = FipExtractor::Brand.new(vehicle_type: :car, reference_table_id: 66).call
|
39
|
+
response.all # array of vehicle brands
|
40
|
+
```
|
41
|
+
|
42
|
+
### Model
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
response = FipExtractor::Model.new(vehicle_type: :car, reference_table_id: 66, brand_id: 44).call
|
46
|
+
response.all # array of model and years
|
47
|
+
response.models # array of model hashes
|
48
|
+
response.years # array of year designated
|
49
|
+
```
|
50
|
+
|
51
|
+
### ModelYear
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
response = FipExtractor::ModelYear.new(vehicle_type: :car, reference_table_id: 66, brand_id: 44, model_id: 1878).call
|
55
|
+
response.all # array of models with aging
|
56
|
+
```
|
57
|
+
|
58
|
+
### ModelThroughYear
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
response = FipExtractor::ModelThroughYear.new(vehicle_type: :car, reference_table_id: 66, brand_id: 44, year: 1999, fuel: 1).call
|
62
|
+
response.all # array of models ordered by year, and/or fuel filter
|
63
|
+
```
|
64
|
+
|
65
|
+
### Vehicle
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
response = FipExtractor::Vehicle.new(vehicle_type: :car, reference_table_id: 237, brand_id: 59, model_id: 2365, year: 1999, fuel: 3).call
|
69
|
+
response.details # detailed fipe information of vehicle
|
70
|
+
```
|
71
|
+
|
72
|
+
#### Vehicle Types
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
{ car: 1, motorcycle: 2, truck: 3 }
|
76
|
+
```
|
77
|
+
|
78
|
+
### Tests
|
79
|
+
|
80
|
+
`rake spec`
|
81
|
+
|
82
|
+
### Console
|
83
|
+
|
84
|
+
`bundle console`
|
85
|
+
|
86
|
+
## License
|
87
|
+
|
88
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
t.verbose = true
|
8
|
-
end
|
9
|
-
|
10
|
-
task :default => :test
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
data/fipextractor.gemspec
CHANGED
@@ -1,21 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "fipextractor/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fipextractor"
|
8
|
+
spec.version = FipExtractor::VERSION
|
9
|
+
spec.authors = ["Henrique A. Lavezzo"]
|
10
|
+
spec.email = ["me@hlavezzo.run"]
|
11
|
+
|
12
|
+
spec.summary = %q{Parsing fixed width files made easy}
|
13
|
+
spec.homepage = "https://github.com/Rynaro/estratto"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency('faraday', '~> 0.15')
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "pry-nav"
|
29
|
+
end
|