Git Product home page Git Product logo

postal_search_jp's Introduction

PostalSearchJp

Search addresses in Japan by postal code, and vice versa.

Travis Gem license

Requisites

  • Java 8
  • JRuby 9
  • AWS account

Installation

Add this line to your application's Gemfile:

gem 'postal_search_jp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install postal_search_jp

Setup

# Install dependencies.
$ bundle install
$ jruby -S jbundle install

# Set env variables.
# It's just samples (random generated). Use yours.
$ export AWS_ACCESS_KEY_ID="4J4BIQ863ZM4ZLOYFI6H"
$ export AWS_SECRET_ACCESS_KEY="HYXOHI93FW7QV+RGXA62CIFCT1GRMTD2DFZP4BFR"
$ export AWS_REGION="us-west-2"

Usage

# Configuration.
PostalSearchJp.configure(
  # AWS credentials can be skip to set here if you set env variables above.
  aws_access_key_id:     '4J4BIQ863ZM4ZLOYFI6H',
  aws_secret_access_key: 'HYXOHI93FW7QV+RGXA62CIFCT1GRMTD2DFZP4BFR',
  aws_region:            'us-east-1',           # Athena is only available in 'us-east-1' or 'us-west-2' currentry.
  s3_bucket:             'my-postal-search-jp',
  s3_path:               'my_postal_search_jp', # Default value is 'postal_search_jp'
  athena_db_name:        'postalsearchjp',      # Default value is 'postalsearchjp'
  athena_table_name:     'jp_postal_codes',     # Default value is 'jp_postal_codes'
)

# Upload data file S3 & define Athena schema.
# It should be called only once.
PostalSearchJp.setup

# Search by address.
PostalSearchJp.search_by_address('井の頭')
# => [#<struct PostalSearchJp::JpPostalCode postal_code="\"1810001\"", prefecture="\"東京都\"", city="\"三鷹市\"", street="\"井の頭\"", prefecture_kana="\"TOKYO TO\"", city_kana="\"MITAKA SHI\"", street_kana="\"INOKASHIRA\"">]

# Find by postal code.
PostalSearchJp.find_by_postal_code('1810001')
# => #<struct PostalSearchJp::JpPostalCode postal_code="1810001", prefecture="東京都", city="三鷹市", street="井の頭", prefecture_kana="TOKYO TO", city_kana="MITAKA SHI", street_kana="INOKASHIRA">

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tearoom6/postal_search_jp.

postal_search_jp's People

Contributors

tearoom6 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.