Class: Bunq::DeviceServers

Inherits:
Object
  • Object
show all
Defined in:
lib/bunq/device_servers.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ DeviceServers

client an instance of Bunq::Client



10
11
12
13
# File 'lib/bunq/device_servers.rb', line 10

def initialize(client)
  @resource = Bunq::Resource.new(client, '/v1/device-server')
  @client = client
end

Instance Method Details

#create(description, permitted_ips: nil) ⇒ Object

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’, ‘*’].

Parameters:

  • description (String)

    The description of this device server.

  • permitted_ips (Array|nil) (defaults to: nil)

    Array of permitted IP addresses.



23
24
25
26
27
28
29
30
31
# 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

#indexObject



35
36
37
# File 'lib/bunq/device_servers.rb', line 35

def index
  @resource.get['Response']
end