Class: Bunq::DeviceServers
- Inherits:
-
Object
- Object
- Bunq::DeviceServers
- Defined in:
- lib/bunq/device_servers.rb
Overview
Instance Method Summary collapse
- #create(description, permitted_ips: nil) ⇒ Object
- #index ⇒ Object
-
#initialize(client) ⇒ DeviceServers
constructor
client
an instance ofBunq::Client
.
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’, ‘*’].
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 |
#index ⇒ Object
35 36 37 |
# File 'lib/bunq/device_servers.rb', line 35 def index @resource.get['Response'] end |