ine-places 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -11
- data/ine-places.gemspec +2 -2
- data/lib/ine/places/csv_record.rb +9 -3
- data/lib/ine/places/place.rb +1 -1
- data/lib/ine/places/province.rb +2 -2
- data/lib/ine/places/version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1d5baf94a1ba569c3ac7935e3d5fd9faed8885f
|
4
|
+
data.tar.gz: 75728534fc49aa207cd83dcd7b96c567e3361764
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15bf45e03b9a9fa11b5addcc7f29d5e4ce833ead66e2c7764acd8ed80b1ec134a12bc282895fd199aee74eb54583c88dec03e7a606cf31da5101cddedcc2b651
|
7
|
+
data.tar.gz: 98e3a400affb297eadb45847dbe2ef548727fe25982f879f50b47d3ec16415b3927f5d54ee46db4f4bc08bf2b40af5a3fbeb2213603a585cd6986cc230142a15
|
data/README.md
CHANGED
@@ -1,22 +1,26 @@
|
|
1
1
|
# INE Places gem
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/PopulateTools/ine-places.svg)](https://travis-ci.org/PopulateTools/ine-places)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/ine-places.svg)](https://badge.fury.io/rb/ine-places)
|
4
5
|
|
5
6
|
INE Places gem aims to help you to deal with Autonomous Regions, Provinces and Municipalities from
|
6
|
-
Spain. This data is provided by the INE (Instituto Nacional Estadística) in
|
7
|
+
Spain. This data is provided by the INE (Instituto Nacional Estadística) in these URLs (see the [Data License](https://github.com/PopulateTools/ine-places/#data_license) section for details about reuse rights):
|
7
8
|
|
8
|
-
http://www.ine.es/daco/daco42/codmun/codmun11/11codmunmapa.htm
|
9
|
+
- http://www.ine.es/daco/daco42/codmun/codmun11/11codmunmapa.htm
|
10
|
+
- http://www.ine.es/jaxi/menu.do?type=pcaxis&path=/t20/e245/codmun&file=inebase&L=0
|
9
11
|
|
10
|
-
According to that webpage the data **was updated
|
11
|
-
data changes along the years: sometimes two municipalities are merged in a single one
|
12
|
-
|
12
|
+
According to that webpage the data **was updated the 3rd of February, 2015**. As you might know municipalities
|
13
|
+
data changes along the years: sometimes two municipalities are merged in a single one [more
|
14
|
+
information in Spanish](http://www.ine.es/daco/daco42/codmun/codmunmod.htm). For this
|
15
|
+
reason it's important to know the date of the data. The data included in this gem has been processed
|
16
|
+
based on the data published on the INE (so, it was processed after the 3rd of Feb, 2015).
|
13
17
|
|
14
18
|
## Installation
|
15
19
|
|
16
20
|
Add this line to your application's Gemfile:
|
17
21
|
|
18
22
|
```ruby
|
19
|
-
gem 'ine-places'
|
23
|
+
gem 'ine-places', require: 'ine/places/places'
|
20
24
|
```
|
21
25
|
|
22
26
|
And then execute:
|
@@ -29,7 +33,7 @@ Or install it yourself as:
|
|
29
33
|
|
30
34
|
## Usage
|
31
35
|
|
32
|
-
This gem provides three
|
36
|
+
This gem provides three Ruby classes:
|
33
37
|
|
34
38
|
- `INE::Places::AutonomousRegion`
|
35
39
|
|
@@ -48,7 +52,7 @@ The attributes of this model are:
|
|
48
52
|
|
49
53
|
- id: INE code
|
50
54
|
- name: the official name in the INE
|
51
|
-
- slug: a sanitized name, valid for URLs
|
55
|
+
- slug: a sanitized unique name, valid for URLs
|
52
56
|
- lon: longitude of the central point
|
53
57
|
- lat: latitude of the central point
|
54
58
|
|
@@ -87,7 +91,7 @@ The attributes of this model are:
|
|
87
91
|
|
88
92
|
- id: INE code
|
89
93
|
- name: the official name in the INE
|
90
|
-
- slug: a sanitized name, valid for URLs
|
94
|
+
- slug: a sanitized unique name, valid for URLs
|
91
95
|
- autonomous_region_id: the INE code of the autonomous region
|
92
96
|
- autonomous_region: the AutonomousRegion object
|
93
97
|
- lon: longitude of the central point
|
@@ -128,7 +132,7 @@ The attributes of this model are:
|
|
128
132
|
|
129
133
|
- id: INE code
|
130
134
|
- name: the official name in the INE
|
131
|
-
- slug: a sanitized name, valid for URLs
|
135
|
+
- slug: a sanitized unique name, valid for URLs
|
132
136
|
- province_id: the INE code of the province
|
133
137
|
- province: the Province object
|
134
138
|
- lon: longitude of the central point
|
@@ -169,7 +173,15 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
169
173
|
|
170
174
|
## Contributing
|
171
175
|
|
172
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/PopulateTools/ine-places. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
176
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/PopulateTools/ine-places. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) [code of conduct](CODE_OF_CONDUCT.md).
|
177
|
+
|
178
|
+
## Data License
|
179
|
+
|
180
|
+
We have created the CSV files we use as source for the gem to make data availabale from data extracted from INE. In spanish and according to INE's own formula:
|
181
|
+
|
182
|
+
_Elaboración propia con datos extraídos del sitio web del INE: www.ine.es_
|
183
|
+
|
184
|
+
Please read the conditions about reusing the data provided by this gem in INE's [Licensing page](http://www.ine.es/ss/Satellite?L=0&c=Page&cid=1254735849170&p=1254735849170&pagename=Ayuda%2FINELayout#) (in spanish).
|
173
185
|
|
174
186
|
## License
|
175
187
|
|
data/ine-places.gemspec
CHANGED
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.
|
30
|
+
spec.add_runtime_dependency "activesupport", "~> 4.2", ">= 4.2.4"
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.10"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
-
spec.add_development_dependency "rspec"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.3"
|
35
35
|
end
|
@@ -12,15 +12,21 @@ module INE::Places::CSVRecord
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def find_by_name(name)
|
15
|
-
|
15
|
+
raise ArgumentError if name.blank?
|
16
|
+
|
17
|
+
collection_klass.records.detect{|obj| obj.name == name }
|
16
18
|
end
|
17
19
|
|
18
20
|
def find_by_slug(slug)
|
19
|
-
|
21
|
+
raise ArgumentError if slug.blank?
|
22
|
+
|
23
|
+
collection_klass.records.detect{|obj| obj.slug == slug }
|
20
24
|
end
|
21
25
|
|
22
26
|
def find(id)
|
23
|
-
|
27
|
+
raise ArgumentError if id.blank?
|
28
|
+
|
29
|
+
collection_klass.records.detect{|obj| obj.id == id }
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
data/lib/ine/places/place.rb
CHANGED
@@ -2,7 +2,7 @@ class INE::Places::Place < OpenStruct
|
|
2
2
|
include INE::Places::CSVRecord
|
3
3
|
|
4
4
|
def self.find_all_by_province_id(province_id)
|
5
|
-
|
5
|
+
raise ArgumentError if province_id.blank?
|
6
6
|
|
7
7
|
collection_klass.records.select{ |place| place.province_id == province_id }
|
8
8
|
end
|
data/lib/ine/places/province.rb
CHANGED
@@ -2,9 +2,9 @@ class INE::Places::Province < OpenStruct
|
|
2
2
|
include INE::Places::CSVRecord
|
3
3
|
|
4
4
|
def self.find_all_by_autonomous_region_id(autonomous_region_id)
|
5
|
-
|
5
|
+
raise ArgumentError if autonomous_region_id.blank?
|
6
6
|
|
7
|
-
collection_klass.records.select{
|
7
|
+
collection_klass.records.select{|province| province.autonomous_region_id == autonomous_region_id }
|
8
8
|
end
|
9
9
|
|
10
10
|
def places
|
data/lib/ine/places/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ine-places
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Blat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: 4.2.4
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.2'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 4.2.4
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +62,16 @@ dependencies:
|
|
56
62
|
name: rspec
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
67
|
+
version: '3.3'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
74
|
+
version: '3.3'
|
69
75
|
description: Work with Spanish regions using INE codes and data
|
70
76
|
email:
|
71
77
|
- ferblape@gmail.com
|