class Bunq::DeviceServers

See doc.bunq.com/api/1/call/device-server

Public Class Methods

new(client) click to toggle source

client an instance of Bunq::Client

# File lib/bunq/device_servers.rb, line 10
def initialize(client)
  @resource = Bunq::Resource.new(client, '/v1/device-server')
  @client = client
end

Public Instance Methods

create(description, permitted_ips: nil) click to toggle source

doc.bunq.com/api/1/call/device-server/method/post

You can add a wildcard IP by passing an array of the current IP, and the `*` character. E.g.: ['1.2.3.4', '*'].

@param description [String] The description of this device server. @param permitted_ips [Array|nil] Array of permitted IP addresses.

# File lib/bunq/device_servers.rb, line 23
def create(description, permitted_ips: nil)
  fail ArgumentError, 'description is required' unless description
  fail 'Cannot create session, please add the api_key to your configuration' unless @client.configuration.api_key

  params = {description: description, secret: @client.configuration.api_key}
  params[:permitted_ips] = permitted_ips if permitted_ips

  @resource.post(params)['Response']
end
index() click to toggle source

doc.bunq.com/api/1/call/device-server/method/list

# File lib/bunq/device_servers.rb, line 35
def index
  @resource.get['Response']
end