EbicsCredentials is a tiny wrapper for keeping together ebics credentials.
Add this line to your application's Gemfile:
gem 'ebics_credentials'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ebics_credentials
Take a credentials hash and initialize an EbicsCredentials
instance with it.
credential_hash = {
key: "key",
url: "url",
host_id: "host_id",
user_id: "user_id",
partner_id: "partner_id"
passphrase: "passphrase",
}
credentials = EbicsCredentials.new(credential_hash)
At initialization, the completeness of the attributes will be validated. If they are invalid, EbicsCredentials::Error::Invalid
will be raised.
To create an instance from a base64 encoded json string, use .from_encoded_json
:
credential_hash = {
key: "key",
url: "url",
host_id: "host_id",
user_id: "user_id",
partner_id: "partner_id"
passphrase: "passphrase",
}
encoded_json = Base64.decode64(credential_hash.to_json)
credentials = EbicsCredentials.from_encoded_json(encoded_json)
When the given argument is not valid json, EbicsCredentials::Errors::Invalid
will be raised.
Attribute accessors are provided:
credentials.key # => "key"
credentials.host_id # => "host_id"
credentials.partner_id # => "partner_id"
credentials.user_id # => "user_id"
credentials.passphrase # => "passphrase"
After checking out the repo, run bin/setup
to install dependencies. Then, run rake rspec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Bug reports and pull requests are welcome on GitHub at https://github.com/romanlehnert/ebics_credentials.
The gem is available as open source under the terms of the MIT License.