| POST | /cmd/locations/devices/add |
|---|
# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
module DeviceUsageMode
CLERK_SERVICED = 0
PERSONAL = 1
SELF_SERVICE = 2
UNKNOWN = -1
end
module DeviceUserInterface
TABLET = 0
KIOSK = 1
DEFAULT = 2
UNKNOWN = -1
end
module DeviceManagement
PARTNER = 1
PLATFORM = 2
end
class Ref
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :val
def self.properties
{
id: { name: 'id' },
val: { name: 'val' },
}
end
end
class DeviceProfile
include ServiceStack::DTO
# @return [DeviceUsageMode]
attr_accessor :usage_mode
# @return [DeviceUserInterface]
attr_accessor :user_interface
# @return [Ref]
attr_accessor :wallet
# @return [DeviceManagement]
attr_accessor :managed_by
def self.properties
{
usage_mode: { name: 'usageMode' },
user_interface: { name: 'userInterface' },
wallet: { name: 'wallet', type: Ref },
managed_by: { name: 'managedBy' },
}
end
end
class Device
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :name
# @return [TrueClass]
attr_accessor :is_active
# @return [DeviceProfile]
attr_accessor :profile
# @return [RecordDictionary]
attr_accessor :integrations_data
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
is_active: { name: 'isActive' },
profile: { name: 'profile', type: DeviceProfile },
integrations_data: { name: 'integrationsData', type: RecordDictionary },
}
end
end
class AddLocationDevice
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [Device]
attr_accessor :device
def self.properties
{
id: { name: 'id' },
device: { name: 'device', type: Device },
}
end
def response_type() = ServiceStack::ResponseStatus
def get_type_name() = 'AddLocationDevice'
end
class RecordDictionary < Hash
end
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /cmd/locations/devices/add HTTP/1.1
Host: api.bettor.webhop.biz
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"id":"String","device":{"id":"String","name":"String","isActive":false,"profile":{"usageMode":0,"userInterface":0,"wallet":{"id":"String","val":"String"},"managedBy":0},"integrationsData":{"String":"String"}}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}