README.md in bankster-client-0.0.5 vs README.md in bankster-client-0.0.6

- old
+ new

@@ -4,13 +4,13 @@ ## Installation Add this line to your application's Gemfile: -```ruby -gem 'bankster-client' -``` + ```ruby + gem 'bankster-client' + ``` And then execute: $ bundle @@ -18,29 +18,54 @@ $ gem install bankster-client ## Usage -```ruby -bank_credentials = Bankster::BankCredentials::Hbci.new({ - url: 'https://hbci11.fiducia.de/cgi-bin/hbciservlet', - bank_code: '67290000', - user_id: 'my_hbci_user_id', - pin: 'my_hbci_pin' -}) -api_key = '9daad1ea407b91745d99e78ec1602110' +Bankster::Client can be configured globaly or on instance level. -bankster_client = Bankster::Client.new(bank_credentials, api_key) +### Global Configuration: -transactions = bankster_client.transactions('my_account_number', Date.new(2016,5,1), Date.new(2016,5,11)) -``` + ```ruby + Bankster::Client.configure do + api_key = "my_api_key" + api_url = "http://bankster.io" + credentials = some_bankster_credentials + end + ``` -To override the hostname where the bankster-proxy resides, define +Afterwards, the Bankster::Client can be initialized: -```ruby -BANSTER_BASE_URI = 'http://localhost:9292' -``` + ```ruby + client = Bankster::Client.new + ``` + +### Configure every instance: + +If configuration params are given to the initializer, they override an existing global configuration: + + ```ruby + client = Bankster::Client.new(credentials: hbci_credentials, api_key: 'my_key', base_uri: 'http://some_host') + ``` + +## Credentials + +Credentials are one of `Bankster::BankCredentials::Hbci` or `Bankster::BankCredentials::Ebics`, e.g.: + + ```ruby + hbci_credentials = Bankster::BankCredentials::Hbci.new({ + url: 'https://hbci11.fiducia.de/cgi-bin/hbciservlet', + bank_code: '67290000', + user_id: 'my_hbci_user_id', + pin: 'my_hbci_pin' + }) + ``` + +## Receiving transactions + + ```ruby + transactions = client.transactions('my_account_number', Date.new(2016,5,1), Date.new(2016,5,11)) + ``` ## 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.