japan_zipcode 0.1.1 → 0.1.2

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: 04ef7d7d232ee0b8f108fcad5893b36b86d3291a
4
- data.tar.gz: 0ff2930f77c20d4ae6352920fc256b01ee895aab
3
+ metadata.gz: 98e8c1fe147578e045ed769af9ead6a71bdfb3c8
4
+ data.tar.gz: f8ec32bfbf0547d839fdcd82b7e27dd9c5542939
5
5
  SHA512:
6
- metadata.gz: 9e47c60d9522cfdcc02bbe45133b75d83bd22395cf04ed9ddb8a843aba3f6fdf29f7bb4246c8ef2e8b92ef5a0cc8d050f0ef76bffb7f476b4c5883d43c4c240c
7
- data.tar.gz: 85b91b69e9e396a290e747c4878bdaf70e0dd82059c55d7faf6448a458572b113b600513f87361e4728acdc6a90dc46a8b651c05047a69b916683517338a0f54
6
+ metadata.gz: 22897dec0f93b42a9e95c9507e0ef8b839fa8fdaa979eb2bc68733a33d9959e2edb06344833d4fc704d2eed9ca08eddcf72500e7b4f1e8c45278286910b33645
7
+ data.tar.gz: 22fba40675d6770b07e1e949b4a30f047cf2e54bf9b28de7e85f4247c12974aba823d9515b0b6ba3b82f51fb31d6ac76ae3b8842bfdf0414dee6e85b5052adfe
data/README.md CHANGED
@@ -1,28 +1,40 @@
1
- # JapanZipcode
1
+ # Japan zipcode
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/japan_zipcode.svg)](https://badge.fury.io/rb/japan_zipcode)
4
+ [![Build Status](https://travis-ci.org/iuhoay/japan_zipcode.svg?branch=master)](https://travis-ci.org/iuhoay/japan_zipcode)
5
+
6
+ This is a Rails engine for Japanese cities by zipcode.
4
7
 
5
8
  ## Usage
6
9
 
10
+ You can add it to your Gemfile with:
11
+
7
12
  ```ruby
8
13
  gem 'japan_zipcode'
9
14
  ```
10
15
 
11
- and run `bundle install`
16
+ Then run `bundle install`
12
17
 
13
- Generate Migrations:
18
+ Next, you need to run the generator:
14
19
 
15
20
  ```bash
16
- $ rake japan_zipcode:install:migrations
21
+ $ rails g japan_zipcode:install
17
22
  ```
18
23
 
19
- and run `rails db:migrate`
24
+ Then run `rails db:migrate`
20
25
 
21
- Fill data:
26
+ Last, fill in cities to the database:
22
27
 
23
28
  ```bash
24
29
  $ rake japan_zipcode_data
25
30
  ```
26
31
 
32
+ #### Get city
33
+
34
+ ```ruby
35
+ JapanCity.get('1510053')
36
+ => #<JapanCity id: 39560, zipcode: "1510053", town: "東京都", city: "渋谷区", prefecture: "代々木", created_at: "2017-02-17 08:46:21", updated_at: "2017-02-17 08:46:21">
37
+ ```
38
+
27
39
  ## License
28
40
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,2 +1,3 @@
1
1
  class JapanCity < ActiveRecord::Base
2
+ include JapanZipcode::Model
2
3
  end
data/lib/japan_zipcode.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "japan_zipcode/engine"
1
+ require 'japan_zipcode/engine'
2
+ require 'japan_zipcode/model'
2
3
 
3
4
  module JapanZipcode
4
- # Your code goes here...
5
5
  end
@@ -0,0 +1,20 @@
1
+ module JapanZipcode
2
+ module Model
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ def full_name
7
+ "#{city}#{town}"
8
+ "#{town}"
9
+ end
10
+ end
11
+
12
+ module ClassMethods
13
+
14
+ def get(zipcode)
15
+ find_by_zipcode(zipcode)
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module JapanZipcode
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: japan_zipcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - iuhoay
@@ -44,7 +44,7 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0.4'
47
- description: Japan Zipcode
47
+ description: This is a Rails engine for Japanese cities by zipcode.
48
48
  email:
49
49
  - iuhoay@gmail.com
50
50
  executables: []
@@ -59,6 +59,7 @@ files:
59
59
  - lib/generators/japan_zipcode/install_generator.rb
60
60
  - lib/japan_zipcode.rb
61
61
  - lib/japan_zipcode/engine.rb
62
+ - lib/japan_zipcode/model.rb
62
63
  - lib/japan_zipcode/version.rb
63
64
  - lib/ken_all_roman.csv
64
65
  - lib/tasks/japan_zipcode_tasks.rake