README.md in valnzbn-0.1.1 vs README.md in valnzbn-0.1.2

- old
+ new

@@ -1,10 +1,9 @@ # Valnzbn -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/valnzbn`. To experiment with that code, run `bin/console` for an interactive prompt. +A simple wrapper to check New Zealand business numbers. -TODO: Delete this and the text above, and describe your gem ## Installation Add this line to your application's Gemfile: @@ -20,24 +19,54 @@ $ gem install valnzbn ## Usage -TODO: Write usage instructions here +If you just need to check the format of the ABN, just use: -## Development +```ruby +require 'valnzbn' -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. +Valnzbn::Utils.validate_format(number) #=> Boolean +``` -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](https://rubygems.org). +In order to lookup real NZBN, you'll need to get an access token. Once you've got one initialize the gem like this: -## Contributing +```ruby +require 'valnzbn' -Bug reports and pull requests are welcome on GitHub at https://github.com/xxswingxx/valnzbn. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. +Valnzbn::Lookup.configure do |config| + config.access_token = 'your_access_token' + config.mode = :production # (optional):production or :sandbox + config.cache_host = 'localhost' # (optional) The host of the redis server + config.cache_port = '6379' # (optional) The port of the redis server +end +``` +`cache_host` and `cache_port` are optional configuration attributes in order to keep a cache on a redis database. The current cache configuration lives up to two hours. + +After that, you can invoke + +```ruby +Valabn::Lookup.validate(abn) #=> Hash or nil + +# or + +number = Valabn.new(abn) +number.exists? #=> Boolean +number.exists?(details: true) #=> Hash, false or nil +``` + +`nil` is a value that should be rarely returned. Just check it if the NZBN API endpoint has issues. + + ## License -The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). +(The MIT License) -## Code of Conduct +Copyright © 2018 Quaderno -Everyone interacting in the Valnzbn project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/xxswingxx/valnzbn/blob/master/CODE_OF_CONDUCT.md). +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file