Betting.WebApi

<back to all web services

SubmitSlip

Requires Authentication
The following routes are available for this service:
POST/cmd/slips
# frozen_string_literal: true
# encoding: utf-8


require 'json'
require 'servicestack'


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 BettingApp
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :name
    # @return [String]
    attr_accessor :version

    def self.properties
        {
            name: { name: 'name' },
            version: { name: 'version' },
        }
    end

end

class RefEx < Ref
    # @return [RecordDictionary]
    attr_accessor :data

    def self.properties
        {
            data: { name: 'data', type: RecordDictionary },
        }
    end

end

class Origin
    include ServiceStack::DTO

    # @return [BettingApp]
    attr_accessor :application
    # @return [String]
    attr_accessor :ip
    # @return [RefEx]
    attr_accessor :organization
    # @return [Ref]
    attr_accessor :region
    # @return [Ref]
    attr_accessor :location_group
    # @return [RefEx]
    attr_accessor :location
    # @return [RefEx]
    attr_accessor :device
    # @return [Ref]
    attr_accessor :clerk

    def self.properties
        {
            application: { name: 'application', type: BettingApp },
            ip: { name: 'ip' },
            organization: { name: 'organization', type: RefEx },
            region: { name: 'region', type: Ref },
            location_group: { name: 'locationGroup', type: Ref },
            location: { name: 'location', type: RefEx },
            device: { name: 'device', type: RefEx },
            clerk: { name: 'clerk', type: Ref },
        }
    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 PayinRecap
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :currency
    # @return [BigDecimal]
    attr_accessor :payin
    # @return [Ref]
    attr_accessor :payin_taxation_policy_ref
    # @return [BigDecimal]
    attr_accessor :tax_amount
    # @return [BigDecimal]
    attr_accessor :stake

    def self.properties
        {
            currency: { name: 'currency' },
            payin: { name: 'payin' },
            payin_taxation_policy_ref: { name: 'payinTaxationPolicyRef', type: Ref },
            tax_amount: { name: 'taxAmount' },
            stake: { name: 'stake' },
        }
    end

end

class PayoutRecap
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :currency
    # @return [BigDecimal]
    attr_accessor :winnings
    # @return [Ref]
    attr_accessor :winnings_taxation_policy_ref
    # @return [BigDecimal]
    attr_accessor :tax_amount
    # @return [BigDecimal]
    attr_accessor :payout

    def self.properties
        {
            currency: { name: 'currency' },
            winnings: { name: 'winnings' },
            winnings_taxation_policy_ref: { name: 'winningsTaxationPolicyRef', type: Ref },
            tax_amount: { name: 'taxAmount' },
            payout: { name: 'payout' },
        }
    end

end

class BetRequest
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :bet_id
    # @return [ProductInstanceRef]
    attr_accessor :product_instance
    # @return [Dictionary]
    attr_accessor :payload
    # @return [PayinRecap]
    attr_accessor :payin_recap
    # @return [PayoutRecap]
    attr_accessor :possible_payout_recap

    def self.properties
        {
            bet_id: { name: 'betId' },
            product_instance: { name: 'productInstance', type: ProductInstanceRef },
            payload: { name: 'payload' },
            payin_recap: { name: 'payinRecap', type: PayinRecap },
            possible_payout_recap: { name: 'possiblePayoutRecap', type: PayoutRecap },
        }
    end

end

class SubmitSlip
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :id
    # @return [Ref]
    attr_accessor :bettor
    # @return [Origin]
    attr_accessor :origin
    # @return [List]
    attr_accessor :bet_requests
    # @return [Dictionary]
    attr_accessor :header_data

    def self.properties
        {
            id: { name: 'id' },
            bettor: { name: 'bettor', type: Ref },
            origin: { name: 'origin', type: Origin },
            bet_requests: { name: 'betRequests', type: [BetRequest] },
            header_data: { name: 'headerData' },
        }
    end

    def response_type() = ServiceStack::ResponseStatus
    def get_type_name() = 'SubmitSlip'
end

class RecordDictionary < Hash
end

Ruby SubmitSlip DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /cmd/slips HTTP/1.1 
Host: api.bettor.webhop.biz 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"id":"String","bettor":{"id":"String","val":"String"},"origin":{"application":{"name":"String","version":"String"},"ip":"String","organization":{"data":{"String":"String"},"id":"String","val":"String"},"region":{"id":"String","val":"String"},"locationGroup":{"id":"String","val":"String"},"location":{"data":{"String":"String"},"id":"String","val":"String"},"device":{"data":{"String":"String"},"id":"String","val":"String"},"clerk":{"id":"String","val":"String"}},"betRequests":[{"betId":"String","productInstance":{"id":"String","name":"String","title":"String","product":{"id":"String","value":"String","category":"String","productProvider":{"id":"String","val":"String"}}},"payload":{"String":"String"},"payinRecap":{"currency":"String","payin":0,"payinTaxationPolicyRef":{"id":"String","val":"String"},"taxAmount":0,"stake":0},"possiblePayoutRecap":{"currency":"String","winnings":0,"winningsTaxationPolicyRef":{"id":"String","val":"String"},"taxAmount":0,"payout":0}}],"headerData":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}