Sha256: 063c9924ed3ebeed007a43c68c287c842153ceaf0a75c6b0fca0e51b4cae0630

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

require 'dry-validation'

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 [Hash] options
      # @return [Hash]
      def statements(options: {})
        validate_request!(StatementRequestSchema, options)
        post("#{customer_id}/BankingServices/GetStatements", body: options)
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flinks-0.5.2 lib/flinks/api/statement.rb
flinks-0.5.1 lib/flinks/api/statement.rb
flinks-0.5.0 lib/flinks/api/statement.rb