Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiskolabs/onnistuu_fi
Ruby gem for integrating with Onnistuu.fi
https://github.com/kiskolabs/onnistuu_fi
Last synced: about 5 hours ago
JSON representation
Ruby gem for integrating with Onnistuu.fi
- Host: GitHub
- URL: https://github.com/kiskolabs/onnistuu_fi
- Owner: kiskolabs
- Created: 2016-09-08T07:05:26.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-19T10:48:31.000Z (almost 7 years ago)
- Last Synced: 2024-10-02T14:37:58.078Z (about 1 month ago)
- Language: Ruby
- Size: 14.6 KB
- Stars: 2
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OnnistuuFi
This gem implements Onnistuu.fi API version 0.20.
[![Build Status](https://travis-ci.org/kiskolabs/onnistuu_fi.svg?branch=master)](https://travis-ci.org/kiskolabs/onnistuu_fi)
[![Maintainability](https://api.codeclimate.com/v1/badges/8d070e1360173eac0e69/maintainability)](https://codeclimate.com/github/kiskolabs/onnistuu_fi/maintainability)## Installation
Add this line to your application's Gemfile:
```ruby
gem 'onnistuu_fi'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install onnistuu_fi
## Dependencies
None.
## Usage
### Generating the form
```ruby
# Outputs the form HTMLOnnistuuFi.generate_form(
client_identifier: ENV["ONNISTUU_FI_CLIENT_ID"],
encryption_key: ENV["ONNISTUU_FI_ENCRYPTION_KEY"],
fields: {
return_failure: "https://example.com/failure",
return_success: "https://example.com/success",
document: "https://example.com/document.pdf",
button_text: "Sign the document",
requirements: [
{"type": "person", "identifier": "110761-635Y"}
]
}
)
```If you want to customize the button & other form content, pass a block to `generate_form`:
```ruby
OnnistuuFi.generate_form(options) {
"Sign document"
}
```### Processing the response
```ruby
# Returns the data from Onnistuu.fi or raises OnnistuuFi::DecodeError
OnnistuuFi.decode_response(
client_identifier: ENV["ONNISTUU_FI_CLIENT_ID"],
encryption_key: ENV["ONNISTUU_FI_ENCRYPTION_KEY"],
encrypted_data: params[:data],
iv: params[:iv])
}
```## 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](https://rubygems.org).
## TODO
- A class for verifying a document
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/kiskolabs/onnistuu_fi.
## License
The library is released under the MIT License.