rubylibpostal 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +80 -15
- data/lib/rubypostal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c639429c9d512b9405efa0d25deb16fbef6b4da3263c1aa56a9692b5c6e70a5
|
4
|
+
data.tar.gz: 3db7ced50146c387faff94a0542e9fd9000d275143d025790406edcad24707b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9fe4729f2b44b677be124f882358b250415c2ac80c082020c0032ccc27861b19e0cc9c5e7a42427e20f9a3fdf55176c99c934eadac87454f906ea5bffb9342a
|
7
|
+
data.tar.gz: f8a56a88292646f53cd856729f931b2a6b91fdf6b48000c68871a5fe5468b781f60769fd7a3360c96b0d4e13cc3a3eb08f8b9e2ea3850fa839235a14e548b3e5
|
data/README.md
CHANGED
@@ -1,39 +1,104 @@
|
|
1
|
-
#
|
1
|
+
# rubypostal
|
2
2
|
|
3
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
20
|
+
And then execute:
|
12
21
|
|
13
|
-
|
22
|
+
```bash
|
23
|
+
$ bundle install
|
24
|
+
```
|
14
25
|
|
15
|
-
|
26
|
+
Alternatively, install the gem directly using:
|
16
27
|
|
17
|
-
|
28
|
+
```bash
|
29
|
+
$ gem install rubylibpostal
|
30
|
+
```
|
18
31
|
|
19
32
|
## Usage
|
20
33
|
|
21
|
-
|
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.
|
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
|
-
|
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/
|
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
|
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
|
-
|
102
|
+
---
|
38
103
|
|
39
|
-
|
104
|
+
This README should provide a solid introduction for anyone using or contributing to your `rubylibpostal` gem.
|
data/lib/rubypostal/version.rb
CHANGED