betfair_api_ng_rails 0.0.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -28
- data/Rakefile +10 -1
- data/betfair_api_ng_rails.gemspec +3 -0
- data/lib/betfair_api_ng_rails.rb +92 -73
- data/lib/betfair_api_ng_rails/api/concerns/errorable.rb +19 -0
- data/lib/betfair_api_ng_rails/api/config.rb +27 -0
- data/lib/betfair_api_ng_rails/api/connection.rb +34 -0
- data/lib/betfair_api_ng_rails/api/connection_ext/formatting.rb +34 -0
- data/lib/betfair_api_ng_rails/api/connection_ext/parsing.rb +29 -0
- data/lib/betfair_api_ng_rails/api/constants.rb +51 -0
- data/lib/betfair_api_ng_rails/api/data/attributes.rb +50 -0
- data/lib/betfair_api_ng_rails/api/data/base.rb +16 -0
- data/lib/betfair_api_ng_rails/api/data/competition.rb +20 -0
- data/lib/betfair_api_ng_rails/api/data/competition_result.rb +21 -0
- data/lib/betfair_api_ng_rails/api/data/concerns/hashable.rb +29 -0
- data/lib/betfair_api_ng_rails/api/data/constants.rb +11 -0
- data/lib/betfair_api_ng_rails/api/data/country_code_result.rb +19 -0
- data/lib/betfair_api_ng_rails/api/data/event.rb +20 -0
- data/lib/betfair_api_ng_rails/api/data/event_result.rb +19 -0
- data/lib/betfair_api_ng_rails/api/data/event_type.rb +20 -0
- data/lib/betfair_api_ng_rails/api/data/event_type_result.rb +19 -0
- data/lib/betfair_api_ng_rails/api/data/market_filter.rb +16 -0
- data/lib/betfair_api_ng_rails/api/data/market_type_result.rb +19 -0
- data/lib/betfair_api_ng_rails/api/data/time_range.rb +20 -0
- data/lib/betfair_api_ng_rails/api/data/time_range_result.rb +19 -0
- data/lib/betfair_api_ng_rails/api/data/venue_result.rb +19 -0
- data/lib/betfair_api_ng_rails/api/enums/bet_status.rb +15 -0
- data/lib/betfair_api_ng_rails/api/enums/concerns/enumable.rb +15 -0
- data/lib/betfair_api_ng_rails/api/enums/execution_report_error_code.rb +28 -0
- data/lib/betfair_api_ng_rails/api/enums/execution_report_status.rb +15 -0
- data/lib/betfair_api_ng_rails/api/enums/group_by.rb +17 -0
- data/lib/betfair_api_ng_rails/api/enums/instruction_report_error_code.rb +31 -0
- data/lib/betfair_api_ng_rails/api/enums/instruction_report_status.rb +14 -0
- data/lib/betfair_api_ng_rails/api/enums/market_betting_type.rb +17 -0
- data/lib/betfair_api_ng_rails/api/enums/market_projection.rb +18 -0
- data/lib/betfair_api_ng_rails/api/enums/market_sort.rb +17 -0
- data/lib/betfair_api_ng_rails/api/enums/market_status.rb +15 -0
- data/lib/betfair_api_ng_rails/api/enums/match_projection.rb +14 -0
- data/lib/betfair_api_ng_rails/api/enums/order_by.rb +14 -0
- data/lib/betfair_api_ng_rails/api/enums/order_projection.rb +14 -0
- data/lib/betfair_api_ng_rails/api/enums/order_status.rb +13 -0
- data/lib/betfair_api_ng_rails/api/enums/order_type.rb +14 -0
- data/lib/betfair_api_ng_rails/api/enums/persistence_type.rb +14 -0
- data/lib/betfair_api_ng_rails/api/enums/price_data.rb +16 -0
- data/lib/betfair_api_ng_rails/api/enums/rollup_model.rb +15 -0
- data/lib/betfair_api_ng_rails/api/enums/runner_status.rb +17 -0
- data/lib/betfair_api_ng_rails/api/enums/side.rb +13 -0
- data/lib/betfair_api_ng_rails/api/enums/sort_dir.rb +13 -0
- data/lib/betfair_api_ng_rails/api/enums/time_granularity.rb +14 -0
- data/lib/betfair_api_ng_rails/api/formatter_factory.rb +1 -1
- data/lib/betfair_api_ng_rails/api/formatters/js_tree_formatter.rb +38 -0
- data/lib/betfair_api_ng_rails/api/hashalator.rb +39 -0
- data/lib/betfair_api_ng_rails/api/helper.rb +29 -0
- data/lib/betfair_api_ng_rails/api/http/factory.rb +41 -0
- data/lib/betfair_api_ng_rails/api/http/helpers/information_response.rb +35 -0
- data/lib/betfair_api_ng_rails/api/http/helpers/keep_alive_response.rb +32 -0
- data/lib/betfair_api_ng_rails/api/http/helpers/session_response.rb +36 -0
- data/lib/betfair_api_ng_rails/api/http/requester.rb +75 -0
- data/lib/betfair_api_ng_rails/api/http/responser.rb +47 -0
- data/lib/betfair_api_ng_rails/api/parsers/base.rb +31 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_competitions.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_countries.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_event_types.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_events.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_market_types.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_time_ranges.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_venues.rb +15 -0
- data/lib/betfair_api_ng_rails/api/provider.rb +38 -0
- data/lib/betfair_api_ng_rails/api/request_methods.rb +33 -0
- data/lib/betfair_api_ng_rails/api/session_manager.rb +54 -0
- data/lib/betfair_api_ng_rails/errors.rb +6 -0
- data/lib/betfair_api_ng_rails/railtie.rb +7 -0
- data/lib/betfair_api_ng_rails/version.rb +1 -1
- data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.rb +11 -9
- data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.yml +2 -0
- data/spec/betfair_api_ng_rails/api/connection_spec.rb +74 -0
- data/spec/betfair_api_ng_rails/api/data/concerns/hashable_spec.rb +81 -0
- data/spec/betfair_api_ng_rails/api/formatters/js_tree_formatter_spec.rb +70 -0
- data/spec/betfair_api_ng_rails/api/hashalator_spec.rb +146 -0
- data/spec/betfair_api_ng_rails/api/provider_spec.rb +91 -0
- data/spec/betfair_api_ng_rails/api/request_methods_spec.rb +60 -0
- data/spec/betfair_api_ng_rails/api/session_manager_spec.rb +59 -0
- data/spec/betfair_api_ng_rails/integration/list_competitions_spec.rb +18 -0
- data/spec/betfair_api_ng_rails/integration/list_countries_spec.rb +18 -0
- data/spec/betfair_api_ng_rails/integration/list_event_types_spec.rb +18 -0
- data/spec/betfair_api_ng_rails/integration/list_events_spec.rb +18 -0
- data/spec/betfair_api_ng_rails/integration/list_market_types_spec.rb +18 -0
- data/spec/betfair_api_ng_rails/integration/list_time_ranges_spec.rb +18 -0
- data/spec/betfair_api_ng_rails/integration/list_venues_spec.rb +18 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/shared_examples/request_method.rb +18 -0
- data/spec/support/shared_examples/simple_list_filtering_request.rb +51 -0
- metadata +156 -66
- data/lib/betfair_api_ng_rails/api/base_provider.rb +0 -15
- data/lib/betfair_api_ng_rails/api/bf/concerns/errorable.rb +0 -21
- data/lib/betfair_api_ng_rails/api/bf/config.rb +0 -27
- data/lib/betfair_api_ng_rails/api/bf/constants.rb +0 -37
- data/lib/betfair_api_ng_rails/api/bf/data/attributes.rb +0 -52
- data/lib/betfair_api_ng_rails/api/bf/data/base.rb +0 -17
- data/lib/betfair_api_ng_rails/api/bf/data/competition.rb +0 -26
- data/lib/betfair_api_ng_rails/api/bf/data/competition_result.rb +0 -23
- data/lib/betfair_api_ng_rails/api/bf/data/concerns/hashable.rb +0 -40
- data/lib/betfair_api_ng_rails/api/bf/data/concerns/querable.rb +0 -46
- data/lib/betfair_api_ng_rails/api/bf/data/constants.rb +0 -13
- data/lib/betfair_api_ng_rails/api/bf/data/event.rb +0 -26
- data/lib/betfair_api_ng_rails/api/bf/data/event_result.rb +0 -21
- data/lib/betfair_api_ng_rails/api/bf/data/event_type.rb +0 -26
- data/lib/betfair_api_ng_rails/api/bf/data/event_type_result.rb +0 -21
- data/lib/betfair_api_ng_rails/api/bf/data/market_filter.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/data/time_range.rb +0 -18
- data/lib/betfair_api_ng_rails/api/bf/data/time_range_result.rb +0 -21
- data/lib/betfair_api_ng_rails/api/bf/enums/bet_status.rb +0 -17
- data/lib/betfair_api_ng_rails/api/bf/enums/concerns/enumable.rb +0 -17
- data/lib/betfair_api_ng_rails/api/bf/enums/execution_report_error_code.rb +0 -30
- data/lib/betfair_api_ng_rails/api/bf/enums/execution_report_status.rb +0 -17
- data/lib/betfair_api_ng_rails/api/bf/enums/group_by.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/enums/instruction_report_error_code.rb +0 -33
- data/lib/betfair_api_ng_rails/api/bf/enums/instruction_report_status.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/enums/market_betting_type.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/enums/market_projection.rb +0 -20
- data/lib/betfair_api_ng_rails/api/bf/enums/market_sort.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/enums/market_status.rb +0 -17
- data/lib/betfair_api_ng_rails/api/bf/enums/match_projection.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/enums/order_by.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/enums/order_projection.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/enums/order_status.rb +0 -15
- data/lib/betfair_api_ng_rails/api/bf/enums/order_type.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/enums/persistence_type.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/enums/price_data.rb +0 -18
- data/lib/betfair_api_ng_rails/api/bf/enums/rollup_model.rb +0 -17
- data/lib/betfair_api_ng_rails/api/bf/enums/runner_status.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/enums/side.rb +0 -15
- data/lib/betfair_api_ng_rails/api/bf/enums/sort_dir.rb +0 -15
- data/lib/betfair_api_ng_rails/api/bf/enums/time_granularity.rb +0 -16
- data/lib/betfair_api_ng_rails/api/bf/formatters/js_tree_formatter.rb +0 -30
- data/lib/betfair_api_ng_rails/api/bf/helper.rb +0 -33
- data/lib/betfair_api_ng_rails/api/bf/http/factory.rb +0 -37
- data/lib/betfair_api_ng_rails/api/bf/http/requester.rb +0 -69
- data/lib/betfair_api_ng_rails/api/bf/http/responser.rb +0 -58
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/base.rb +0 -33
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/list_competitions.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/list_event_types.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/list_events.rb +0 -19
- data/lib/betfair_api_ng_rails/api/bf/orm/requester.rb +0 -52
- data/lib/betfair_api_ng_rails/api/bf/provider.rb +0 -38
- data/lib/betfair_api_ng_rails/api/bf/session_manager.rb +0 -46
@@ -0,0 +1,35 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module Http
|
4
|
+
module Helpers
|
5
|
+
module InformationResponse
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.send :class_eval, <<-CODE
|
9
|
+
def has_error_with_info_response?
|
10
|
+
has_error_without_info_response? || info_response_error?
|
11
|
+
end
|
12
|
+
alias_method :has_error_without_info_response?, :has_error?
|
13
|
+
alias_method :has_error?, :has_error_with_info_response?
|
14
|
+
CODE
|
15
|
+
end
|
16
|
+
|
17
|
+
def api_result
|
18
|
+
result['result']
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
def info_response_error?
|
24
|
+
set_error_info(:API, result['error']) if check_info_response_status
|
25
|
+
end
|
26
|
+
|
27
|
+
def check_info_response_status
|
28
|
+
result.has_key?('error')
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module Http
|
4
|
+
module Helpers
|
5
|
+
module KeepAliveResponse
|
6
|
+
include BetfairApiNgRails::Api::Constants
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.send :class_eval, <<-CODE
|
10
|
+
def has_error_with_keep_alive_response?
|
11
|
+
has_error_without_keep_alive_response? || keep_alive_res_error?
|
12
|
+
end
|
13
|
+
alias_method :has_error_without_keep_alive_response?, :has_error?
|
14
|
+
alias_method :has_error?, :has_error_with_keep_alive_response?
|
15
|
+
CODE
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def keep_alive_res_error?
|
21
|
+
set_error_info(:KEEP_ALIVE, result['status']) if check_keep_alive_status
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_keep_alive_status
|
25
|
+
result.fetch('status', SUCCESS_LOGIN) != SUCCESS_LOGIN
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module Http
|
4
|
+
module Helpers
|
5
|
+
module SessionResponse
|
6
|
+
include BetfairApiNgRails::Api::Constants
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.send :class_eval, <<-CODE
|
10
|
+
def has_error_with_session_response?
|
11
|
+
has_error_without_session_response? || session_res_error?
|
12
|
+
end
|
13
|
+
alias_method :has_error_without_session_response?, :has_error?
|
14
|
+
alias_method :has_error?, :has_error_with_session_response?
|
15
|
+
CODE
|
16
|
+
end
|
17
|
+
|
18
|
+
def session_token
|
19
|
+
result['sessionToken']
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def session_res_error?
|
25
|
+
set_error_info(:SESSION, result['loginStatus']) if check_login_status
|
26
|
+
end
|
27
|
+
|
28
|
+
def check_login_status
|
29
|
+
result.fetch('loginStatus', SUCCESS_LOGIN) != SUCCESS_LOGIN
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require "net/https"
|
2
|
+
require "uri"
|
3
|
+
require 'json'
|
4
|
+
require 'betfair_api_ng_rails/api/helper'
|
5
|
+
|
6
|
+
module BetfairApiNgRails
|
7
|
+
module Api
|
8
|
+
module Http
|
9
|
+
class Requester
|
10
|
+
include BetfairApiNgRails::Api::Helper
|
11
|
+
|
12
|
+
attr_reader :http, :request, :uri
|
13
|
+
|
14
|
+
def initialize(url, use_ssl = true)
|
15
|
+
@uri = URI.parse url
|
16
|
+
@http = Net::HTTP.new uri.host, uri.port
|
17
|
+
http.use_ssl = use_ssl
|
18
|
+
@request = Net::HTTP::Post.new uri.request_uri
|
19
|
+
end
|
20
|
+
|
21
|
+
def do_request
|
22
|
+
Api::Http::Responser.new http.request(request)
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_crt_file(path)
|
26
|
+
http.cert = read_certificate_file(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_key_file(path)
|
30
|
+
http.key = read_rsa_file(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
def set_verify_mode(value)
|
34
|
+
http.verify_mode = value
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_ssl_files(crt_path, key_path, verify = OpenSSL::SSL::VERIFY_PEER)
|
38
|
+
set_crt_file crt_path
|
39
|
+
set_key_file key_path
|
40
|
+
set_verify_mode verify
|
41
|
+
end
|
42
|
+
|
43
|
+
def set_auth_headers(app_key, session_key = nil)
|
44
|
+
set_header "X-Application", app_key
|
45
|
+
set_header "X-Authentication", session_key if session_key
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_accept_header(value)
|
49
|
+
set_header 'Accept', value
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_request_headers(headers)
|
53
|
+
headers.each { |name, value| request[name] = value }
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_form_data(values)
|
57
|
+
request.set_form_data values
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_request_body(body)
|
61
|
+
request.body = body
|
62
|
+
end
|
63
|
+
|
64
|
+
def set_api_req_body(method, params = {})
|
65
|
+
set_request_body prepare_api_req_json(method, params)
|
66
|
+
end
|
67
|
+
|
68
|
+
def set_header(name, value)
|
69
|
+
request[name] = value
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'betfair_api_ng_rails/api/http/helpers/information_response'
|
3
|
+
require 'betfair_api_ng_rails/api/http/helpers/keep_alive_response'
|
4
|
+
require 'betfair_api_ng_rails/api/http/helpers/session_response'
|
5
|
+
|
6
|
+
module BetfairApiNgRails
|
7
|
+
module Api
|
8
|
+
module Http
|
9
|
+
class Responser
|
10
|
+
include Api::Constants
|
11
|
+
|
12
|
+
attr_reader :response, :error_info
|
13
|
+
|
14
|
+
def initialize(response)
|
15
|
+
@response = response
|
16
|
+
end
|
17
|
+
|
18
|
+
def result
|
19
|
+
JSON.parse response.body
|
20
|
+
end
|
21
|
+
|
22
|
+
def has_error?
|
23
|
+
http_error?
|
24
|
+
end
|
25
|
+
|
26
|
+
include Api::Http::Helpers::InformationResponse
|
27
|
+
include Api::Http::Helpers::KeepAliveResponse
|
28
|
+
include Api::Http::Helpers::SessionResponse
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def http_error?
|
33
|
+
set_error_info(:HTTP, response.code) if check_response_code
|
34
|
+
end
|
35
|
+
|
36
|
+
def check_response_code
|
37
|
+
response.code != '200'
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_error_info(type, info)
|
41
|
+
@error_info = { type: type, info: info }
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'pry-nav'
|
2
|
+
|
3
|
+
module BetfairApiNgRails
|
4
|
+
module Api
|
5
|
+
module Parsers
|
6
|
+
class Base
|
7
|
+
|
8
|
+
attr_reader :responser
|
9
|
+
|
10
|
+
def initialize(responser)
|
11
|
+
@responser = responser
|
12
|
+
end
|
13
|
+
|
14
|
+
def process
|
15
|
+
fetch_result_json.map { |json_row| process_row json_row }
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def fetch_result_json
|
21
|
+
responser.has_error? ? [] : responser.api_result
|
22
|
+
end
|
23
|
+
|
24
|
+
def process_row(json_row)
|
25
|
+
raise 'Must be reimplemented!'
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
require 'betfair_api_ng_rails/api/concerns/errorable'
|
3
|
+
|
4
|
+
module BetfairApiNgRails
|
5
|
+
module Api
|
6
|
+
class Provider
|
7
|
+
include Api::Concerns::Errorable
|
8
|
+
include Api::Constants
|
9
|
+
|
10
|
+
attr_reader :ssoid
|
11
|
+
|
12
|
+
def initialize(ssoid)
|
13
|
+
@ssoid = ssoid
|
14
|
+
end
|
15
|
+
|
16
|
+
def fetch(method: "", params: {})
|
17
|
+
raise "Not allowed method #{method.to_s}" unless is_method_allowed?(method)
|
18
|
+
run_request for_method: method, params: params
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def run_request(for_method: "", params: {})
|
24
|
+
http_requester.set_api_req_body for_method, params
|
25
|
+
http_requester.do_request
|
26
|
+
end
|
27
|
+
|
28
|
+
def is_method_allowed?(method)
|
29
|
+
ALLOWED_RESOURCES.include? method.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
def http_requester
|
33
|
+
@_http_requester ||= Api::Http::Factory.provider_requester ssoid
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
require 'betfair_api_ng_rails/api/constants'
|
3
|
+
|
4
|
+
module BetfairApiNgRails
|
5
|
+
module Api
|
6
|
+
module RequestMethods
|
7
|
+
include Api::Constants
|
8
|
+
|
9
|
+
SIMPLE_LISTING_FILTERED.each do |method|
|
10
|
+
eval <<-CODE
|
11
|
+
def #{method.underscore}(filter: Api::Data::MarketFilter.new, locale: :en)
|
12
|
+
run_request __method__, { filter: filter }, { locale: locale }
|
13
|
+
end
|
14
|
+
CODE
|
15
|
+
end
|
16
|
+
|
17
|
+
def place_orders(market_id: "", instructions: [], customer_ref: "")
|
18
|
+
run_request __method__, { market_id: market_id, instructions: instructions, customer_ref: customer_ref }
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def run_request(method, params, data)
|
24
|
+
BetfairApiNgRails.connection.request build_request_type(method), params.merge(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_request_type(name)
|
28
|
+
name.to_s.camelize(:lower)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|