betfair_api_ng_rails 1.1.0 → 2.1.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 +26 -1
- data/Rakefile +8 -8
- data/betfair_api_ng_rails.gemspec +12 -7
- data/lib/betfair_api_ng_rails.rb +162 -98
- data/lib/betfair_api_ng_rails/account.rb +4 -0
- data/lib/betfair_api_ng_rails/account_manager.rb +36 -0
- data/lib/betfair_api_ng_rails/account_session.rb +5 -0
- data/lib/betfair_api_ng_rails/account_session_manager.rb +29 -0
- data/lib/betfair_api_ng_rails/api/caching/helper.rb +34 -0
- data/lib/betfair_api_ng_rails/api/caching/response_cache.rb +57 -0
- data/lib/betfair_api_ng_rails/api/concerns/errorable.rb +1 -3
- data/lib/betfair_api_ng_rails/api/config.rb +20 -8
- data/lib/betfair_api_ng_rails/api/connection.rb +28 -10
- data/lib/betfair_api_ng_rails/api/connection_ext/caching.rb +60 -0
- data/lib/betfair_api_ng_rails/api/connection_ext/error_handling.rb +5 -1
- data/lib/betfair_api_ng_rails/api/connection_ext/logging.rb +34 -0
- data/lib/betfair_api_ng_rails/api/connection_ext/parsing.rb +2 -4
- data/lib/betfair_api_ng_rails/api/connection_ext/ssoid_refreshing.rb +40 -0
- data/lib/betfair_api_ng_rails/api/constants.rb +39 -18
- data/lib/betfair_api_ng_rails/api/data/account_details_response.rb +27 -0
- data/lib/betfair_api_ng_rails/api/data/account_funds_response.rb +26 -0
- data/lib/betfair_api_ng_rails/api/data/account_statement_report.rb +17 -0
- data/lib/betfair_api_ng_rails/api/data/competition.rb +3 -4
- data/lib/betfair_api_ng_rails/api/data/competition_result.rb +1 -3
- data/lib/betfair_api_ng_rails/api/data/concerns/attributable.rb +2 -6
- data/lib/betfair_api_ng_rails/api/data/concerns/hashable.rb +11 -4
- data/lib/betfair_api_ng_rails/api/data/constants.rb +2 -4
- data/lib/betfair_api_ng_rails/api/data/country_code_result.rb +1 -3
- data/lib/betfair_api_ng_rails/api/data/event.rb +1 -2
- data/lib/betfair_api_ng_rails/api/data/event_result.rb +1 -3
- data/lib/betfair_api_ng_rails/api/data/limit_on_close_order.rb +22 -0
- data/lib/betfair_api_ng_rails/api/data/limit_order.rb +23 -0
- data/lib/betfair_api_ng_rails/api/data/market_book.rb +2 -4
- data/lib/betfair_api_ng_rails/api/data/market_filter.rb +3 -2
- data/lib/betfair_api_ng_rails/api/data/market_on_close_order.rb +20 -0
- data/lib/betfair_api_ng_rails/api/data/order.rb +1 -3
- data/lib/betfair_api_ng_rails/api/data/place_execution_report.rb +24 -0
- data/lib/betfair_api_ng_rails/api/data/place_instruction.rb +25 -0
- data/lib/betfair_api_ng_rails/api/data/place_instruction_report.rb +27 -0
- data/lib/betfair_api_ng_rails/api/data/statement_item.rb +30 -0
- data/lib/betfair_api_ng_rails/api/data/statement_legacy_data.rb +40 -0
- data/lib/betfair_api_ng_rails/api/endpoint_factory.rb +21 -0
- data/lib/betfair_api_ng_rails/api/endpoints/australian.rb +17 -0
- data/lib/betfair_api_ng_rails/api/endpoints/base.rb +42 -0
- data/lib/betfair_api_ng_rails/api/endpoints/italian.rb +17 -0
- data/lib/betfair_api_ng_rails/api/endpoints/spanish.rb +17 -0
- data/lib/betfair_api_ng_rails/api/endpoints/uk.rb +17 -0
- data/lib/betfair_api_ng_rails/api/enums/execution_report_error_code.rb +22 -1
- data/lib/betfair_api_ng_rails/api/enums/execution_report_status.rb +12 -1
- data/lib/betfair_api_ng_rails/api/enums/include_item.rb +23 -0
- data/lib/betfair_api_ng_rails/api/enums/instruction_report_error_code.rb +25 -1
- data/lib/betfair_api_ng_rails/api/enums/instruction_report_status.rb +8 -1
- data/lib/betfair_api_ng_rails/api/enums/item_class.rb +19 -0
- data/lib/betfair_api_ng_rails/api/enums/order_status.rb +7 -1
- data/lib/betfair_api_ng_rails/api/enums/order_type.rb +11 -2
- data/lib/betfair_api_ng_rails/api/enums/persistence_type.rb +8 -1
- data/lib/betfair_api_ng_rails/api/enums/side.rb +7 -2
- data/lib/betfair_api_ng_rails/api/enums/wallet.rb +20 -0
- data/lib/betfair_api_ng_rails/api/formatter_factory.rb +2 -4
- data/lib/betfair_api_ng_rails/api/formatters/js_tree_formatter.rb +2 -4
- data/lib/betfair_api_ng_rails/api/hashalator.rb +6 -6
- data/lib/betfair_api_ng_rails/api/helper.rb +2 -4
- data/lib/betfair_api_ng_rails/api/http/factory.rb +19 -14
- data/lib/betfair_api_ng_rails/api/http/helpers/information_response.rb +2 -4
- data/lib/betfair_api_ng_rails/api/http/helpers/keep_alive_response.rb +3 -4
- data/lib/betfair_api_ng_rails/api/http/helpers/session_response.rb +3 -4
- data/lib/betfair_api_ng_rails/api/http/proxy_requester.rb +87 -0
- data/lib/betfair_api_ng_rails/api/http/requester.rb +3 -3
- data/lib/betfair_api_ng_rails/api/http/responser.rb +4 -3
- data/lib/betfair_api_ng_rails/api/invalid_endpoint_error.rb +6 -0
- data/lib/betfair_api_ng_rails/api/logs/console_logger.rb +13 -0
- data/lib/betfair_api_ng_rails/api/logs/file_logger.rb +23 -0
- data/lib/betfair_api_ng_rails/api/parsers/base.rb +14 -6
- data/lib/betfair_api_ng_rails/api/parsers/get_account_details.rb +13 -0
- data/lib/betfair_api_ng_rails/api/parsers/get_account_funds.rb +14 -0
- data/lib/betfair_api_ng_rails/api/parsers/get_account_statement.rb +15 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_base.rb +18 -0
- data/lib/betfair_api_ng_rails/api/parsers/list_competitions.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_countries.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_event_types.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_events.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_market_book.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_market_catalogue.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_market_types.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_time_ranges.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/list_venues.rb +5 -7
- data/lib/betfair_api_ng_rails/api/parsers/place_orders.rb +14 -0
- data/lib/betfair_api_ng_rails/api/parsers/single_base.rb +19 -0
- data/lib/betfair_api_ng_rails/api/provider.rb +11 -14
- data/lib/betfair_api_ng_rails/api/request_method.rb +43 -0
- data/lib/betfair_api_ng_rails/api/request_methods/account.rb +51 -0
- data/lib/betfair_api_ng_rails/api/request_methods/all.rb +26 -0
- data/lib/betfair_api_ng_rails/api/request_methods/betting.rb +30 -0
- data/lib/betfair_api_ng_rails/api/session_manager.rb +34 -31
- data/lib/betfair_api_ng_rails/bad_response_error.rb +4 -0
- data/lib/betfair_api_ng_rails/errors.rb +3 -2
- data/lib/betfair_api_ng_rails/railtie.rb +7 -2
- data/lib/betfair_api_ng_rails/version.rb +1 -1
- data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.rb +20 -11
- data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.yml +5 -7
- data/spec/lib/betfair_api_ng_rails/account_manager_spec.rb +76 -0
- data/spec/lib/betfair_api_ng_rails/account_session_manager_spec.rb +59 -0
- data/spec/lib/betfair_api_ng_rails/account_session_spec.rb +13 -0
- data/spec/lib/betfair_api_ng_rails/account_spec.rb +18 -0
- data/spec/lib/betfair_api_ng_rails/api/caching/helper_spec.rb +89 -0
- data/spec/lib/betfair_api_ng_rails/api/caching/response_cache_spec.rb +131 -0
- data/spec/lib/betfair_api_ng_rails/api/config_spec.rb +37 -0
- data/spec/lib/betfair_api_ng_rails/api/connection_spec.rb +99 -0
- data/spec/lib/betfair_api_ng_rails/api/data/account_statement_report_spec.rb +11 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/competition_result_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/competition_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/concerns/attributable_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/concerns/hashable_spec.rb +16 -32
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/concerns/jsonable_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/country_code_result_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_result_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_type_result_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_type_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/ex_best_offers_overrides_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/exchange_prices_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_book_spec.rb +1 -6
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_catalogue_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_description_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_filter_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_type_result_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/match_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/order_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/price_projection_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/price_size_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/runner_catalog_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/runner_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/starting_prices_spec.rb +0 -0
- data/spec/lib/betfair_api_ng_rails/api/data/statement_item_spec.rb +9 -0
- data/spec/lib/betfair_api_ng_rails/api/data/statement_legacy_data_spec.rb +6 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/time_range_result_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/time_range_spec.rb +1 -3
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/venue_result_spec.rb +0 -0
- data/spec/lib/betfair_api_ng_rails/api/endpoint_factory_spec.rb +27 -0
- data/spec/lib/betfair_api_ng_rails/api/endpoints/australian_spec.rb +6 -0
- data/spec/lib/betfair_api_ng_rails/api/endpoints/base_spec.rb +5 -0
- data/spec/lib/betfair_api_ng_rails/api/endpoints/italian_spec.rb +6 -0
- data/spec/lib/betfair_api_ng_rails/api/endpoints/spanish_spec.rb +7 -0
- data/spec/lib/betfair_api_ng_rails/api/endpoints/uk_spec.rb +6 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/formatters/js_tree_formatter_spec.rb +0 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/hashalator_spec.rb +27 -46
- data/spec/lib/betfair_api_ng_rails/api/http/factory_spec.rb +40 -0
- data/spec/lib/betfair_api_ng_rails/api/logs/console_logger_spec.rb +18 -0
- data/spec/lib/betfair_api_ng_rails/api/logs/file_logger_spec.rb +33 -0
- data/spec/lib/betfair_api_ng_rails/api/provider_spec.rb +53 -0
- data/spec/lib/betfair_api_ng_rails/api/request_method_spec.rb +38 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/request_methods_spec.rb +47 -32
- data/spec/lib/betfair_api_ng_rails/api/session_manager_spec.rb +77 -0
- data/spec/lib/betfair_api_ng_rails/integration/get_account_statement_spec.rb +57 -0
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_competitions_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_countries_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_event_types_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_events_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_market_book_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_market_catalogue_spec.rb +7 -16
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_market_types_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_time_ranges_spec.rb +7 -9
- data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_venues_spec.rb +7 -9
- data/spec/lib/betfair_api_ng_rails/integration/place_orders_spec.rb +55 -0
- data/spec/spec_helper.rb +9 -1
- data/spec/support/base_yaml_loader.rb +2 -4
- data/spec/support/data/models.yml +37 -1
- data/spec/support/data_models_yaml_loader.rb +1 -3
- data/spec/support/have_attr_accessor.rb +18 -0
- data/spec/support/helper.rb +1 -3
- data/spec/support/shared_examples/base_endpoint.rb +5 -0
- data/spec/support/shared_examples/concrete_endpoint.rb +28 -0
- data/spec/support/shared_examples/data_model.rb +2 -11
- data/spec/support/shared_examples/request_method.rb +5 -8
- data/spec/support/shared_examples/simple_list_filtering_request.rb +10 -19
- metadata +252 -117
- data/lib/betfair_api_ng_rails/api/request_methods.rb +0 -41
- data/spec/betfair_api_ng_rails/api/connection_spec.rb +0 -76
- data/spec/betfair_api_ng_rails/api/provider_spec.rb +0 -91
- data/spec/betfair_api_ng_rails/api/session_manager_spec.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca32b3a7503facf55e960bae30e2ea935212e962
|
4
|
+
data.tar.gz: 3d8898545fa0c7946b87c1cef82a83105ae18518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90341eaac7266d722a01a5ad8966b65e2b885ab0bae3aaa27bf7ae34d2e9416ab548db9e64f0f2f9c4cd95c6c79af8b67aba5c3e6aeef493d4aae41effcaff3b
|
7
|
+
data.tar.gz: b6f8573b8ed49d57edd03e2f1fcf59b4c8e3c9219d2463e443681739d4afd3fda9eea1c3f5ed0f0a0968623f5573ffd2cdcbcdac7d70c3729e7d2ed3612fead6
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ API-NG is Betfair's next generation API for developers looking to create automat
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem 'betfair_api_ng_rails', '
|
9
|
+
gem 'betfair_api_ng_rails', '2.0.0'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -37,6 +37,31 @@ In this files you must specify credentials to API-NG. Also you should notice tha
|
|
37
37
|
|
38
38
|
Please check [wiki pages](https://github.com/alterego-labs/betfair_api_ng_rails/wiki).
|
39
39
|
|
40
|
+
## CHANGES IN 2.0.0
|
41
|
+
|
42
|
+
One of the main features of this release was the multiaccounting.
|
43
|
+
Since version 1.5.0 is now available opportunity to place bets using placeOrders method. But at the same time there was another problem - to place bets in various Betfair accounts, and that the current implementation does not allow. Starting with version 2.0.0 is such an opportunity exists. But just be careful: if you want to use version 2.0.0 in an existing project, you have to do a small step:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
BetfairApiNgRails.config do |config|
|
47
|
+
# Rest of configuration same as for 1.5.0
|
48
|
+
|
49
|
+
# Setting up account
|
50
|
+
BetfairApiNgRails.account_manager.store BetfairApiNgRails::Account.new(config.username,
|
51
|
+
config.password,
|
52
|
+
config.application_key,
|
53
|
+
config.ssl_crt_filepath,
|
54
|
+
config.ssl_key_filepath)
|
55
|
+
BetfairApiNgRails.account_manager.default config.username
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
For additional info please visit [specific wiki page](https://github.com/alterego-labs/betfair_api_ng_rails/wiki/Multiaccounting).
|
60
|
+
|
61
|
+
## CHANGES IN 1.5.0
|
62
|
+
|
63
|
+
1. Add supporting **placeOrders** method
|
64
|
+
|
40
65
|
## CHANGES IN 1.1.0
|
41
66
|
|
42
67
|
1. Supporting all [Simple listing filtered requests](https://github.com/alterego-labs/betfair_api_ng_rails/wiki/Simple-listing-filtered-requests)
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
|
3
|
-
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubygems/specification'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
task default: :spec
|
6
|
+
desc "Run specs"
|
7
|
+
RSpec::Core::RakeTask.new do |t|
|
8
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
9
|
+
t.rspec_opts = %w(--color)
|
10
|
+
end
|
@@ -18,10 +18,15 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
|
27
|
-
|
21
|
+
spec.add_runtime_dependency 'activesupport', '>= 4.0.4'
|
22
|
+
spec.add_runtime_dependency 'rails', '>= 4.0.4'
|
23
|
+
|
24
|
+
spec.add_dependency "colorize", ">= 0.7.2"
|
25
|
+
spec.add_dependency "redis", '3.0.7'
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
28
|
+
spec.add_development_dependency "rake", ">= 10.3.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0.0.beta"
|
30
|
+
spec.add_development_dependency "rspec-its", "1.0.1"
|
31
|
+
spec.add_development_dependency "pry-nav", "0.2.3"
|
32
|
+
end
|
data/lib/betfair_api_ng_rails.rb
CHANGED
@@ -1,150 +1,214 @@
|
|
1
1
|
require "betfair_api_ng_rails/version"
|
2
2
|
require "betfair_api_ng_rails/errors"
|
3
|
-
require "betfair_api_ng_rails/api/request_methods"
|
3
|
+
require "betfair_api_ng_rails/api/request_methods/all"
|
4
4
|
require "betfair_api_ng_rails/railtie" if defined?(Rails)
|
5
|
+
require 'redis'
|
6
|
+
require 'active_support/dependencies/autoload'
|
5
7
|
|
6
8
|
module BetfairApiNgRails
|
9
|
+
extend ActiveSupport::Autoload
|
10
|
+
|
11
|
+
autoload :Account
|
12
|
+
autoload :AccountSession
|
13
|
+
autoload :AccountManager
|
14
|
+
autoload :AccountSessionManager
|
15
|
+
autoload :BadResponseError
|
7
16
|
|
8
17
|
module Api
|
18
|
+
extend ActiveSupport::Autoload
|
9
19
|
|
10
|
-
autoload :BaseProvider
|
11
|
-
autoload :BaseRequester
|
12
|
-
autoload :FormatterFactory
|
20
|
+
autoload :BaseProvider
|
21
|
+
autoload :BaseRequester
|
22
|
+
autoload :FormatterFactory
|
13
23
|
|
14
|
-
autoload :Config
|
15
|
-
autoload :Constants
|
16
|
-
autoload :Provider
|
17
|
-
autoload :SessionManager
|
24
|
+
autoload :Config
|
25
|
+
autoload :Constants
|
26
|
+
autoload :Provider
|
27
|
+
autoload :SessionManager
|
18
28
|
|
19
|
-
autoload :Connection
|
20
|
-
autoload :Hashalator
|
29
|
+
autoload :Connection
|
30
|
+
autoload :Hashalator
|
21
31
|
|
22
|
-
|
32
|
+
autoload :RequestMethod
|
23
33
|
|
24
|
-
|
34
|
+
autoload :EndpointFactory
|
35
|
+
autoload :InvalidEndpointError
|
25
36
|
|
37
|
+
module Caching
|
38
|
+
extend ActiveSupport::Autoload
|
39
|
+
|
40
|
+
autoload :Helper
|
41
|
+
autoload :ResponseCache
|
26
42
|
end
|
27
43
|
|
28
|
-
module
|
44
|
+
module Logs
|
45
|
+
extend ActiveSupport::Autoload
|
29
46
|
|
30
|
-
autoload :
|
31
|
-
autoload :
|
32
|
-
|
33
|
-
autoload :CompetitionResult, 'betfair_api_ng_rails/api/data/competition_result'
|
34
|
-
autoload :MarketFilter, 'betfair_api_ng_rails/api/data/market_filter'
|
35
|
-
autoload :TimeRange, 'betfair_api_ng_rails/api/data/time_range'
|
36
|
-
autoload :TimeRangeResult, 'betfair_api_ng_rails/api/data/time_range_result'
|
37
|
-
autoload :EventType, 'betfair_api_ng_rails/api/data/event_type'
|
38
|
-
autoload :EventTypeResult, 'betfair_api_ng_rails/api/data/event_type_result'
|
39
|
-
autoload :Event, 'betfair_api_ng_rails/api/data/event'
|
40
|
-
autoload :EventResult, 'betfair_api_ng_rails/api/data/event_result'
|
41
|
-
autoload :CountryCodeResult, 'betfair_api_ng_rails/api/data/country_code_result'
|
42
|
-
autoload :VenueResult, 'betfair_api_ng_rails/api/data/venue_result'
|
43
|
-
autoload :MarketTypeResult, 'betfair_api_ng_rails/api/data/market_type_result'
|
44
|
-
autoload :MarketCatalogue, 'betfair_api_ng_rails/api/data/market_catalogue'
|
45
|
-
autoload :MarketDescription, 'betfair_api_ng_rails/api/data/market_description'
|
46
|
-
autoload :RunnerCatalog, 'betfair_api_ng_rails/api/data/runner_catalog'
|
47
|
-
autoload :MarketBook, 'betfair_api_ng_rails/api/data/market_book'
|
48
|
-
autoload :Runner, 'betfair_api_ng_rails/api/data/runner'
|
49
|
-
autoload :Order, 'betfair_api_ng_rails/api/data/order'
|
50
|
-
autoload :Match, 'betfair_api_ng_rails/api/data/match'
|
51
|
-
autoload :StartingPrices, 'betfair_api_ng_rails/api/data/starting_prices'
|
52
|
-
autoload :ExchangePrices, 'betfair_api_ng_rails/api/data/exchange_prices'
|
53
|
-
autoload :PriceSize, 'betfair_api_ng_rails/api/data/price_size'
|
54
|
-
autoload :PriceProjection, 'betfair_api_ng_rails/api/data/price_projection'
|
55
|
-
autoload :ExBestOffersOverrides, 'betfair_api_ng_rails/api/data/ex_best_offers_overrides'
|
47
|
+
autoload :FileLogger
|
48
|
+
autoload :ConsoleLogger
|
49
|
+
end
|
56
50
|
|
57
|
-
|
51
|
+
module Formatters
|
52
|
+
extend ActiveSupport::Autoload
|
58
53
|
|
59
|
-
|
60
|
-
|
61
|
-
autoload :Jsonable, 'betfair_api_ng_rails/api/data/concerns/jsonable'
|
54
|
+
autoload :JsTreeFormatter
|
55
|
+
end
|
62
56
|
|
63
|
-
|
57
|
+
module Data
|
58
|
+
extend ActiveSupport::Autoload
|
59
|
+
|
60
|
+
autoload :Base
|
61
|
+
autoload :Constants
|
62
|
+
autoload :Competition
|
63
|
+
autoload :CompetitionResult
|
64
|
+
autoload :MarketFilter
|
65
|
+
autoload :TimeRange
|
66
|
+
autoload :TimeRangeResult
|
67
|
+
autoload :EventType
|
68
|
+
autoload :EventTypeResult
|
69
|
+
autoload :Event
|
70
|
+
autoload :EventResult
|
71
|
+
autoload :CountryCodeResult
|
72
|
+
autoload :VenueResult
|
73
|
+
autoload :MarketTypeResult
|
74
|
+
autoload :MarketCatalogue
|
75
|
+
autoload :MarketDescription
|
76
|
+
autoload :RunnerCatalog
|
77
|
+
autoload :MarketBook
|
78
|
+
autoload :Runner
|
79
|
+
autoload :Order
|
80
|
+
autoload :Match
|
81
|
+
autoload :StartingPrices
|
82
|
+
autoload :ExchangePrices
|
83
|
+
autoload :PriceSize
|
84
|
+
autoload :PriceProjection
|
85
|
+
autoload :ExBestOffersOverrides
|
86
|
+
autoload :PlaceExecutionReport
|
87
|
+
autoload :PlaceInstructionReport
|
88
|
+
autoload :PlaceInstruction
|
89
|
+
autoload :LimitOrder
|
90
|
+
autoload :LimitOnCloseOrder
|
91
|
+
autoload :MarketOnCloseOrder
|
92
|
+
autoload :AccountDetailsResponse
|
93
|
+
autoload :AccountFundsResponse
|
94
|
+
autoload :StatementLegacyData
|
95
|
+
autoload :StatementItem
|
96
|
+
autoload :AccountStatementReport
|
64
97
|
|
98
|
+
module Concerns
|
99
|
+
extend ActiveSupport::Autoload
|
100
|
+
|
101
|
+
autoload :Hashable
|
102
|
+
autoload :Attributable
|
103
|
+
autoload :Jsonable
|
104
|
+
end
|
65
105
|
end
|
66
106
|
|
67
107
|
module Enums
|
68
|
-
|
69
|
-
|
70
|
-
autoload :
|
71
|
-
autoload :
|
72
|
-
autoload :
|
73
|
-
autoload :
|
74
|
-
autoload :
|
75
|
-
autoload :
|
76
|
-
autoload :
|
77
|
-
autoload :
|
78
|
-
autoload :
|
79
|
-
autoload :
|
80
|
-
autoload :
|
81
|
-
autoload :
|
82
|
-
autoload :
|
83
|
-
autoload :
|
84
|
-
autoload :
|
85
|
-
autoload :
|
86
|
-
autoload :
|
87
|
-
autoload :
|
88
|
-
autoload :
|
89
|
-
autoload :
|
90
|
-
autoload :
|
108
|
+
extend ActiveSupport::Autoload
|
109
|
+
|
110
|
+
autoload :MarketProjection
|
111
|
+
autoload :PriceData
|
112
|
+
autoload :MatchProjection
|
113
|
+
autoload :OrderProjection
|
114
|
+
autoload :MarketStatus
|
115
|
+
autoload :RunnerStatus
|
116
|
+
autoload :TimeGranularity
|
117
|
+
autoload :Side
|
118
|
+
autoload :OrderStatus
|
119
|
+
autoload :OrderBy
|
120
|
+
autoload :SortDir
|
121
|
+
autoload :OrderType
|
122
|
+
autoload :MarketSort
|
123
|
+
autoload :MarketBettingType
|
124
|
+
autoload :ExecutionReportStatus
|
125
|
+
autoload :ExecutionReportErrorCode
|
126
|
+
autoload :PersistenceType
|
127
|
+
autoload :InstrictionReportStatus
|
128
|
+
autoload :InstructionReportErrorCode
|
129
|
+
autoload :RollupModel
|
130
|
+
autoload :GroupBy
|
131
|
+
autoload :BetStatus
|
132
|
+
autoload :IncludeItem
|
133
|
+
autoload :Wallet
|
134
|
+
autoload :ItemClass
|
91
135
|
|
92
136
|
module Concerns
|
137
|
+
extend ActiveSupport::Autoload
|
93
138
|
|
94
|
-
autoload :Enumable
|
95
|
-
|
139
|
+
autoload :Enumable
|
96
140
|
end
|
97
|
-
|
98
141
|
end
|
99
142
|
|
100
143
|
module Http
|
144
|
+
extend ActiveSupport::Autoload
|
101
145
|
|
102
|
-
autoload :Requester
|
103
|
-
autoload :Responser
|
104
|
-
autoload :Factory
|
105
|
-
|
146
|
+
autoload :Requester
|
147
|
+
autoload :Responser
|
148
|
+
autoload :Factory
|
149
|
+
autoload :ProxyRequester
|
106
150
|
end
|
107
151
|
|
108
152
|
module Parsers
|
109
|
-
|
110
|
-
|
111
|
-
autoload :
|
112
|
-
autoload :
|
113
|
-
autoload :
|
114
|
-
autoload :
|
115
|
-
autoload :
|
116
|
-
autoload :
|
117
|
-
autoload :
|
118
|
-
autoload :
|
119
|
-
autoload :
|
120
|
-
|
153
|
+
extend ActiveSupport::Autoload
|
154
|
+
|
155
|
+
autoload :Base
|
156
|
+
autoload :ListBase
|
157
|
+
autoload :SingleBase
|
158
|
+
autoload :ListCompetitions
|
159
|
+
autoload :ListEventTypes
|
160
|
+
autoload :ListEvents
|
161
|
+
autoload :ListTimeRanges
|
162
|
+
autoload :ListCountries
|
163
|
+
autoload :ListVenues
|
164
|
+
autoload :ListMarketTypes
|
165
|
+
autoload :ListMarketCatalogue
|
166
|
+
autoload :ListMarketBook
|
167
|
+
autoload :PlaceOrders
|
168
|
+
autoload :GetAccountDetails
|
169
|
+
autoload :GetAccountFunds
|
170
|
+
autoload :GetAccountStatement
|
121
171
|
end
|
122
172
|
|
123
173
|
module ConnectionExt
|
124
|
-
|
125
|
-
|
126
|
-
autoload :
|
127
|
-
autoload :
|
128
|
-
|
174
|
+
extend ActiveSupport::Autoload
|
175
|
+
|
176
|
+
autoload :ErrorHandling
|
177
|
+
autoload :SsoidRefreshing
|
178
|
+
autoload :Parsing
|
179
|
+
autoload :Formatting
|
180
|
+
autoload :Logging
|
181
|
+
autoload :Caching
|
129
182
|
end
|
130
183
|
|
184
|
+
module Endpoints
|
185
|
+
extend ActiveSupport::Autoload
|
186
|
+
|
187
|
+
autoload :Base
|
188
|
+
autoload :Uk
|
189
|
+
autoload :Australian
|
190
|
+
autoload :Italian
|
191
|
+
autoload :Spanish
|
192
|
+
end
|
131
193
|
end
|
132
194
|
|
133
195
|
include Api::Data
|
134
|
-
extend Api::RequestMethods
|
196
|
+
extend Api::RequestMethods::All
|
197
|
+
|
198
|
+
class << self
|
199
|
+
attr_accessor :log
|
200
|
+
end
|
135
201
|
|
136
202
|
def self.config(&block)
|
137
203
|
@_config ||= BetfairApiNgRails::Api::Config
|
138
204
|
block_given? ? yield(@_config) : @_config
|
139
205
|
end
|
140
206
|
|
141
|
-
def self.
|
142
|
-
|
143
|
-
@connection
|
207
|
+
def self.account_manager
|
208
|
+
BetfairApiNgRails::AccountManager.instance
|
144
209
|
end
|
145
210
|
|
146
|
-
def self.
|
147
|
-
|
211
|
+
def self.account_session_manager
|
212
|
+
BetfairApiNgRails::AccountSessionManager.instance
|
148
213
|
end
|
149
|
-
|
150
214
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module BetfairApiNgRails
|
4
|
+
class AccountManager
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
attr_reader :accounts
|
8
|
+
attr_reader :default_account
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
clear
|
12
|
+
end
|
13
|
+
|
14
|
+
def store(account)
|
15
|
+
accounts[account.username] = account
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(username)
|
19
|
+
accounts.fetch username, fetch_default_account
|
20
|
+
end
|
21
|
+
|
22
|
+
def default(username)
|
23
|
+
@default_account = username
|
24
|
+
end
|
25
|
+
|
26
|
+
def clear
|
27
|
+
@accounts = {}
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def fetch_default_account
|
33
|
+
accounts.fetch default_account, nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|