rubylibpostal 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -15
  3. data/lib/rubypostal/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1cd8f0354fab1e74274393509632e5aeec683169b25396ba478810b0a13bee8
4
- data.tar.gz: 0f23c3b10666f87dc7560342a0e468504d6bc8a9c90f336a2048f8fa8aa5e095
3
+ metadata.gz: 5c639429c9d512b9405efa0d25deb16fbef6b4da3263c1aa56a9692b5c6e70a5
4
+ data.tar.gz: 3db7ced50146c387faff94a0542e9fd9000d275143d025790406edcad24707b3
5
5
  SHA512:
6
- metadata.gz: 43dc285810a9143d772a37094bd1870483b1e93945b358970d434db7d015dc936177d23a9f51de73fdae590144a255a65098eaf8d8e5703c223b0c4ded78b869
7
- data.tar.gz: fe10f58b571f10176da03f2e52e015e3ceeaec30420d54a12dc61cf156179ccd5192b0a5fe0177c1971b7d45e8007284df7ecef4822684175ff97bb167e97116
6
+ metadata.gz: a9fe4729f2b44b677be124f882358b250415c2ac80c082020c0032ccc27861b19e0cc9c5e7a42427e20f9a3fdf55176c99c934eadac87454f906ea5bffb9342a
7
+ data.tar.gz: f8a56a88292646f53cd856729f931b2a6b91fdf6b48000c68871a5fe5468b781f60769fd7a3360c96b0d4e13cc3a3eb08f8b9e2ea3850fa839235a14e548b3e5
data/README.md CHANGED
@@ -1,39 +1,104 @@
1
- # Rubypostal
1
+ # rubypostal
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ `rubylibpostal` is a Ruby gem that provides seamless integration with the powerful [Libpostal](https://github.com/openvenues/libpostal) C library. It offers a clean and intuitive API for tasks related to address parsing and expansion.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rubypostal`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ ## Features
6
+
7
+ - **Address Parsing:** Extracts components of an address, such as house number, road, city, state, etc.
8
+ - **Address Expansion:** Expands an address string into its possible variations (useful for normalizing addresses).
6
9
 
7
10
  ## Installation
8
11
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
12
+ Ensure that you have [Libpostal](https://github.com/openvenues/libpostal) installed on your system. You can follow [Libpostal's installation guide](https://github.com/openvenues/libpostal#installation) to set it up.
13
+
14
+ Once Libpostal is installed, you can add this line to your Gemfile:
15
+
16
+ ```ruby
17
+ gem 'rubylibpostal'
18
+ ```
10
19
 
11
- Install the gem and add to the application's Gemfile by executing:
20
+ And then execute:
12
21
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
22
+ ```bash
23
+ $ bundle install
24
+ ```
14
25
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
26
+ Alternatively, install the gem directly using:
16
27
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
28
+ ```bash
29
+ $ gem install rubylibpostal
30
+ ```
18
31
 
19
32
  ## Usage
20
33
 
21
- TODO: Write usage instructions here
34
+ ### Address Parsing
35
+
36
+ To parse an address, simply call the `Rubypostal.parse_address` method:
37
+
38
+ ```ruby
39
+ require 'rubylibpostal'
40
+
41
+ address = "781 Franklin Ave Crown Heights Brooklyn NYC NY 11216 USA"
42
+ parsed = RubyPostal.parse_address(address)
43
+
44
+ puts parsed
45
+ # => {
46
+ # "house_number" => "781",
47
+ # "road" => "franklin ave",
48
+ # "suburb" => "crown heights",
49
+ # "city_district" => "brooklyn",
50
+ # "state" => "ny",
51
+ # "postcode" => "11216",
52
+ # "country" => "usa"
53
+ # }
54
+ ```
55
+
56
+ ### Address Expansion
57
+
58
+ To expand an address into its possible variations:
59
+
60
+ ```ruby
61
+ require 'rubylibpostal'
62
+
63
+ address = "781 Franklin Ave, Brooklyn, NYC"
64
+ expanded = RubyPostal.expand_address(address)
65
+
66
+ puts expanded
67
+ # => ["781 franklin avenue brooklyn new york city", "781 franklin avenue nyc"]
68
+ ```
69
+
70
+ ### Configuration
71
+
72
+ If you want to configure Libpostal initialization (e.g., deciding when `libpostal_setup` should run), you can set up custom configurations in your application as needed by modifying the gem's initialization block.
22
73
 
23
74
  ## Development
24
75
 
25
- 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.
76
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `rake test` to run the tests.
77
+
78
+ To install this gem onto your local machine, run:
26
79
 
27
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
80
+ ```bash
81
+ $ bundle exec rake install
82
+ ```
83
+
84
+ To release a new version, update the version number in `lib/rubylibpostal/version.rb`, and then run:
85
+
86
+ ```bash
87
+ $ bundle exec rake release
88
+ ```
28
89
 
29
90
  ## Contributing
30
91
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubypostal. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rubypostal/blob/master/CODE_OF_CONDUCT.md).
92
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/nijeesh4all/rubypostal](https://github.com/nijeesh4all/rubypostal). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nijeesh4all/rubypostal/blob/main/CODE_OF_CONDUCT.md).
32
93
 
33
94
  ## License
34
95
 
35
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
96
+ The gem is available as open-source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
97
+
98
+ ## Authors
99
+
100
+ - **Nijeesh Joshy** – nijeesh.k@rently.com
36
101
 
37
- ## Code of Conduct
102
+ ---
38
103
 
39
- Everyone interacting in the Rubypostal project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rubypostal/blob/master/CODE_OF_CONDUCT.md).
104
+ This README should provide a solid introduction for anyone using or contributing to your `rubylibpostal` gem.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubypostal
4
- VERSION = '0.1.0'
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubylibpostal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nijeesh Joshy