Class: Alula::DeviceAssignProc

Inherits:
RpcResource show all
Defined in:
lib/alula/procedures/device_assign_proc.rb

Defined Under Namespace

Classes: Response

Class Method Summary collapse

Methods inherited from RpcResource

ok?, request, wrap_payload

Class Method Details

.call(customer_id:, device_id:, pin: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/alula/procedures/device_assign_proc.rb', line 7

def self.call(customer_id:, device_id:, pin: nil)
  payload = {
    customerId: customer_id,
    deviceId: device_id,
  }

  payload[:pin] = pin unless pin.nil?

  request( 
    http_method: :post,
    path: '/rpc/v1/devices/assign',
    payload: payload,
    handler: Response
  )
end