Class: Betfair::Client

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/betfair/client.rb

Constant Summary collapse

DEFAULT_SETTINGS =
{ retries: 1 }
OPERATIONS =
{
  betting: [:list_event_types, :list_events, :list_market_catalogue,
            :list_market_book, :list_competitions, :list_market_profit_and_loss,
            :list_countries, :list_current_orders, :list_cleared_orders,
            :list_market_types, :list_time_ranges, :list_venues, :place_orders,
            :cancel_orders, :replace_orders, :update_orders],
  account: [:get_account_funds]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#attempt

Constructor Details

#initialize(headers = {}, opts = {}, api_type = :rest) ⇒ Client

Returns a new instance of Client.



23
24
25
26
27
28
29
30
31
32
# File 'lib/betfair/client.rb', line 23

def initialize(headers = {}, opts = {}, api_type = :rest)
  set_endpoint!(opts.delete(:endpoint))

  setting_opts         = opts.extract!(:retries, :adapter)
  @settings            = DEFAULT_SETTINGS.merge(setting_opts)
  @persistent_headers  = headers
  @request_opts        = opts

  extend_api(api_type)
end

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



21
22
23
# File 'lib/betfair/client.rb', line 21

def endpoint
  @endpoint
end

#persistent_headersObject

Returns the value of attribute persistent_headers.



21
22
23
# File 'lib/betfair/client.rb', line 21

def persistent_headers
  @persistent_headers
end

#request_optsObject

Returns the value of attribute request_opts.



21
22
23
# File 'lib/betfair/client.rb', line 21

def request_opts
  @request_opts
end

#settingsObject

Returns the value of attribute settings.



21
22
23
# File 'lib/betfair/client.rb', line 21

def settings
  @settings
end