class Nordigen::AgreementsApi

Constants

ENDPOINT

Attributes

client[R]

Public Class Methods

new(client) click to toggle source
# File lib/nordigen_ruby/api/agreements.rb, line 7
def initialize(client)
    # Nordigen client initialization
    @client = client
end

Public Instance Methods

accept_agreement(agreement_id:, ip:, user_agent:) click to toggle source
# File lib/nordigen_ruby/api/agreements.rb, line 44
def accept_agreement(agreement_id:, ip:, user_agent:)
    # Accept end user agreement
    payload = {
        'user_agent': user_agent,
        'ip_address': ip
    }
    return client.request.put("#{ENDPOINT}#{agreement_id}/accept/").body
end
create_agreement(institution_id:, max_historical_days: 90, access_valid_for_days: 90, access_scope: [ "balances", "details", "transactions" ]) click to toggle source
# File lib/nordigen_ruby/api/agreements.rb, line 12
def create_agreement(institution_id:, max_historical_days: 90, access_valid_for_days: 90, access_scope: [
    "balances",
    "details",
    "transactions"
])
    # Create enduser agreement
    payload = {
        "institution_id": institution_id,
        "max_historical_days": max_historical_days,
        "access_valid_for_days": access_valid_for_days,
        "access_scope": access_scope,
    };
    return client.request.post(ENDPOINT, payload).body
end
delete_agreement(agreement_id) click to toggle source
# File lib/nordigen_ruby/api/agreements.rb, line 39
def delete_agreement(agreement_id)
    # Delete agreement by id
    return client.request.delete("#{ENDPOINT}#{agreement_id}/").body
end
get_agreement_by_id(agreement_id) click to toggle source
# File lib/nordigen_ruby/api/agreements.rb, line 34
def get_agreement_by_id(agreement_id)
    # Get agreemenet by id
    return client.request.get("#{ENDPOINT}#{agreement_id}/").body
end
get_agreements(limit: 100, offset: 0) click to toggle source
# File lib/nordigen_ruby/api/agreements.rb, line 28
def get_agreements(limit: 100, offset: 0)
    # Get list of agreements
    params = {limit: limit, offset: offset}
    return client.request.get(ENDPOINT, params).body
end