| POST | /cmd/products/instances |
|---|
# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
module PayinConstraintType
SINGLE_BET = 0
MULTI_BET = 1
SYSTEM_BET = 2
end
module WinningsCapType
SINGLE_BET = 0
MULTI_BET = 1
SYSTEM_BET = 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 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 Money
include ServiceStack::DTO
# @return [BigDecimal]
attr_accessor :amount
# @return [String]
attr_accessor :currency
def self.properties
{
amount: { name: 'amount' },
currency: { name: 'currency' },
}
end
end
class PayinConstraint
include ServiceStack::DTO
# @return [PayinConstraintType]
attr_accessor :type
# @return [Money]
attr_accessor :min
# @return [Money]
attr_accessor :default
# @return [Money]
attr_accessor :warning_threshold
# @return [Money]
attr_accessor :max
def self.properties
{
type: { name: 'type' },
min: { name: 'min', type: Money },
default: { name: 'default', type: Money },
warning_threshold: { name: 'warningThreshold', type: Money },
max: { name: 'max', type: Money },
}
end
end
class WinningsCap
include ServiceStack::DTO
# @return [WinningsCapType]
attr_accessor :type
# @return [Money]
attr_accessor :cap
def self.properties
{
type: { name: 'type' },
cap: { name: 'cap', type: Money },
}
end
end
class BettingPolicies
include ServiceStack::DTO
# @return [RecordList]
attr_accessor :payin_constraints
# @return [String]
attr_accessor :payin_taxation_policy_id
# @return [RecordList]
attr_accessor :winnings_caps
# @return [String]
attr_accessor :winnings_taxation_policy_id
def self.properties
{
payin_constraints: { name: 'payinConstraints', type: RecordList },
payin_taxation_policy_id: { name: 'payinTaxationPolicyId' },
winnings_caps: { name: 'winningsCaps', type: RecordList },
winnings_taxation_policy_id: { name: 'winningsTaxationPolicyId' },
}
end
end
class InstallProductInstance
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :name
# @return [String]
attr_accessor :title
# @return [ProductReference]
attr_accessor :product
# @return [Ref]
attr_accessor :currency
# @return [BettingPolicies]
attr_accessor :betting_policies
# @return [String]
attr_accessor :api_url
# @return [String]
attr_accessor :back_office_url
# @return [String]
attr_accessor :instance_url
# @return [String]
attr_accessor :feed_player_url
def self.properties
{
id: { name: 'id' },
name: { name: 'name' },
title: { name: 'title' },
product: { name: 'product', type: ProductReference },
currency: { name: 'currency', type: Ref },
betting_policies: { name: 'bettingPolicies', type: BettingPolicies },
api_url: { name: 'apiUrl' },
back_office_url: { name: 'backOfficeUrl' },
instance_url: { name: 'instanceUrl' },
feed_player_url: { name: 'feedPlayerUrl' },
}
end
def response_type() = ServiceStack::ResponseStatus
def get_type_name() = 'InstallProductInstance'
end
class RecordList < Array
end
Ruby InstallProductInstance DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /cmd/products/instances HTTP/1.1
Host: api.bettor.webhop.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<InstallProductInstance xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Betting.WebApi.ServiceModel">
<ApiUrl>String</ApiUrl>
<BackOfficeUrl>String</BackOfficeUrl>
<BettingPolicies xmlns:d2p1="http://schemas.datacontract.org/2004/07/Betting.Common">
<d2p1:PayinConstraints>
<d2p1:PayinConstraint>
<d2p1:Default xmlns:d5p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d5p1:Amount>0</d5p1:Amount>
<d5p1:Currency>String</d5p1:Currency>
</d2p1:Default>
<d2p1:Max xmlns:d5p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d5p1:Amount>0</d5p1:Amount>
<d5p1:Currency>String</d5p1:Currency>
</d2p1:Max>
<d2p1:Min xmlns:d5p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d5p1:Amount>0</d5p1:Amount>
<d5p1:Currency>String</d5p1:Currency>
</d2p1:Min>
<d2p1:Type>SingleBet</d2p1:Type>
<d2p1:WarningThreshold xmlns:d5p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d5p1:Amount>0</d5p1:Amount>
<d5p1:Currency>String</d5p1:Currency>
</d2p1:WarningThreshold>
</d2p1:PayinConstraint>
</d2p1:PayinConstraints>
<d2p1:PayinTaxationPolicyId>String</d2p1:PayinTaxationPolicyId>
<d2p1:WinningsCaps>
<d2p1:WinningsCap>
<d2p1:Cap xmlns:d5p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d5p1:Amount>0</d5p1:Amount>
<d5p1:Currency>String</d5p1:Currency>
</d2p1:Cap>
<d2p1:Type>SingleBet</d2p1:Type>
</d2p1:WinningsCap>
</d2p1:WinningsCaps>
<d2p1:WinningsTaxationPolicyId>String</d2p1:WinningsTaxationPolicyId>
</BettingPolicies>
<Currency xmlns:d2p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d2p1:_x003C_Id_x003E_k__BackingField>String</d2p1:_x003C_Id_x003E_k__BackingField>
<d2p1:_x003C_Val_x003E_k__BackingField>String</d2p1:_x003C_Val_x003E_k__BackingField>
</Currency>
<FeedPlayerUrl>String</FeedPlayerUrl>
<Id>String</Id>
<InstanceUrl>String</InstanceUrl>
<Name>String</Name>
<Product xmlns:d2p1="http://schemas.datacontract.org/2004/07/Betting.Common">
<d2p1:Category>String</d2p1:Category>
<d2p1:Id>String</d2p1:Id>
<d2p1:ProductProvider xmlns:d3p1="http://schemas.datacontract.org/2004/07/Starnet.Common">
<d3p1:_x003C_Id_x003E_k__BackingField>String</d3p1:_x003C_Id_x003E_k__BackingField>
<d3p1:_x003C_Val_x003E_k__BackingField>String</d3p1:_x003C_Val_x003E_k__BackingField>
</d2p1:ProductProvider>
<d2p1:Value>String</d2p1:Value>
</Product>
<Title>String</Title>
</InstallProductInstance>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
<Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:KeyValueOfstringstring>
<d4p1:Key>String</d4p1:Key>
<d4p1:Value>String</d4p1:Value>
</d4p1:KeyValueOfstringstring>
</Meta>
</ResponseError>
</Errors>
<Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</Meta>
</ResponseStatus>