Class: BetfairApiNgRails::Api::Http::Factory

Inherits:
Object
  • Object
show all
Extended by:
Constants
Defined in:
lib/betfair_api_ng_rails/api/http/factory.rb

Constant Summary

Constants included from Constants

Constants::ALLOWED_FORMATTING, Constants::ALLOWED_RESOURCES, Constants::API_REQUEST_HEADERS, Constants::JSON_METHOD, Constants::KEEP_ALIVE_URL, Constants::LOADABLE_CONFIG_OPTIONS, Constants::SESSION_REQUEST_HEADERS, Constants::SIMPLE_LISTING_FILTERED, Constants::SUCCESS_LOGIN

Class Method Summary collapse

Class Method Details

.keep_alive_requester(ssoid) ⇒ Object

TODO: Looks like this method does not used anywhere. So this means that keep alive feature does not implemented.



26
27
28
29
30
31
# File 'lib/betfair_api_ng_rails/api/http/factory.rb', line 26

def keep_alive_requester(ssoid)
  create_http_requester(KEEP_ALIVE_URL, false).tap do |req|
    req.set_accept_header 'application/json'
    req.set_auth_headers Api::Config.application_key, ssoid
  end
end

.provider_requester(api_url, ssoid = nil, app_key) ⇒ Object



8
9
10
11
12
13
# File 'lib/betfair_api_ng_rails/api/http/factory.rb', line 8

def provider_requester(api_url, ssoid = nil, app_key)
  create_http_requester(api_url).tap do |req|
    req.set_request_headers API_REQUEST_HEADERS
    req.set_auth_headers app_key, ssoid
  end
end

.session_requester(login_url, account) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/betfair_api_ng_rails/api/http/factory.rb', line 15

def session_requester(, )
  create_http_requester(, false).tap do |req|
    req.set_ssl_files .crt_filepath, .key_filepath
    req.set_request_headers SESSION_REQUEST_HEADERS
    req.set_auth_headers .app_key
    req.set_form_data "username" => .username, "password" => .password
  end
end