pinas 0.1.1 → 0.2.0

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: 1f24f640235536f7258f55f26ad505de4e2117fb
4
- data.tar.gz: b0898fc6b0e79a1053b7d5afc5d57bebee24cf2f
3
+ metadata.gz: 7f3e0589de892a856a621dab3247b245fa0c72c2
4
+ data.tar.gz: fb51bfa96a76568878edbefd459e1c0d8f3b20d2
5
5
  SHA512:
6
- metadata.gz: 7873da1d3510f07b848eaf49266e62025505b702206dfbc007e0415357664bb28e58adc97dbcf156ae6a73c63a0f9e8687f5bd37a0ffc2e04bc9270155757420
7
- data.tar.gz: 61cd6598a685226c400186ffc324a7aa460a6916c3208b86bba46226cd1e2b2d88507cae201d1b88286ed65181b8b1f11c3b357f6816fa0aef6b2a36858d30d1
6
+ metadata.gz: f839829bd90ca9c479531ceec0884f4f034c6c34957ecfeba598a44a4b22a44343bb7cfc55d48f4f633679abe2d37e490a4d176b792d0a8cf65a31f8abce5e4f
7
+ data.tar.gz: 926674ff93cb19e2c609332843c235085c3eda39f2d20347798f2d58b21cf60d431c39e0b08091b11a1b61e17f6f4fdbe8faa9281a56079e0b85d127e57fbefd
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
+ script: "bundle exec rspec spec"
8
+ before_install:
9
+ - gem install bundler
10
+ notifications:
11
+ email:
12
+ - allan.andal@gmail.com
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Pinas
2
2
 
3
- This gem provides hierarchical listing of Philippine location.
3
+ [![Gem Version](https://badge.fury.io/rb/pinas.svg)](http://badge.fury.io/rb/pinas)
4
+ [![Build Status](https://travis-ci.org/pangkalizer/pinas.svg?branch=master)](https://travis-ci.org/pangkalizer/pinas)
5
+
6
+ ![Pinas](philippines.png) This gem provides hierarchical listing of Philippine location.
4
7
 
5
8
  ## Installation
6
9
 
@@ -28,28 +31,50 @@ Or install it yourself as:
28
31
 
29
32
  The gem provides ActiveRecord model `Pinas::Location` in 4 levels of locations
30
33
 
31
- $ # All regions
32
- $ Pinas::Location.regions
34
+ # All regions
35
+ Pinas::Location.regions
33
36
 
34
- $ # All provinces
35
- $ Pinas::Location.provinces
37
+ # All provinces
38
+ Pinas::Location.provinces
36
39
 
37
- $ # All towns
38
- $ Pinas::Location.towns
40
+ # All towns
41
+ Pinas::Location.towns
39
42
 
40
- $ # All barangays
41
- $ Pinas::Location.barangays
43
+ # All barangays
44
+ Pinas::Location.barangays
42
45
 
43
46
  Or you can get sub locations
44
- $ # get single location
45
- $ batangas_province = Pinas::Location.where(name: 'BATANGAS').first # returns Batangas Province
47
+
48
+ # get single location
49
+ batangas_province = Pinas::Location.where(name: 'BATANGAS').first # returns Batangas Province
46
50
 
47
- $ # get all towns in Batangas
48
- $ towns = batangas_province.towns
51
+ # get all towns in Batangas
52
+ towns = batangas_province.towns
53
+
54
+ Get location coordinates
55
+
56
+ batangas_province.coordinates
57
+
58
+ Get formatted display
59
+
60
+ batangas_province.formatted_display
61
+
62
+ Or you may want to extend the model
63
+
64
+ class Location < Pinas::Location
65
+ end
66
+
49
67
 
50
68
  ## Caveats
51
69
 
52
- At the moment this gem supports Rails 4.x using Mysql database
70
+ At the moment this gem only supports Ruby >= 1.9.3, Rails 4.x and Mysql adapter
71
+
72
+
73
+ ## TODO
74
+
75
+ * Write tests
76
+ * Support other ORM
77
+ * Provide geo-polygons
53
78
 
54
79
 
55
80
  ## Contributing
@@ -1 +1,2 @@
1
- HEY
1
+
2
+
@@ -14,7 +14,7 @@ class CreatePinasTables < ActiveRecord::Migration
14
14
  t.string :postcode
15
15
  t.string :longitude
16
16
  t.string :latitude
17
- t.timestamps null: false
17
+ t.timestamps null: false, default: Time.now
18
18
  end
19
19
  add_index :locations, :parent_id
20
20
  add_index :locations, :postcode