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
@@ -0,0 +1,30 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Data
4
+ #
5
+ # Summary of a cleared order.
6
+ #
7
+ class StatementItem < Api::Data::Base
8
+ include Api::Data::Concerns::Hashable
9
+
10
+ STATEMENT_ITEM_ATTRS = [
11
+ :ref_id,
12
+ :item_date,
13
+ :amount,
14
+ :balance,
15
+ :item_class,
16
+ :item_class_data,
17
+ { legacy_data: { type: BetfairApiNgRails::StatementLegacyData } }
18
+ ]
19
+
20
+ attributes STATEMENT_ITEM_ATTRS
21
+
22
+ def self.to_hash_attrs
23
+ STATEMENT_ITEM_ATTRS
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+
@@ -0,0 +1,40 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Data
4
+ #
5
+ # Summary of a cleared order.
6
+ #
7
+ class StatementLegacyData < Api::Data::Base
8
+ include Api::Data::Concerns::Hashable
9
+
10
+ STATEMENT_LEGACY_DATA_ATTRS = [
11
+ :avg_price,
12
+ :bet_size,
13
+ :bet_type,
14
+ :bet_category_type,
15
+ :comission_rate,
16
+ :event_id,
17
+ :event_type_id,
18
+ :full_market_name,
19
+ :gross_bet_amount,
20
+ :market_name,
21
+ :market_type,
22
+ :placed_date,
23
+ :selection_id,
24
+ :selection_name,
25
+ :start_date,
26
+ :transaction_type,
27
+ :transaction_id,
28
+ :win_lose
29
+ ]
30
+
31
+ attributes STATEMENT_LEGACY_DATA_ATTRS
32
+
33
+ def self.to_hash_attrs
34
+ STATEMENT_LEGACY_DATA_ATTRS
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
@@ -0,0 +1,21 @@
1
+ require 'active_support/core_ext/object'
2
+
3
+ module BetfairApiNgRails
4
+ module Api
5
+ class EndpointFactory
6
+ class << self
7
+ def call(name)
8
+ name.is_a?(Symbol) ? init_by_name(name) : name.try(:new)
9
+ end
10
+
11
+ private
12
+
13
+ def init_by_name(name)
14
+ "BetfairApiNgRails::Api::Endpoints::#{name.to_s.camelize}".constantize.new
15
+ rescue NameError
16
+ raise Api::InvalidEndpointError, "Could not found endpoint `#{name}`!"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Endpoints
4
+ class Australian < Base
5
+ protected
6
+
7
+ def api_domain
8
+ "api-au.betfair.com"
9
+ end
10
+
11
+ def login_domain
12
+ "identitysso.betfair.com"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,42 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Endpoints
4
+ #
5
+ # Template class for defining endpoints.
6
+ # Api endpoint provides URL building methods.
7
+ # In derived classes (endpoints) you must to reimplement next protected methods:
8
+ # - `#api_domain`
9
+ # - `#login_domain`
10
+ #
11
+ class Base
12
+ #
13
+ # Provides api url for specified api type
14
+ #
15
+ # Parameters:
16
+ # api_type - one of the :betting or :account
17
+ #
18
+ def api_url(api_type)
19
+ "https://#{api_domain}/exchange/#{api_type}/json-rpc/v1"
20
+ end
21
+
22
+ def login_url
23
+ "https://#{login_domain}/api/certlogin"
24
+ end
25
+
26
+ def keep_alive_url
27
+ "https://#{login_domain}/api/keepAlive"
28
+ end
29
+
30
+ protected
31
+
32
+ def api_domain
33
+ raise NotImplementedError
34
+ end
35
+
36
+ def login_domain
37
+ raise NotImplementedError
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,17 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Endpoints
4
+ class Italian < Base
5
+ protected
6
+
7
+ def api_domain
8
+ "api.betfair.com"
9
+ end
10
+
11
+ def login_domain
12
+ "identitysso.betfair.it"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Endpoints
4
+ class Spanish < Base
5
+ protected
6
+
7
+ def api_domain
8
+ "api.betfair.com"
9
+ end
10
+
11
+ def login_domain
12
+ "identitysso.betfair.es"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Endpoints
4
+ class Uk < Base
5
+ protected
6
+
7
+ def api_domain
8
+ "api.betfair.com"
9
+ end
10
+
11
+ def login_domain
12
+ "identitysso.betfair.com"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,27 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # Error code of execution report
6
+ #
7
+ # Includes:
8
+ # ERROR_IN_MATCHER - The matcher is not healthy
9
+ # PROCESSED_WITH_ERRORS - The order itself has been accepted, but at least one (possibly all) actions have generated errors
10
+ # BET_ACTION_ERROR - There is an error with an action that has caused the entire order to be rejected
11
+ # INVALID_ACCOUNT_STATE - Order rejected due to the account's status (suspended, inactive, dup cards)
12
+ # INVALID_WALLET_STATUS - Order rejected due to the account's wallet's status
13
+ # INSUFFICIENT_FUNDS - Account has exceeded its exposure limit or available to bet limit
14
+ # LOSS_LIMIT_EXCEEDED - The account has exceed the self imposed loss limit
15
+ # MARKET_SUSPENDED - Market is suspended
16
+ # MARKET_NOT_OPEN_FOR_BETTING - Market is not open for betting. It is either not yet active, suspended or closed awaiting settlement.
17
+ # DUPLICATE_TRANSACTION - duplicate customer referece data submitted
18
+ # INVALID_ORDER - Order cannot be accepted by the matcher due to the combination of actions. For example, bets being edited are not on the same market, or order includes both edits and placement
19
+ # INVALID_MARKET_ID - Market doesn't exist
20
+ # PERMISSION_DENIED - Business rules do not allow order to be placed
21
+ # DUPLICATE_BETIDS - duplicate bet ids found
22
+ # NO_ACTION_REQUIRED - Order hasn't been passed to matcher as system detected there will be no state change
23
+ # SERVICE_UNAVAILABLE - The requested service is unavailable
24
+ # REJECTED_BY_REGULATOR - The regulator rejected the order. On the Italian Exchange this error will occur if more than 50 bets are sent in a single placeOrders request.
4
25
  class ExecutionReportErrorCode
5
26
  extend Api::Enums::Concerns::Enumable
6
27
 
@@ -25,4 +46,4 @@ module BetfairApiNgRails
25
46
  end
26
47
  end
27
48
  end
28
- end
49
+ end
@@ -1,6 +1,17 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # Status of execution report
6
+ #
7
+ # Includes:
8
+ # SUCCESS - Order processed successfully
9
+ # FAILURE - Order failed.
10
+ # PROCESSED_WITH_ERRORS - The order itself has been accepted, but at least one (possibly all)
11
+ # actions have generated errors. This error only occurs for replaceOrders,
12
+ # cancelOrders and updateOrders operations. The placeOrders operation will not return
13
+ # PROCESSED_WITH_ERRORS status as it is an atomic operation.
14
+ # TIMEOUT - Order timed out.
4
15
  class ExecutionReportStatus
5
16
  extend Api::Enums::Concerns::Enumable
6
17
 
@@ -12,4 +23,4 @@ module BetfairApiNgRails
12
23
  end
13
24
  end
14
25
  end
15
- end
26
+ end
@@ -0,0 +1,23 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Enums
4
+ # Specifies item type to include for account statement report
5
+ #
6
+ # Includes:
7
+ # ALL - Include all items
8
+ # DEPOSITS_WITHDRAWALS - Include payments only
9
+ # EXCHANGE - Include exchange bets only
10
+ # POKER_ROOM - Include poker transactions only
11
+ #
12
+ class IncludeItem
13
+ extend Api::Enums::Concerns::Enumable
14
+
15
+ enumify "ALL",
16
+ "DEPOSITS_WITHDRAWALS",
17
+ "EXCHANGE",
18
+ "POKER_ROOM"
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -1,6 +1,30 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # Indicates cause of failure
6
+ #
7
+ # Includes:
8
+ # INVALID_BET_SIZE - bet size is invalid for your currency or your regulator
9
+ # INVALID_RUNNER - Runner does not exist, includes vacant traps in greyhound racing
10
+ # BET_TAKEN_OR_LAPSED - Bet cannot be cancelled or modified as it has already been taken or has lapsed Includes attempts to cancel/modify market on close BSP bets and cancelling limit on close BSP bets
11
+ # BET_IN_PROGRESS - No result was received from the matcher in a timeout configured for the system
12
+ # RUNNER_REMOVED - Runner has been removed from the event
13
+ # MARKET_NOT_OPEN_FOR_BETTING - Attempt to edit a bet on a market that has closed.
14
+ # LOSS_LIMIT_EXCEEDED - The action has caused the account to exceed the self imposed loss limit
15
+ # MARKET_NOT_OPEN_FOR_BSP_BETTING - Market now closed to bsp betting. Turned in-play or has been reconciled
16
+ # INVALID_PRICE_EDIT - Attempt to edit down the price of a bsp limit on close lay bet, or edit up the price of a limit on close back bet
17
+ # INVALID_ODDS - Odds not on price ladder - either edit or placement
18
+ # INSUFFICIENT_FUNDS - Insufficient funds available to cover the bet action. Either the exposure limit or available to bet limit would be exceeded
19
+ # INVALID_PERSISTENCE_TYPE - Invalid persistence type for this market, e.g. KEEP for a non bsp market
20
+ # ERROR_IN_MATCHER - A problem with the matcher prevented this action completing successfully
21
+ # INVALID_BACK_LAY_COMBINATION - The order contains a back and a lay for the same runner at overlapping prices. This would guarantee a self match. This also applies to BSP limit on close bets
22
+ # ERROR_IN_ORDER - The action failed because the parent order failed
23
+ # INVALID_BID_TYPE - Bid type is mandatory
24
+ # INVALID_BET_ID - Bet for id supplied has not been found
25
+ # CANCELLED_NOT_PLACED - Bet cancelled but replacement bet was not placed
26
+ # RELATED_ACTION_FAILED - Action failed due to the failure of a action on which this action is dependent
27
+ # NO_ACTION_REQUIRED - the action does not result in any state change. eg changing a persistence to it's current value
4
28
  class InstructionReportErrorCode
5
29
  extend Api::Enums::Concerns::Enumable
6
30
 
@@ -28,4 +52,4 @@ module BetfairApiNgRails
28
52
  end
29
53
  end
30
54
  end
31
- end
55
+ end
@@ -1,6 +1,13 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # Indicates whether the command succeeded or failed
6
+ #
7
+ # Includes:
8
+ # SUCCESS
9
+ # FAILURE
10
+ # TIMEOUT
4
11
  class InstructionReportStatus
5
12
  extend Api::Enums::Concerns::Enumable
6
13
 
@@ -11,4 +18,4 @@ module BetfairApiNgRails
11
18
  end
12
19
  end
13
20
  end
14
- end
21
+ end
@@ -0,0 +1,19 @@
1
+ module BetfairApiNgRails
2
+ module Api
3
+ module Enums
4
+ # Class of statement item
5
+ #
6
+ # Includes:
7
+ # UNKNOWN - Statement item not mapped to a specific class.
8
+ #
9
+ class ItemClass
10
+ extend Api::Enums::Concerns::Enumable
11
+
12
+ enumify "UNKNOWN"
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+
19
+
@@ -1,6 +1,12 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # Either EXECUTABLE (an unmatched amount remains) or EXECUTION_COMPLETE (no unmatched amount remains).
6
+ #
7
+ # Includes:
8
+ # EXECUTION_COMPLETE - An order that does not have any remaining unmatched portion.
9
+ # EXECUTABLE - An order that has a remaining unmatched portion.
4
10
  class OrderStatus
5
11
  extend Api::Enums::Concerns::Enumable
6
12
 
@@ -10,4 +16,4 @@ module BetfairApiNgRails
10
16
  end
11
17
  end
12
18
  end
13
- end
19
+ end
@@ -1,14 +1,23 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # The type of bet (e.g standard limited-liability Exchange bet (LIMIT), a standard BSP bet (MARKET_ON_CLOSE), or
6
+ # a minimum-accepted-price BSP bet (LIMIT_ON_CLOSE)). If the bet has a OrderType of MARKET_ON_CLOSE and
7
+ # a persistenceType of MARKET_ON_CLOSE then it is a bet which has transitioned from LIMIT to MARKET_ON_CLOSE.
8
+ # Only available at BET groupBy level
9
+ #
10
+ # Includes:
11
+ # LIMIT - A normal exchange limit order for immediate execution
12
+ # LIMIT_ON_CLOSE - Limit order for the auction (SP)
13
+ # MARKET_ON_CLOSE - Market order for the auction (SP)
4
14
  class OrderType
5
15
  extend Api::Enums::Concerns::Enumable
6
16
 
7
17
  enumify "LIMIT",
8
18
  "LIMIT_ON_CLOSE",
9
19
  "MARKET_ON_CLOSE"
10
-
11
20
  end
12
21
  end
13
22
  end
14
- end
23
+ end
@@ -1,6 +1,13 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # The turn in play persistence state of the order at bet placement time.
6
+ #
7
+ # Includes:
8
+ # LAPSE - Lapse the order when the market is turned in-play
9
+ # PERSIST - Persist the order to in-play. The bet will be place automatically into the in-play market at the start of the event.
10
+ # MARKET_ON_CLOSE - Put the order into the auction (SP) at turn-in-play
4
11
  class PersistenceType
5
12
  extend Api::Enums::Concerns::Enumable
6
13
 
@@ -11,4 +18,4 @@ module BetfairApiNgRails
11
18
  end
12
19
  end
13
20
  end
14
- end
21
+ end
@@ -1,13 +1,18 @@
1
1
  module BetfairApiNgRails
2
2
  module Api
3
3
  module Enums
4
+ #
5
+ # Indicates if the bet is a Back or a LAY
6
+ #
7
+ # Includes:
8
+ # BACK - To back a team, horse or outcome is to bet on the selection to win.
9
+ # LAY - To lay a team, horse, or outcome is to bet on the selection to lose.
4
10
  class Side
5
11
  extend Api::Enums::Concerns::Enumable
6
12
 
7
13
  enumify "BACK",
8
14
  "LAY"
9
-
10
15
  end
11
16
  end
12
17
  end
13
- end
18
+ end