| POST | /cmd/organizations/register/integrations |
|---|
# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
module OrganizationNature
FIRST_PARTY = 1
PARTNER = 2
end
module WalletPayoutMode
REAL_TIME = 0
BATCH_PAYOUT = 1
end
class IntegrationConnection
include ServiceStack::DTO
# @return [String]
attr_accessor :url
# @return [String]
attr_accessor :credentials_ref
def self.properties
{
url: { name: 'url' },
credentials_ref: { name: 'credentialsRef' },
}
end
end
class IntegrationInstance
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [String]
attr_accessor :integration_id
# @return [IntegrationConnection]
attr_accessor :wallet
# @return [IntegrationConnection]
attr_accessor :partner_api
# @return [TrueClass]
attr_accessor :slip_forwarding_enabled
def self.properties
{
id: { name: 'id' },
integration_id: { name: 'integrationId' },
wallet: { name: 'wallet', type: IntegrationConnection },
partner_api: { name: 'partnerApi', type: IntegrationConnection },
slip_forwarding_enabled: { name: 'slipForwardingEnabled' },
}
end
end
class OrganizationIntegrations
include ServiceStack::DTO
# @return [IntegrationInstance]
attr_accessor :first_party
# @return [IntegrationInstance]
attr_accessor :partner
def self.properties
{
first_party: { name: 'firstParty', type: IntegrationInstance },
partner: { name: 'partner', type: IntegrationInstance },
}
end
end
class PayoutPolicy
include ServiceStack::DTO
# @return [WalletPayoutMode]
attr_accessor :self_service
# @return [WalletPayoutMode]
attr_accessor :personal
def self.properties
{
self_service: { name: 'selfService' },
personal: { name: 'personal' },
}
end
end
class RegisterOrganizationIntegrations
include ServiceStack::DTO
# @return [String]
attr_accessor :id
# @return [OrganizationNature]
attr_accessor :nature
# @return [OrganizationIntegrations]
attr_accessor :integrations
# @return [PayoutPolicy]
attr_accessor :payout_policy
def self.properties
{
id: { name: 'id' },
nature: { name: 'nature' },
integrations: { name: 'integrations', type: OrganizationIntegrations },
payout_policy: { name: 'payoutPolicy', type: PayoutPolicy },
}
end
def response_type() = ServiceStack::ResponseStatus
def get_type_name() = 'RegisterOrganizationIntegrations'
end
Ruby RegisterOrganizationIntegrations DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /cmd/organizations/register/integrations HTTP/1.1
Host: api.bettor.webhop.biz
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":"String","nature":1,"integrations":{"firstParty":{"id":"String","integrationId":"String","wallet":{"url":"String","credentialsRef":"String"},"partnerApi":{"url":"String","credentialsRef":"String"},"slipForwardingEnabled":false},"partner":{"id":"String","integrationId":"String","wallet":{"url":"String","credentialsRef":"String"},"partnerApi":{"url":"String","credentialsRef":"String"},"slipForwardingEnabled":false}},"payoutPolicy":{"selfService":0,"personal":0}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}