{"id":21696543,"url":"https://github.com/madetech/postcode_validation","last_synced_at":"2025-03-20T14:48:36.432Z","repository":{"id":147828403,"uuid":"75736049","full_name":"madetech/postcode_validation","owner":"madetech","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-29T13:16:25.000Z","size":90,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-01-25T14:11:51.244Z","etag":null,"topics":["postcode","solidus","spree","validation"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madetech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-06T13:53:56.000Z","updated_at":"2025-01-11T08:55:09.000Z","dependencies_parsed_at":"2023-04-04T17:16:48.691Z","dependency_job_id":null,"html_url":"https://github.com/madetech/postcode_validation","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madetech%2Fpostcode_validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madetech%2Fpostcode_validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madetech%2Fpostcode_validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madetech%2Fpostcode_validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madetech","download_url":"https://codeload.github.com/madetech/postcode_validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244636306,"owners_count":20485442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postcode","solidus","spree","validation"],"created_at":"2024-11-25T19:20:23.257Z","updated_at":"2025-03-20T14:48:36.406Z","avatar_url":"https://github.com/madetech.png","language":"Ruby","readme":"# PostcodeValidation [![Build Status](https://travis-ci.org/madetech/postcode_validation.svg?branch=master)](https://travis-ci.org/madetech/postcode_validation)\n\nThis gem provides basic postcode validation functionality which can be used in any application\n\nThe specific validation that we perform goes beyond simple regex matching, to determine if the postcode actually exists.\n\nTo do this it uses PCAPredict.com's Capture+ API.\nBy leveraging this service we are able to provide validation against country's postcode that they support.\n\nIt also comes with out of the box plugins for:\n\n- Solidus\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'postcode_validation'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install postcode_validation\n\n## Usage\n\nThis gem relies on ```ENV['POSTCODE_ANYWHERE_KEY']``` being set to a valid PCAPredict service key for Capture+.\n\nOne of the easiest ways to do this is to use the ```dotenv``` gem for this in your host application.\n\n### Using with Solidus\n\n```ruby\nrequire 'postcode_validation'\nrequire 'postcode_validation/plugins/solidus'\nSpree::Order.include(PostcodeValidation::SpreeOrderPostcodeValid)\n````\n\nNB: Error reporting currently only works with a Tagged Logger\n\n### Bespoke application usage\n\n```ruby\nrequire 'postcode_validation'\nuse_case = PostcodeValidation::UseCase::ValidateAddress.new(\n  address_match_gateway: PostcodeValidation::Gateway::PCAPotentialAddressMatch.new\n)\n\nvalid = use_case.execute(postcode: 'SE10SW', country: 'GB')[:valid?]\n```\n\n```\n\u003e valid\ntrue\n```\n\nCountry must be a valid 2-letter ISO country code.\nPostcode is the postcode under test.\n\n## Development\n\nAfter 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.\n\nTo 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](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/madetech/postcode_validation.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Credits\n\nDeveloped and maintained by [Made](http://www.madetech.co.uk?ref=github\u0026repo=postcode_validation).\n\n[![made](https://s3-eu-west-1.amazonaws.com/made-assets/googleapps/google-apps.png)](http://www.madetech.co.uk?ref=github\u0026repo=postcode_validation)\n\nKey contributions:\n\n* [Craig J. Bass](https://github.com/craigjbass)\n* [Seb Ashton](https://github.com/sebashton)\n* [Chris Blackburn](https://github.com/chrisblackburn)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadetech%2Fpostcode_validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadetech%2Fpostcode_validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadetech%2Fpostcode_validation/lists"}