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
clientan instance ofBunq::Client.
Constructor Details
#initialize(client) ⇒ DeviceServers
client an instance of Bunq::Client
9 10 11 12 |
# File 'lib/bunq/device_servers.rb', line 9 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’, ‘*’].
22 23 24 25 26 27 28 29 30 |
# File 'lib/bunq/device_servers.rb', line 22 def create(description, permitted_ips: nil) fail ArgumentError.new('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
34 35 36 |
# File 'lib/bunq/device_servers.rb', line 34 def index @resource.get['Response'] end |