bankster-client 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/Gemfile +2 -0
- data/README.md +43 -18
- data/Rakefile +1 -0
- data/bankster-client.gemspec +4 -3
- data/bin/console +1 -0
- data/lib/bankster/client.rb +7 -0
- data/lib/{bankster_client → bankster/client}/bank_account.rb +1 -0
- data/lib/{bankster_client → bankster/client}/client.rb +25 -6
- data/lib/bankster/client/configuration.rb +17 -0
- data/samples/ebic_transactions.rb +20 -0
- data/samples/ebic_transfer.rb +30 -0
- data/samples/hbci_transactions.rb +18 -0
- metadata +15 -13
- data/lib/bankster_client.rb +0 -16
- data/lib/bankster_client/configuration.rb +0 -17
- data/lib/bankster_client/version.rb +0 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 64029ea6a27e2f54eff6adc40ead807eeb5cb2df
         | 
| 4 | 
            +
              data.tar.gz: f30e871a722a0dc02100b5112a905249d5dd4ddf
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a5f465a79af34f299f641455ea00682bdf541a8e47dc503817c6e45425f1525128e7a91dae3aace145b1d9c03c120c416333ef1456dd0663bd4ab448889f0e8b
         | 
| 7 | 
            +
              data.tar.gz: 26e47bad8d480207e095fb7ba176452b1bb21fd84515de8eac0868ecfedcccf5e36909aa6621ba74ca4f86ba56227aef9e3e4f2493462cb30881494495138812
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -6,9 +6,9 @@ A tiny http wrapper for bankster.io | |
| 6 6 |  | 
| 7 7 | 
             
            Add this line to your application's Gemfile:
         | 
| 8 8 |  | 
| 9 | 
            -
            ```ruby
         | 
| 10 | 
            -
            gem 'bankster-client'
         | 
| 11 | 
            -
            ```
         | 
| 9 | 
            +
              ```ruby
         | 
| 10 | 
            +
              gem 'bankster-client'
         | 
| 11 | 
            +
              ```
         | 
| 12 12 |  | 
| 13 13 | 
             
            And then execute:
         | 
| 14 14 |  | 
| @@ -20,26 +20,51 @@ Or install it yourself as: | |
| 20 20 |  | 
| 21 21 | 
             
            ## Usage
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
            bank_credentials = Bankster::BankCredentials::Hbci.new({
         | 
| 25 | 
            -
              url:        'https://hbci11.fiducia.de/cgi-bin/hbciservlet',
         | 
| 26 | 
            -
              bank_code:  '67290000',
         | 
| 27 | 
            -
              user_id:    'my_hbci_user_id',
         | 
| 28 | 
            -
              pin:        'my_hbci_pin'
         | 
| 29 | 
            -
            })
         | 
| 30 | 
            -
            api_key = '9daad1ea407b91745d99e78ec1602110'
         | 
| 23 | 
            +
            Bankster::Client can be configured globaly or on instance level. 
         | 
| 31 24 |  | 
| 32 | 
            -
             | 
| 25 | 
            +
            ### Global Configuration:
         | 
| 33 26 |  | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 27 | 
            +
              ```ruby
         | 
| 28 | 
            +
              Bankster::Client.configure do
         | 
| 29 | 
            +
                api_key = "my_api_key"
         | 
| 30 | 
            +
                api_url = "http://bankster.io"
         | 
| 31 | 
            +
                credentials = some_bankster_credentials
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
              ```
         | 
| 36 34 |  | 
| 37 | 
            -
             | 
| 35 | 
            +
            Afterwards, the Bankster::Client can be initialized:
         | 
| 38 36 |  | 
| 39 | 
            -
            ```ruby
         | 
| 40 | 
            -
            BANSTER_BASE_URI = 'http://localhost:9292'
         | 
| 41 | 
            -
            ```
         | 
| 42 37 |  | 
| 38 | 
            +
              ```ruby
         | 
| 39 | 
            +
              client = Bankster::Client.new
         | 
| 40 | 
            +
              ```
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            ### Configure every instance:
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            If configuration params are given to the initializer, they override an existing global configuration:
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              ```ruby
         | 
| 47 | 
            +
              client = Bankster::Client.new(credentials: hbci_credentials, api_key: 'my_key', base_uri: 'http://some_host')
         | 
| 48 | 
            +
              ```
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            ## Credentials
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            Credentials are one of `Bankster::BankCredentials::Hbci` or `Bankster::BankCredentials::Ebics`, e.g.:
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              ```ruby
         | 
| 55 | 
            +
              hbci_credentials = Bankster::BankCredentials::Hbci.new({
         | 
| 56 | 
            +
                url:        'https://hbci11.fiducia.de/cgi-bin/hbciservlet',
         | 
| 57 | 
            +
                bank_code:  '67290000',
         | 
| 58 | 
            +
                user_id:    'my_hbci_user_id',
         | 
| 59 | 
            +
                pin:        'my_hbci_pin'
         | 
| 60 | 
            +
              })
         | 
| 61 | 
            +
              ```
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            ## Receiving transactions
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              ```ruby
         | 
| 66 | 
            +
              transactions = client.transactions('my_account_number', Date.new(2016,5,1), Date.new(2016,5,11))
         | 
| 67 | 
            +
              ```
         | 
| 43 68 |  | 
| 44 69 | 
             
            ## Development
         | 
| 45 70 |  | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/bankster-client.gemspec
    CHANGED
    
    | @@ -1,10 +1,11 @@ | |
| 1 1 | 
             
            # coding: utf-8
         | 
| 2 | 
            +
            # frozen_string_literal: true
         | 
| 2 3 | 
             
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 4 | 
             
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 5 |  | 
| 5 6 | 
             
            Gem::Specification.new do |spec|
         | 
| 6 7 | 
             
              spec.name          = 'bankster-client'
         | 
| 7 | 
            -
              spec.version       = '0.0. | 
| 8 | 
            +
              spec.version       = '0.0.6'
         | 
| 8 9 | 
             
              spec.authors       = ['Roman Lehnert', 'Alexander Klaiber']
         | 
| 9 10 | 
             
              spec.email         = ['mail@bankster.io']
         | 
| 10 11 |  | 
| @@ -25,9 +26,9 @@ Gem::Specification.new do |spec| | |
| 25 26 | 
             
              spec.require_paths = ['lib']
         | 
| 26 27 |  | 
| 27 28 | 
             
              spec.add_runtime_dependency 'httparty'
         | 
| 28 | 
            -
              spec.add_runtime_dependency 'bankster-bank_credentials'
         | 
| 29 | 
            +
              spec.add_runtime_dependency 'bankster-bank_credentials', '~> 0.1.5'
         | 
| 29 30 |  | 
| 30 31 | 
             
              spec.add_development_dependency 'bundler', '~> 1.12'
         | 
| 31 | 
            -
              spec.add_development_dependency 'rake', '~>  | 
| 32 | 
            +
              spec.add_development_dependency 'rake', '~> 11.0'
         | 
| 32 33 | 
             
              spec.add_development_dependency 'rspec', '~> 3.0'
         | 
| 33 34 | 
             
            end
         | 
    
        data/bin/console
    CHANGED
    
    
| @@ -1,13 +1,25 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            module Bankster
         | 
| 2 3 | 
             
              class Client
         | 
| 3 4 | 
             
                include HTTParty
         | 
| 4 5 |  | 
| 5 | 
            -
                 | 
| 6 | 
            +
                attr_reader :credentials
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def self.configuration
         | 
| 9 | 
            +
                  Configuration.instance
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def self.configure
         | 
| 13 | 
            +
                  yield Configuration.instance
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                def initialize(credentials)
         | 
| 17 | 
            +
                  @credentials = credentials
         | 
| 6 18 | 
             
                  @options = {
         | 
| 7 | 
            -
                    base_uri:  | 
| 19 | 
            +
                    base_uri: self.class.configuration.api_url,
         | 
| 8 20 | 
             
                    headers: {
         | 
| 9 | 
            -
                      'Api-Key'  | 
| 10 | 
            -
                      'Bank-Credentials'  | 
| 21 | 
            +
                      'Api-Key': self.class.configuration.api_key,
         | 
| 22 | 
            +
                      'Bank-Credentials': encoded_credentials
         | 
| 11 23 | 
             
                    }
         | 
| 12 24 | 
             
                  }
         | 
| 13 25 | 
             
                end
         | 
| @@ -32,7 +44,14 @@ module BanksterClient | |
| 32 44 | 
             
                    }
         | 
| 33 45 | 
             
                  )
         | 
| 34 46 | 
             
                  response = self.class.post('/transfers', attributes)
         | 
| 35 | 
            -
                  raise(response.body)  | 
| 47 | 
            +
                  raise(response.body) if !response.code.eql?(200) && !response.code.eql?(201)
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                private
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                def encoded_credentials
         | 
| 53 | 
            +
                  raise 'No credentials given' unless credentials
         | 
| 54 | 
            +
                  credentials.encode
         | 
| 36 55 | 
             
                end
         | 
| 37 56 | 
             
              end
         | 
| 38 57 | 
             
            end
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require 'singleton'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Bankster
         | 
| 5 | 
            +
              class Client
         | 
| 6 | 
            +
                class Configuration
         | 
| 7 | 
            +
                  include Singleton
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  attr_accessor :api_url
         | 
| 10 | 
            +
                  attr_accessor :api_key
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def initialize
         | 
| 13 | 
            +
                    @api_url = 'http://bankster-proxy-prod.eu-central-1.elasticbeanstalk.com'
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require '../lib/bankster/client'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Bankster::Client.configure do |config|
         | 
| 5 | 
            +
              config.api_url = ''
         | 
| 6 | 
            +
              config.api_key = ''
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            credentials = Bankster::BankCredentials::Ebics.new(
         | 
| 10 | 
            +
              key: '',
         | 
| 11 | 
            +
              user_id: '',
         | 
| 12 | 
            +
              passphrase: '',
         | 
| 13 | 
            +
              host_id: '',
         | 
| 14 | 
            +
              partner_id: '',
         | 
| 15 | 
            +
              url: ''
         | 
| 16 | 
            +
            )
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            client = Bankster::Client.new(credentials)
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            puts client.transactions('100490016', Date.new(2016, 7, 22), Date.new(2016, 7, 22))
         | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require '../lib/bankster/client'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Bankster::Client.configure do |config|
         | 
| 5 | 
            +
              config.api_url = ''
         | 
| 6 | 
            +
              config.api_key = ''
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            credentials = Bankster::BankCredentials::Ebics.new(
         | 
| 10 | 
            +
              key: '',
         | 
| 11 | 
            +
              user_id: '',
         | 
| 12 | 
            +
              passphrase: '',
         | 
| 13 | 
            +
              host_id: '',
         | 
| 14 | 
            +
              partner_id: '',
         | 
| 15 | 
            +
              url: ''
         | 
| 16 | 
            +
            )
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            client = Bankster::Client.new(credentials)
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            sending_account = BanksterClient::BankAccount.new('', '', '')
         | 
| 21 | 
            +
            receiving_account = BanksterClient::BankAccount.new('', '', '')
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            puts client.transfer(
         | 
| 24 | 
            +
              sending_account,
         | 
| 25 | 
            +
              receiving_account,
         | 
| 26 | 
            +
              1000,
         | 
| 27 | 
            +
              'S UL 671891175',
         | 
| 28 | 
            +
              '5791ffa538f8846d596accdb',
         | 
| 29 | 
            +
              '5791ffa538f8846d596accdb'
         | 
| 30 | 
            +
            )
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require '../lib/bankster/client'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Bankster::Client.configure do |config|
         | 
| 5 | 
            +
              config.api_url = ''
         | 
| 6 | 
            +
              config.api_key = ''
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            credentials = Bankster::BankCredentials::Hbci.new(
         | 
| 10 | 
            +
              url: '',
         | 
| 11 | 
            +
              bank_code: '',
         | 
| 12 | 
            +
              user_id: '',
         | 
| 13 | 
            +
              pin: ''
         | 
| 14 | 
            +
            )
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            client = Bankster::Client.new(credentials)
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            puts client.transactions('490016', Date.new(2016, 7, 22), Date.new(2016, 7, 22))
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bankster-client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Roman Lehnert
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: exe
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2016- | 
| 12 | 
            +
            date: 2016-08-19 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: httparty
         | 
| @@ -29,16 +29,16 @@ dependencies: | |
| 29 29 | 
             
              name: bankster-bank_credentials
         | 
| 30 30 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 31 31 | 
             
                requirements:
         | 
| 32 | 
            -
                - - " | 
| 32 | 
            +
                - - "~>"
         | 
| 33 33 | 
             
                  - !ruby/object:Gem::Version
         | 
| 34 | 
            -
                    version:  | 
| 34 | 
            +
                    version: 0.1.5
         | 
| 35 35 | 
             
              type: :runtime
         | 
| 36 36 | 
             
              prerelease: false
         | 
| 37 37 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 38 38 | 
             
                requirements:
         | 
| 39 | 
            -
                - - " | 
| 39 | 
            +
                - - "~>"
         | 
| 40 40 | 
             
                  - !ruby/object:Gem::Version
         | 
| 41 | 
            -
                    version:  | 
| 41 | 
            +
                    version: 0.1.5
         | 
| 42 42 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 43 43 | 
             
              name: bundler
         | 
| 44 44 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -59,14 +59,14 @@ dependencies: | |
| 59 59 | 
             
                requirements:
         | 
| 60 60 | 
             
                - - "~>"
         | 
| 61 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 62 | 
            -
                    version: ' | 
| 62 | 
            +
                    version: '11.0'
         | 
| 63 63 | 
             
              type: :development
         | 
| 64 64 | 
             
              prerelease: false
         | 
| 65 65 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 66 66 | 
             
                requirements:
         | 
| 67 67 | 
             
                - - "~>"
         | 
| 68 68 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version: ' | 
| 69 | 
            +
                    version: '11.0'
         | 
| 70 70 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 71 71 | 
             
              name: rspec
         | 
| 72 72 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -101,11 +101,13 @@ files: | |
| 101 101 | 
             
            - bankster-client.gemspec
         | 
| 102 102 | 
             
            - bin/console
         | 
| 103 103 | 
             
            - bin/setup
         | 
| 104 | 
            -
            - lib/ | 
| 105 | 
            -
            - lib/ | 
| 106 | 
            -
            - lib/ | 
| 107 | 
            -
            - lib/ | 
| 108 | 
            -
            -  | 
| 104 | 
            +
            - lib/bankster/client.rb
         | 
| 105 | 
            +
            - lib/bankster/client/bank_account.rb
         | 
| 106 | 
            +
            - lib/bankster/client/client.rb
         | 
| 107 | 
            +
            - lib/bankster/client/configuration.rb
         | 
| 108 | 
            +
            - samples/ebic_transactions.rb
         | 
| 109 | 
            +
            - samples/ebic_transfer.rb
         | 
| 110 | 
            +
            - samples/hbci_transactions.rb
         | 
| 109 111 | 
             
            homepage: http://bankster.io
         | 
| 110 112 | 
             
            licenses:
         | 
| 111 113 | 
             
            - MIT
         | 
    
        data/lib/bankster_client.rb
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            require 'httparty'
         | 
| 2 | 
            -
            require 'bankster/bank_credentials'
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require_relative 'bankster_client/configuration'
         | 
| 5 | 
            -
            require_relative 'bankster_client/client'
         | 
| 6 | 
            -
            require_relative 'bankster_client/bank_account'
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            module BanksterClient
         | 
| 9 | 
            -
              def self.configuration
         | 
| 10 | 
            -
                Configuration.instance
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              def self.configure
         | 
| 14 | 
            -
                yield Configuration.instance
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
            end
         | 
| @@ -1,17 +0,0 @@ | |
| 1 | 
            -
            require 'singleton'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module BanksterClient
         | 
| 4 | 
            -
              class Configuration
         | 
| 5 | 
            -
                include Singleton
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                attr_accessor :api, :api_key
         | 
| 8 | 
            -
             | 
| 9 | 
            -
                def credentials=(credentials)
         | 
| 10 | 
            -
                  @hbci_credentials = Bankster::BankCredentials::Hbci.new(credentials)
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                def credentials
         | 
| 14 | 
            -
                  @hbci_credentials
         | 
| 15 | 
            -
                end
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
            end
         |