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.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -1
  3. data/Rakefile +8 -8
  4. data/betfair_api_ng_rails.gemspec +12 -7
  5. data/lib/betfair_api_ng_rails.rb +162 -98
  6. data/lib/betfair_api_ng_rails/account.rb +4 -0
  7. data/lib/betfair_api_ng_rails/account_manager.rb +36 -0
  8. data/lib/betfair_api_ng_rails/account_session.rb +5 -0
  9. data/lib/betfair_api_ng_rails/account_session_manager.rb +29 -0
  10. data/lib/betfair_api_ng_rails/api/caching/helper.rb +34 -0
  11. data/lib/betfair_api_ng_rails/api/caching/response_cache.rb +57 -0
  12. data/lib/betfair_api_ng_rails/api/concerns/errorable.rb +1 -3
  13. data/lib/betfair_api_ng_rails/api/config.rb +20 -8
  14. data/lib/betfair_api_ng_rails/api/connection.rb +28 -10
  15. data/lib/betfair_api_ng_rails/api/connection_ext/caching.rb +60 -0
  16. data/lib/betfair_api_ng_rails/api/connection_ext/error_handling.rb +5 -1
  17. data/lib/betfair_api_ng_rails/api/connection_ext/logging.rb +34 -0
  18. data/lib/betfair_api_ng_rails/api/connection_ext/parsing.rb +2 -4
  19. data/lib/betfair_api_ng_rails/api/connection_ext/ssoid_refreshing.rb +40 -0
  20. data/lib/betfair_api_ng_rails/api/constants.rb +39 -18
  21. data/lib/betfair_api_ng_rails/api/data/account_details_response.rb +27 -0
  22. data/lib/betfair_api_ng_rails/api/data/account_funds_response.rb +26 -0
  23. data/lib/betfair_api_ng_rails/api/data/account_statement_report.rb +17 -0
  24. data/lib/betfair_api_ng_rails/api/data/competition.rb +3 -4
  25. data/lib/betfair_api_ng_rails/api/data/competition_result.rb +1 -3
  26. data/lib/betfair_api_ng_rails/api/data/concerns/attributable.rb +2 -6
  27. data/lib/betfair_api_ng_rails/api/data/concerns/hashable.rb +11 -4
  28. data/lib/betfair_api_ng_rails/api/data/constants.rb +2 -4
  29. data/lib/betfair_api_ng_rails/api/data/country_code_result.rb +1 -3
  30. data/lib/betfair_api_ng_rails/api/data/event.rb +1 -2
  31. data/lib/betfair_api_ng_rails/api/data/event_result.rb +1 -3
  32. data/lib/betfair_api_ng_rails/api/data/limit_on_close_order.rb +22 -0
  33. data/lib/betfair_api_ng_rails/api/data/limit_order.rb +23 -0
  34. data/lib/betfair_api_ng_rails/api/data/market_book.rb +2 -4
  35. data/lib/betfair_api_ng_rails/api/data/market_filter.rb +3 -2
  36. data/lib/betfair_api_ng_rails/api/data/market_on_close_order.rb +20 -0
  37. data/lib/betfair_api_ng_rails/api/data/order.rb +1 -3
  38. data/lib/betfair_api_ng_rails/api/data/place_execution_report.rb +24 -0
  39. data/lib/betfair_api_ng_rails/api/data/place_instruction.rb +25 -0
  40. data/lib/betfair_api_ng_rails/api/data/place_instruction_report.rb +27 -0
  41. data/lib/betfair_api_ng_rails/api/data/statement_item.rb +30 -0
  42. data/lib/betfair_api_ng_rails/api/data/statement_legacy_data.rb +40 -0
  43. data/lib/betfair_api_ng_rails/api/endpoint_factory.rb +21 -0
  44. data/lib/betfair_api_ng_rails/api/endpoints/australian.rb +17 -0
  45. data/lib/betfair_api_ng_rails/api/endpoints/base.rb +42 -0
  46. data/lib/betfair_api_ng_rails/api/endpoints/italian.rb +17 -0
  47. data/lib/betfair_api_ng_rails/api/endpoints/spanish.rb +17 -0
  48. data/lib/betfair_api_ng_rails/api/endpoints/uk.rb +17 -0
  49. data/lib/betfair_api_ng_rails/api/enums/execution_report_error_code.rb +22 -1
  50. data/lib/betfair_api_ng_rails/api/enums/execution_report_status.rb +12 -1
  51. data/lib/betfair_api_ng_rails/api/enums/include_item.rb +23 -0
  52. data/lib/betfair_api_ng_rails/api/enums/instruction_report_error_code.rb +25 -1
  53. data/lib/betfair_api_ng_rails/api/enums/instruction_report_status.rb +8 -1
  54. data/lib/betfair_api_ng_rails/api/enums/item_class.rb +19 -0
  55. data/lib/betfair_api_ng_rails/api/enums/order_status.rb +7 -1
  56. data/lib/betfair_api_ng_rails/api/enums/order_type.rb +11 -2
  57. data/lib/betfair_api_ng_rails/api/enums/persistence_type.rb +8 -1
  58. data/lib/betfair_api_ng_rails/api/enums/side.rb +7 -2
  59. data/lib/betfair_api_ng_rails/api/enums/wallet.rb +20 -0
  60. data/lib/betfair_api_ng_rails/api/formatter_factory.rb +2 -4
  61. data/lib/betfair_api_ng_rails/api/formatters/js_tree_formatter.rb +2 -4
  62. data/lib/betfair_api_ng_rails/api/hashalator.rb +6 -6
  63. data/lib/betfair_api_ng_rails/api/helper.rb +2 -4
  64. data/lib/betfair_api_ng_rails/api/http/factory.rb +19 -14
  65. data/lib/betfair_api_ng_rails/api/http/helpers/information_response.rb +2 -4
  66. data/lib/betfair_api_ng_rails/api/http/helpers/keep_alive_response.rb +3 -4
  67. data/lib/betfair_api_ng_rails/api/http/helpers/session_response.rb +3 -4
  68. data/lib/betfair_api_ng_rails/api/http/proxy_requester.rb +87 -0
  69. data/lib/betfair_api_ng_rails/api/http/requester.rb +3 -3
  70. data/lib/betfair_api_ng_rails/api/http/responser.rb +4 -3
  71. data/lib/betfair_api_ng_rails/api/invalid_endpoint_error.rb +6 -0
  72. data/lib/betfair_api_ng_rails/api/logs/console_logger.rb +13 -0
  73. data/lib/betfair_api_ng_rails/api/logs/file_logger.rb +23 -0
  74. data/lib/betfair_api_ng_rails/api/parsers/base.rb +14 -6
  75. data/lib/betfair_api_ng_rails/api/parsers/get_account_details.rb +13 -0
  76. data/lib/betfair_api_ng_rails/api/parsers/get_account_funds.rb +14 -0
  77. data/lib/betfair_api_ng_rails/api/parsers/get_account_statement.rb +15 -0
  78. data/lib/betfair_api_ng_rails/api/parsers/list_base.rb +18 -0
  79. data/lib/betfair_api_ng_rails/api/parsers/list_competitions.rb +5 -7
  80. data/lib/betfair_api_ng_rails/api/parsers/list_countries.rb +5 -7
  81. data/lib/betfair_api_ng_rails/api/parsers/list_event_types.rb +5 -7
  82. data/lib/betfair_api_ng_rails/api/parsers/list_events.rb +5 -7
  83. data/lib/betfair_api_ng_rails/api/parsers/list_market_book.rb +5 -7
  84. data/lib/betfair_api_ng_rails/api/parsers/list_market_catalogue.rb +5 -7
  85. data/lib/betfair_api_ng_rails/api/parsers/list_market_types.rb +5 -7
  86. data/lib/betfair_api_ng_rails/api/parsers/list_time_ranges.rb +5 -7
  87. data/lib/betfair_api_ng_rails/api/parsers/list_venues.rb +5 -7
  88. data/lib/betfair_api_ng_rails/api/parsers/place_orders.rb +14 -0
  89. data/lib/betfair_api_ng_rails/api/parsers/single_base.rb +19 -0
  90. data/lib/betfair_api_ng_rails/api/provider.rb +11 -14
  91. data/lib/betfair_api_ng_rails/api/request_method.rb +43 -0
  92. data/lib/betfair_api_ng_rails/api/request_methods/account.rb +51 -0
  93. data/lib/betfair_api_ng_rails/api/request_methods/all.rb +26 -0
  94. data/lib/betfair_api_ng_rails/api/request_methods/betting.rb +30 -0
  95. data/lib/betfair_api_ng_rails/api/session_manager.rb +34 -31
  96. data/lib/betfair_api_ng_rails/bad_response_error.rb +4 -0
  97. data/lib/betfair_api_ng_rails/errors.rb +3 -2
  98. data/lib/betfair_api_ng_rails/railtie.rb +7 -2
  99. data/lib/betfair_api_ng_rails/version.rb +1 -1
  100. data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.rb +20 -11
  101. data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.yml +5 -7
  102. data/spec/lib/betfair_api_ng_rails/account_manager_spec.rb +76 -0
  103. data/spec/lib/betfair_api_ng_rails/account_session_manager_spec.rb +59 -0
  104. data/spec/lib/betfair_api_ng_rails/account_session_spec.rb +13 -0
  105. data/spec/lib/betfair_api_ng_rails/account_spec.rb +18 -0
  106. data/spec/lib/betfair_api_ng_rails/api/caching/helper_spec.rb +89 -0
  107. data/spec/lib/betfair_api_ng_rails/api/caching/response_cache_spec.rb +131 -0
  108. data/spec/lib/betfair_api_ng_rails/api/config_spec.rb +37 -0
  109. data/spec/lib/betfair_api_ng_rails/api/connection_spec.rb +99 -0
  110. data/spec/lib/betfair_api_ng_rails/api/data/account_statement_report_spec.rb +11 -0
  111. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/competition_result_spec.rb +0 -0
  112. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/competition_spec.rb +0 -0
  113. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/concerns/attributable_spec.rb +0 -0
  114. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/concerns/hashable_spec.rb +16 -32
  115. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/concerns/jsonable_spec.rb +0 -0
  116. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/country_code_result_spec.rb +0 -0
  117. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_result_spec.rb +0 -0
  118. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_spec.rb +0 -0
  119. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_type_result_spec.rb +0 -0
  120. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/event_type_spec.rb +0 -0
  121. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/ex_best_offers_overrides_spec.rb +0 -0
  122. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/exchange_prices_spec.rb +0 -0
  123. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_book_spec.rb +1 -6
  124. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_catalogue_spec.rb +0 -0
  125. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_description_spec.rb +0 -0
  126. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_filter_spec.rb +0 -0
  127. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/market_type_result_spec.rb +0 -0
  128. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/match_spec.rb +0 -0
  129. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/order_spec.rb +0 -0
  130. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/price_projection_spec.rb +0 -0
  131. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/price_size_spec.rb +0 -0
  132. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/runner_catalog_spec.rb +0 -0
  133. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/runner_spec.rb +0 -0
  134. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/starting_prices_spec.rb +0 -0
  135. data/spec/lib/betfair_api_ng_rails/api/data/statement_item_spec.rb +9 -0
  136. data/spec/lib/betfair_api_ng_rails/api/data/statement_legacy_data_spec.rb +6 -0
  137. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/time_range_result_spec.rb +0 -0
  138. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/time_range_spec.rb +1 -3
  139. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/data/venue_result_spec.rb +0 -0
  140. data/spec/lib/betfair_api_ng_rails/api/endpoint_factory_spec.rb +27 -0
  141. data/spec/lib/betfair_api_ng_rails/api/endpoints/australian_spec.rb +6 -0
  142. data/spec/lib/betfair_api_ng_rails/api/endpoints/base_spec.rb +5 -0
  143. data/spec/lib/betfair_api_ng_rails/api/endpoints/italian_spec.rb +6 -0
  144. data/spec/lib/betfair_api_ng_rails/api/endpoints/spanish_spec.rb +7 -0
  145. data/spec/lib/betfair_api_ng_rails/api/endpoints/uk_spec.rb +6 -0
  146. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/formatters/js_tree_formatter_spec.rb +0 -0
  147. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/hashalator_spec.rb +27 -46
  148. data/spec/lib/betfair_api_ng_rails/api/http/factory_spec.rb +40 -0
  149. data/spec/lib/betfair_api_ng_rails/api/logs/console_logger_spec.rb +18 -0
  150. data/spec/lib/betfair_api_ng_rails/api/logs/file_logger_spec.rb +33 -0
  151. data/spec/lib/betfair_api_ng_rails/api/provider_spec.rb +53 -0
  152. data/spec/lib/betfair_api_ng_rails/api/request_method_spec.rb +38 -0
  153. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/api/request_methods_spec.rb +47 -32
  154. data/spec/lib/betfair_api_ng_rails/api/session_manager_spec.rb +77 -0
  155. data/spec/lib/betfair_api_ng_rails/integration/get_account_statement_spec.rb +57 -0
  156. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_competitions_spec.rb +7 -9
  157. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_countries_spec.rb +7 -9
  158. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_event_types_spec.rb +7 -9
  159. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_events_spec.rb +7 -9
  160. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_market_book_spec.rb +7 -9
  161. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_market_catalogue_spec.rb +7 -16
  162. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_market_types_spec.rb +7 -9
  163. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_time_ranges_spec.rb +7 -9
  164. data/spec/{betfair_api_ng_rails → lib/betfair_api_ng_rails}/integration/list_venues_spec.rb +7 -9
  165. data/spec/lib/betfair_api_ng_rails/integration/place_orders_spec.rb +55 -0
  166. data/spec/spec_helper.rb +9 -1
  167. data/spec/support/base_yaml_loader.rb +2 -4
  168. data/spec/support/data/models.yml +37 -1
  169. data/spec/support/data_models_yaml_loader.rb +1 -3
  170. data/spec/support/have_attr_accessor.rb +18 -0
  171. data/spec/support/helper.rb +1 -3
  172. data/spec/support/shared_examples/base_endpoint.rb +5 -0
  173. data/spec/support/shared_examples/concrete_endpoint.rb +28 -0
  174. data/spec/support/shared_examples/data_model.rb +2 -11
  175. data/spec/support/shared_examples/request_method.rb +5 -8
  176. data/spec/support/shared_examples/simple_list_filtering_request.rb +10 -19
  177. metadata +252 -117
  178. data/lib/betfair_api_ng_rails/api/request_methods.rb +0 -41
  179. data/spec/betfair_api_ng_rails/api/connection_spec.rb +0 -76
  180. data/spec/betfair_api_ng_rails/api/provider_spec.rb +0 -91
  181. 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: 3a846cee18d46f60c19a677111624b07cb5673ce
4
- data.tar.gz: 5bbef065b3ef31d43d789d1daef6e347aa4d4678
3
+ metadata.gz: ca32b3a7503facf55e960bae30e2ea935212e962
4
+ data.tar.gz: 3d8898545fa0c7946b87c1cef82a83105ae18518
5
5
  SHA512:
6
- metadata.gz: 8be49808b5673fc0dfd9aebfb786743d2749703d07adbd5de2ae171c518a1bd825c2d5a1af971e675a1e5af7f2d27034d96d7248022b13e1bceedb9b275d1bed
7
- data.tar.gz: ed938a79784a41ddb3fff8dd18550d6b98c7b21bed9af4922eb2e67c1be180cd3c544559b789d13c893728a92fe0a65558e1349d4a989da9ef2a3f635f0468aa
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', '1.0.0'
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
- # require 'rspec/core/rake_task'
3
- # require 'rubygems/specification'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubygems/specification'
4
4
 
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
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.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "activesupport", ">= 3.1.0"
24
- spec.add_development_dependency "rspec", "~> 3.0.0.beta"
25
- spec.add_development_dependency "rspec-its"
26
- spec.add_development_dependency "pry-nav"
27
- end
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
@@ -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, 'betfair_api_ng_rails/api/base_provider'
11
- autoload :BaseRequester, 'betfair_api_ng_rails/api/base_requester'
12
- autoload :FormatterFactory, 'betfair_api_ng_rails/api/formatter_factory'
20
+ autoload :BaseProvider
21
+ autoload :BaseRequester
22
+ autoload :FormatterFactory
13
23
 
14
- autoload :Config, 'betfair_api_ng_rails/api/config'
15
- autoload :Constants, 'betfair_api_ng_rails/api/constants'
16
- autoload :Provider, 'betfair_api_ng_rails/api/provider'
17
- autoload :SessionManager, 'betfair_api_ng_rails/api/session_manager'
24
+ autoload :Config
25
+ autoload :Constants
26
+ autoload :Provider
27
+ autoload :SessionManager
18
28
 
19
- autoload :Connection, 'betfair_api_ng_rails/api/connection'
20
- autoload :Hashalator, 'betfair_api_ng_rails/api/hashalator'
29
+ autoload :Connection
30
+ autoload :Hashalator
21
31
 
22
- module Formatters
32
+ autoload :RequestMethod
23
33
 
24
- autoload :JsTreeFormatter, 'betfair_api_ng_rails/api/formatters/js_tree_formatter'
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 Data
44
+ module Logs
45
+ extend ActiveSupport::Autoload
29
46
 
30
- autoload :Base, 'betfair_api_ng_rails/api/data/base'
31
- autoload :Constants, 'betfair_api_ng_rails/api/data/constants'
32
- autoload :Competition, 'betfair_api_ng_rails/api/data/competition'
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
- module Concerns
51
+ module Formatters
52
+ extend ActiveSupport::Autoload
58
53
 
59
- autoload :Hashable, 'betfair_api_ng_rails/api/data/concerns/hashable'
60
- autoload :Attributable, 'betfair_api_ng_rails/api/data/concerns/attributable'
61
- autoload :Jsonable, 'betfair_api_ng_rails/api/data/concerns/jsonable'
54
+ autoload :JsTreeFormatter
55
+ end
62
56
 
63
- end
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
- autoload :MarketProjection, 'betfair_api_ng_rails/api/enums/market_projection'
70
- autoload :PriceData, 'betfair_api_ng_rails/api/enums/price_data'
71
- autoload :MatchProjection, 'betfair_api_ng_rails/api/enums/match_projection'
72
- autoload :OrderProjection, 'betfair_api_ng_rails/api/enums/order_projection'
73
- autoload :MarketStatus, 'betfair_api_ng_rails/api/enums/market_status'
74
- autoload :RunnerStatus, 'betfair_api_ng_rails/api/enums/runner_status'
75
- autoload :TimeGranularity, 'betfair_api_ng_rails/api/enums/time_granularity'
76
- autoload :Side, 'betfair_api_ng_rails/api/enums/side'
77
- autoload :OrderStatus, 'betfair_api_ng_rails/api/enums/order_status'
78
- autoload :OrderBy, 'betfair_api_ng_rails/api/enums/order_by'
79
- autoload :SortDir, 'betfair_api_ng_rails/api/enums/sort_dir'
80
- autoload :OrderType, 'betfair_api_ng_rails/api/enums/order_type'
81
- autoload :MarketSort, 'betfair_api_ng_rails/api/enums/market_sort'
82
- autoload :MarketBettingType, 'betfair_api_ng_rails/api/enums/market_betting_type'
83
- autoload :ExecutionReportStatus, 'betfair_api_ng_rails/api/enums/execution_report_status'
84
- autoload :ExecutionReportErrorCode, 'betfair_api_ng_rails/api/enums/execution_report_error_code'
85
- autoload :PersistenceType, 'betfair_api_ng_rails/api/enums/perisstence_type'
86
- autoload :InstrictionReportStatus, 'betfair_api_ng_rails/api/enums/instruction_report_status'
87
- autoload :InstructionReportErrorCode, 'betfair_api_ng_rails/api/enums/instruction_report_error_code'
88
- autoload :RollupModel, 'betfair_api_ng_rails/api/enums/rollup_model'
89
- autoload :GroupBy, 'betfair_api_ng_rails/api/enums/group_by'
90
- autoload :BetStatus, 'betfair_api_ng_rails/api/enums/bet_status'
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, 'betfair_api_ng_rails/api/enums/concerns/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, 'betfair_api_ng_rails/api/http/requester'
103
- autoload :Responser, 'betfair_api_ng_rails/api/http/responser'
104
- autoload :Factory, 'betfair_api_ng_rails/api/http/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
- autoload :Base, 'betfair_api_ng_rails/api/parsers/base'
111
- autoload :ListCompetitions, 'betfair_api_ng_rails/api/parsers/list_competitions'
112
- autoload :ListEventTypes, 'betfair_api_ng_rails/api/parsers/list_event_types'
113
- autoload :ListEvents, 'betfair_api_ng_rails/api/parsers/list_events'
114
- autoload :ListTimeRanges, 'betfair_api_ng_rails/api/parsers/list_time_ranges'
115
- autoload :ListCountries, 'betfair_api_ng_rails/api/parsers/list_countries'
116
- autoload :ListVenues, 'betfair_api_ng_rails/api/parsers/list_venues'
117
- autoload :ListMarketTypes, 'betfair_api_ng_rails/api/parsers/list_market_types'
118
- autoload :ListMarketCatalogue, 'betfair_api_ng_rails/api/parsers/list_market_catalogue'
119
- autoload :ListMarketBook, 'betfair_api_ng_rails/api/parsers/list_market_book'
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
- autoload :ErrorHandling, 'betfair_api_ng_rails/api/connection_ext/error_handling'
126
- autoload :Parsing, 'betfair_api_ng_rails/api/connection_ext/parsing'
127
- autoload :Formatting, 'betfair_api_ng_rails/api/connection_ext/formatting'
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.connection
142
- raise BetfairApiNgRails::NoConnectionError unless @connection
143
- @connection
207
+ def self.account_manager
208
+ BetfairApiNgRails::AccountManager.instance
144
209
  end
145
210
 
146
- def self.connection=(value)
147
- @connection = value
211
+ def self.account_session_manager
212
+ BetfairApiNgRails::AccountSessionManager.instance
148
213
  end
149
-
150
214
  end
@@ -0,0 +1,4 @@
1
+ module BetfairApiNgRails
2
+ class Account < Struct.new(:username, :password, :app_key, :crt_filepath, :key_filepath)
3
+ end
4
+ 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