| All Verbs | /qry/configurations/devices |
|---|
# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
module DeviceOperationalStatus
ACTIVE = 1
DEACTIVATED = 2
RETIRED = 3
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 ProductReference
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :value
# @return [String]
attr_accessor :category
# @return [Ref]
attr_accessor :product_provider
def self.properties
{
id: { name: 'id' },
value: { name: 'value' },
category: { name: 'category' },
product_provider: { name: 'productProvider', type: Ref },
}
end
end
class ProductInstanceRef
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :name
# @return [String]
attr_accessor :title
# @return [ProductReference]
attr_accessor :product
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
title: { name: 'title' },
product: { name: 'product', type: ProductReference },
}
end
end
class GPSCoordinates
include ServiceStack::DTO
# @return [Float]
attr_accessor :lat
# @return [Float]
attr_accessor :lng
def self.properties
{
lat: { name: 'lat' },
lng: { name: 'lng' },
}
end
end
class Address
include ServiceStack::DTO
# @return [String]
attr_accessor :street
# @return [String]
attr_accessor :city
# @return [String]
attr_accessor :state
# @return [String]
attr_accessor :postal_code
# @return [Ref]
attr_accessor :country
# @return [GPSCoordinates]
attr_accessor :gps
# @return [RecordDictionary]
attr_accessor :data
def self.properties
{
street: { name: 'street' },
city: { name: 'city' },
state: { name: 'state' },
postal_code: { name: 'postalCode' },
country: { name: 'country', type: Ref },
gps: { name: 'gps', type: GPSCoordinates },
data: { name: 'data', type: RecordDictionary },
}
end
end
class LocationRef
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :name
# @return [Ref]
attr_accessor :group
# @return [Ref]
attr_accessor :region
# @return [Address]
attr_accessor :address
# @return [RecordDictionary]
attr_accessor :integrations_data
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
group: { name: 'group', type: Ref },
region: { name: 'region', type: Ref },
address: { name: 'address', type: Address },
integrations_data: { name: 'integrationsData', type: RecordDictionary },
}
end
end
class OrganizationRef
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :name
# @return [Address]
attr_accessor :address
# @return [RecordDictionary]
attr_accessor :integrations_data
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
address: { name: 'address', type: Address },
integrations_data: { name: 'integrationsData', type: RecordDictionary },
}
end
end
class DeviceConfiguration
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :name
# @return [TrueClass]
attr_accessor :is_active
# @return [TrueClass]
attr_accessor :is_retired
# @return [DeviceOperationalStatus]
attr_accessor :operational_status
# @return [RecordList]
attr_accessor :product_instances
# @return [Ref]
attr_accessor :time_zone
# @return [Ref]
attr_accessor :currency
# @return [Ref]
attr_accessor :language
# @return [LocationRef]
attr_accessor :location
# @return [OrganizationRef]
attr_accessor :organization
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
is_active: { name: 'isActive' },
is_retired: { name: 'isRetired' },
operational_status: { name: 'operationalStatus' },
product_instances: { name: 'productInstances', type: RecordList },
time_zone: { name: 'timeZone', type: Ref },
currency: { name: 'currency', type: Ref },
language: { name: 'language', type: Ref },
location: { name: 'location', type: LocationRef },
organization: { name: 'organization', type: OrganizationRef },
}
end
end
class GetDeviceConfiguration
include ServiceStack::DTO
# @return [String]
attr_accessor :id
def self.properties
{
id: { name: 'id' },
}
end
def response_type() = DeviceConfiguration
def get_type_name() = 'GetDeviceConfiguration'
end
class RecordList < Array
end
class RecordDictionary < Hash
end
Ruby GetDeviceConfiguration DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /qry/configurations/devices HTTP/1.1
Host: api.bettor.webhop.biz
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
id: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
id: String,
name: String,
isActive: False,
isRetired: False,
operationalStatus: 2,
productInstances:
[
{
id: String,
name: String,
title: String,
product:
{
id: String,
value: String,
category: String,
productProvider:
{
id: String,
val: String
}
}
}
],
timeZone:
{
id: String,
val: String
},
currency:
{
id: String,
val: String
},
language:
{
id: String,
val: String
},
location:
{
id: String,
name: String,
group:
{
id: String,
val: String
},
region:
{
id: String,
val: String
},
address:
{
street: String,
city: String,
state: String,
postalCode: String,
country:
{
id: String,
val: String
},
gps:
{
lat: 0,
lng: 0
},
data:
{
String: String
}
},
integrationsData:
{
String: String
}
},
organization:
{
id: String,
name: String,
address:
{
street: String,
city: String,
state: String,
postalCode: String,
country:
{
id: String,
val: String
},
gps:
{
lat: 0,
lng: 0
},
data:
{
String: String
}
},
integrationsData:
{
String: String
}
}
}