Sha256: 82f00975206573e6625d8b87f51ed656f1a527dcb48474cc9807b878cb8cc72f

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

module Flinks
  module API
    module Statement

      StatementRequestSchema = Dry::Validation.Schema do
        optional(:accounts_filter).each(:str?)
        optional(:number_of_statements).included_in?(['MostRecent', 'Months3', 'Months12'])
        optional(:most_recent).maybe(:bool?)
        optional(:most_recent_cached).maybe(:bool?)
      end

      # @see https://sandbox-api.flinks.io/Readme/#get-pdf-statements
      # @param options [Hash]
      # @return [Hash]
      def statements(options: {})
        payload = StatementRequestSchema.call(options)
        raise ArgumentError, error_message(payload) unless payload.success?

        post("#{customer_id}/BankingServices/GetStatements", body: payload.to_h)
      end

      # @see https://sandbox-api.flinks.io/Readme/#get-pdf-statements
      # @param request_id [String]
      # @return [Hash]
      def statements_async(request_id:)
        get("#{customer_id}/BankingServices/GetStatementsAsync/#{request_id}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flinks-0.1.1 lib/flinks/api/statement.rb
flinks-0.1.0 lib/flinks/api/statement.rb