betfair_api_ng_rails 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -10
- data/lib/betfair_api_ng_rails/api/base_provider.rb +1 -11
- data/lib/betfair_api_ng_rails/api/bf/config.rb +1 -2
- data/lib/betfair_api_ng_rails/api/bf/constants.rb +14 -4
- data/lib/betfair_api_ng_rails/api/bf/data/attributes.rb +52 -0
- data/lib/betfair_api_ng_rails/api/bf/data/base.rb +17 -0
- data/lib/betfair_api_ng_rails/api/bf/data/competition.rb +26 -0
- data/lib/betfair_api_ng_rails/api/bf/data/competition_result.rb +23 -0
- data/lib/betfair_api_ng_rails/api/bf/data/concerns/hashable.rb +40 -0
- data/lib/betfair_api_ng_rails/api/bf/data/concerns/querable.rb +46 -0
- data/lib/betfair_api_ng_rails/api/bf/data/constants.rb +13 -0
- data/lib/betfair_api_ng_rails/api/bf/data/event.rb +26 -0
- data/lib/betfair_api_ng_rails/api/bf/data/event_result.rb +21 -0
- data/lib/betfair_api_ng_rails/api/bf/data/event_type.rb +26 -0
- data/lib/betfair_api_ng_rails/api/bf/data/event_type_result.rb +21 -0
- data/lib/betfair_api_ng_rails/api/bf/data/market_filter.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/data/time_range.rb +18 -0
- data/lib/betfair_api_ng_rails/api/bf/data/time_range_result.rb +21 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/bet_status.rb +17 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/concerns/enumable.rb +17 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/execution_report_error_code.rb +30 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/execution_report_status.rb +17 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/group_by.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/instruction_report_error_code.rb +33 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/instruction_report_status.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/market_betting_type.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/market_projection.rb +20 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/market_sort.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/market_status.rb +17 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/match_projection.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/order_by.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/order_projection.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/order_status.rb +15 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/order_type.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/persistence_type.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/price_data.rb +18 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/rollup_model.rb +17 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/runner_status.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/side.rb +15 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/sort_dir.rb +15 -0
- data/lib/betfair_api_ng_rails/api/bf/enums/time_granularity.rb +16 -0
- data/lib/betfair_api_ng_rails/api/bf/formatters/js_tree_formatter.rb +7 -11
- data/lib/betfair_api_ng_rails/api/bf/helper.rb +33 -0
- data/lib/betfair_api_ng_rails/api/bf/http/factory.rb +37 -0
- data/lib/betfair_api_ng_rails/api/bf/http/requester.rb +69 -0
- data/lib/betfair_api_ng_rails/api/bf/http/responser.rb +58 -0
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/base.rb +33 -0
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/list_competitions.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/list_event_types.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/orm/parsers/list_events.rb +19 -0
- data/lib/betfair_api_ng_rails/api/bf/orm/requester.rb +52 -0
- data/lib/betfair_api_ng_rails/api/bf/provider.rb +11 -28
- data/lib/betfair_api_ng_rails/api/bf/session_manager.rb +26 -37
- data/lib/betfair_api_ng_rails/version.rb +1 -1
- data/lib/betfair_api_ng_rails.rb +80 -9
- data/lib/generators/betfair_api_ng_rails/install/templates/betfair_api_ng_rails.rb +2 -3
- metadata +48 -9
- data/lib/betfair_api_ng_rails/api/base_formatter.rb +0 -11
- data/lib/betfair_api_ng_rails/api/base_parser.rb +0 -25
- data/lib/betfair_api_ng_rails/api/base_requester.rb +0 -25
- data/lib/betfair_api_ng_rails/api/bf/http_requester.rb +0 -73
- data/lib/betfair_api_ng_rails/api/bf/http_responser.rb +0 -44
- data/lib/betfair_api_ng_rails/api/bf/parser.rb +0 -31
- data/lib/betfair_api_ng_rails/api/soccer/requester.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7f63ee0737110869e21a922b12a4aa99850019
|
4
|
+
data.tar.gz: bed144ea5a16997275538b8fd88b1566413e6b64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b7d9ab358b32912b1fe5e4a1bf2b56a8cd731f976a1e82268c0ca843dc03bda4aa94ec2da6e65edd34382b39c62ac60c8bb073bfd0b96ebde826f63c0a64d4
|
7
|
+
data.tar.gz: b437d15bea1d28fc5cbce55c6ad5bb8b1274249382d4f3b8a0ab38e0db0140534c14c2bae652497c98ec40c0f17deb163891736c7e2843382a0b5209bb373d9f
|
data/README.md
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
|
3
3
|
API-NG is Betfair's next generation API for developers looking to create automated betting systems or custom interfaces for themselves or for Betfair customers. Using this gem you may do calls to API-NG for fetching some interesting information about competitions, events and markets.
|
4
4
|
|
5
|
-
## WARNING!!!
|
6
|
-
|
7
|
-
__Last version of gem supports only list* requests.__
|
8
|
-
|
9
5
|
## Installation
|
10
6
|
|
11
7
|
Add this line to your application's Gemfile:
|
@@ -39,22 +35,44 @@ In this files you must specify credentials to API-NG. Also you should notice tha
|
|
39
35
|
|
40
36
|
## Usage
|
41
37
|
|
42
|
-
Sample code for fetching competitions
|
38
|
+
Sample code for fetching all competitions:
|
43
39
|
|
44
40
|
```ruby
|
45
|
-
|
46
|
-
res = requester.load resource: :competitions
|
41
|
+
result = BetfairApiNgRails::Competition.all
|
47
42
|
```
|
48
43
|
|
49
44
|
For all available methods see [there](https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3lu3yomq5qye0ni/Betting+Operations).
|
50
45
|
|
51
|
-
Also you may passing
|
46
|
+
Also you may passing filtering params:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
filter = BetfairApiNgRails::MarketFilter.new text_query: 'World*'
|
50
|
+
result = BetfairApiNgRails::Competition.where filter: filter
|
51
|
+
```
|
52
|
+
|
53
|
+
Or fetching competition by identifier:
|
52
54
|
|
53
55
|
```ruby
|
54
|
-
|
55
|
-
res = requester.load resource: :competitions, parameters: { event_ids: [1, 2] }
|
56
|
+
result = BetfairApiNgRails::Competition.find 1
|
56
57
|
```
|
57
58
|
|
59
|
+
## CHANGES IN 0.0.8
|
60
|
+
|
61
|
+
1. Fixing more of bugs
|
62
|
+
2. Came back formatters and out-of-box exists formatter for JsTree
|
63
|
+
3. Added all enums
|
64
|
+
4. Added shortcuts for models
|
65
|
+
5. Refactoring
|
66
|
+
|
67
|
+
## CHANGES IN 0.0.7!!!
|
68
|
+
|
69
|
+
Now gem used Object model for doing requests and it's results that is based on [betfair's type definitions](https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3lu3yomq5qye0ni/Betting+Type+Definitions#BettingTypeDefinitions-UpdateInstruction).
|
70
|
+
|
71
|
+
## WARNING!!!
|
72
|
+
|
73
|
+
__Last version of gem supports only listCompetitions, listEventTypes and listEvents requests.__ I will provide more powerful functional soon.
|
74
|
+
|
75
|
+
|
58
76
|
## Contributing
|
59
77
|
|
60
78
|
1. Fork it
|
@@ -6,20 +6,10 @@ module BetfairApiNgRails
|
|
6
6
|
|
7
7
|
attr_reader :provider_name
|
8
8
|
|
9
|
-
def fetch(
|
9
|
+
def fetch(method: "", filter: {}, params: {})
|
10
10
|
raise "Must be reimplemented!"
|
11
11
|
end
|
12
12
|
|
13
|
-
private
|
14
|
-
|
15
|
-
def build_function(method)
|
16
|
-
"list#{method.to_s.camelize}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def build_parser(data)
|
20
|
-
"BetfairApiNgRails::Api::#{provider_name}::Parser".constantize.new data.to_s.singularize
|
21
|
-
end
|
22
|
-
|
23
13
|
end
|
24
14
|
end
|
25
15
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'betfair_api_ng_rails/api/bf/formatters/js_tree_formatter'
|
2
|
-
|
3
1
|
module BetfairApiNgRails
|
4
2
|
module Api
|
5
3
|
module BF
|
@@ -14,6 +12,7 @@ module BetfairApiNgRails
|
|
14
12
|
:api_url,
|
15
13
|
:username,
|
16
14
|
:password,
|
15
|
+
:locale,
|
17
16
|
:formatter
|
18
17
|
|
19
18
|
def formatter=(value)
|
@@ -16,10 +16,20 @@ module BetfairApiNgRails
|
|
16
16
|
"Accept" => "application/json"
|
17
17
|
}
|
18
18
|
|
19
|
-
ALLOWED_RESOURCES =
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
ALLOWED_RESOURCES = [
|
20
|
+
"listEventTypes",
|
21
|
+
"listCompetitions",
|
22
|
+
"listTimeRanges",
|
23
|
+
"listEvents",
|
24
|
+
"listMarketTypes",
|
25
|
+
"listCountries",
|
26
|
+
"listVenues",
|
27
|
+
"listMarketCatalogue",
|
28
|
+
"listMarketBook",
|
29
|
+
"listCurrentOrders",
|
30
|
+
"listClearedOrders",
|
31
|
+
"listMarketProfitAndLoss"
|
32
|
+
]
|
23
33
|
|
24
34
|
end
|
25
35
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
module Attributes
|
6
|
+
|
7
|
+
MARKET_FILTER_ATTRS = [
|
8
|
+
:text_query,
|
9
|
+
:exchange_ids,
|
10
|
+
:event_type_ids,
|
11
|
+
:event_ids,
|
12
|
+
:competition_ids,
|
13
|
+
:venues,
|
14
|
+
:bsp_only,
|
15
|
+
:turn_in_play_enabled,
|
16
|
+
:in_play_only,
|
17
|
+
:market_betting_types,
|
18
|
+
:market_countries,
|
19
|
+
:market_type_codes,
|
20
|
+
:market_start_time,
|
21
|
+
:with_orders
|
22
|
+
]
|
23
|
+
|
24
|
+
COMPETITION_ATTRS = [
|
25
|
+
:id,
|
26
|
+
:name
|
27
|
+
]
|
28
|
+
|
29
|
+
EVENT_TYPE_ATTRS = [
|
30
|
+
:id,
|
31
|
+
:name
|
32
|
+
]
|
33
|
+
|
34
|
+
EVENT_ATTRS = [
|
35
|
+
:id,
|
36
|
+
:name,
|
37
|
+
:timezone,
|
38
|
+
:country_code,
|
39
|
+
:venue,
|
40
|
+
:open_date
|
41
|
+
]
|
42
|
+
|
43
|
+
TIME_RANGE_ATTRS = [
|
44
|
+
:from,
|
45
|
+
:to
|
46
|
+
]
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
|
3
|
+
module BetfairApiNgRails
|
4
|
+
module Api
|
5
|
+
module BF
|
6
|
+
module Data
|
7
|
+
class Base
|
8
|
+
|
9
|
+
def initialize(args = {})
|
10
|
+
args.each { |attribute, value| self.send("#{attribute}=", value) }
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class Competition < Api::BF::Data::Base
|
6
|
+
include Api::BF::Data::Attributes
|
7
|
+
extend Api::BF::Data::Concerns::Querable
|
8
|
+
include Api::BF::Data::Concerns::Hashable
|
9
|
+
|
10
|
+
attr_accessor *COMPETITION_ATTRS
|
11
|
+
|
12
|
+
querable :competitions, :competition_ids
|
13
|
+
|
14
|
+
def self.from_json(json_row)
|
15
|
+
new COMPETITION_ATTRS.inject({}) { |h, a| h[a] = json_row[a.to_s.camelize(:lower)]; h }
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.to_hash_attrs
|
19
|
+
COMPETITION_ATTRS
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class CompetitionResult < Api::BF::Data::Base
|
6
|
+
|
7
|
+
attr_accessor :market_count,
|
8
|
+
:competition_region,
|
9
|
+
:competition
|
10
|
+
|
11
|
+
def self.from_json(json_row)
|
12
|
+
new(
|
13
|
+
competition: Api::BF::Data::Competition.from_json(json_row['competition']),
|
14
|
+
market_count: json_row['marketCount'],
|
15
|
+
competition_region: json_row['competitionRegion']
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
module Concerns
|
6
|
+
module Hashable
|
7
|
+
include BetfairApiNgRails::Api::BF::Data::Constants
|
8
|
+
|
9
|
+
def to_hash
|
10
|
+
self.class.to_hash_attrs.inject({}) do |h, attrib|
|
11
|
+
val = get_attr_value(attrib)
|
12
|
+
h[hash_key(attrib)] = hash_value(val) unless val.nil?
|
13
|
+
h
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def hash_value(val)
|
20
|
+
need_to_hash?(val) ? val.to_hash : val
|
21
|
+
end
|
22
|
+
|
23
|
+
def need_to_hash?(val)
|
24
|
+
!ATTRS_AS_IS.include?(val.class)
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_attr_value(attrib)
|
28
|
+
self.send attrib
|
29
|
+
end
|
30
|
+
|
31
|
+
def hash_key(attrib)
|
32
|
+
attrib.to_s.camelize(:lower)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
module Concerns
|
6
|
+
module Querable
|
7
|
+
|
8
|
+
def querable(resource, find_attr = false)
|
9
|
+
methods = <<-CODE
|
10
|
+
#{where_query_method(resource)}
|
11
|
+
#{all_query_method}
|
12
|
+
#{find_query_method(find_attr) if find_attr}
|
13
|
+
CODE
|
14
|
+
instance_eval(methods)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def where_query_method(resource)
|
20
|
+
<<-STR
|
21
|
+
def where(filter: Api::BF::Data::MarketFilter.new, params: {})
|
22
|
+
Api::BF::ORM::Requester.load resource: :#{resource}, filter: filter, params: params
|
23
|
+
end
|
24
|
+
STR
|
25
|
+
end
|
26
|
+
|
27
|
+
def all_query_method
|
28
|
+
<<-STR
|
29
|
+
def all; where; end;
|
30
|
+
STR
|
31
|
+
end
|
32
|
+
|
33
|
+
def find_query_method(find_attr)
|
34
|
+
<<-STR
|
35
|
+
def find(id)
|
36
|
+
where filter: Api::BF::Data::MarketFilter.new(#{find_attr}: [id])
|
37
|
+
end
|
38
|
+
STR
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class Event < Api::BF::Data::Base
|
6
|
+
include Api::BF::Data::Attributes
|
7
|
+
extend Api::BF::Data::Concerns::Querable
|
8
|
+
include Api::BF::Data::Concerns::Hashable
|
9
|
+
|
10
|
+
attr_accessor *EVENT_ATTRS
|
11
|
+
|
12
|
+
querable :events, :event_ids
|
13
|
+
|
14
|
+
def self.from_json(json_row)
|
15
|
+
new EVENT_ATTRS.inject({}) { |h, a| h[a] = json_row[a.to_s.camelize(:lower)]; h }
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.to_hash_attrs
|
19
|
+
EVENT_ATTRS
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class EventResult < Api::BF::Data::Base
|
6
|
+
|
7
|
+
attr_accessor :market_count,
|
8
|
+
:event
|
9
|
+
|
10
|
+
def self.from_json(json_row)
|
11
|
+
new(
|
12
|
+
event: Api::BF::Data::Event.from_json(json_row['event']),
|
13
|
+
market_count: json_row['marketCount']
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class EventType < Api::BF::Data::Base
|
6
|
+
include Api::BF::Data::Attributes
|
7
|
+
extend Api::BF::Data::Concerns::Querable
|
8
|
+
include Api::BF::Data::Concerns::Hashable
|
9
|
+
|
10
|
+
attr_accessor *EVENT_TYPE_ATTRS
|
11
|
+
|
12
|
+
querable :event_types, :event_type_ids
|
13
|
+
|
14
|
+
def self.from_json(json_row)
|
15
|
+
new EVENT_TYPE_ATTRS.inject({}) { |h, a| h[a] = json_row[a.to_s.camelize(:lower)]; h }
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.to_hash_attrs
|
19
|
+
EVENT_TYPE_ATTRS
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class EventTypeResult < Api::BF::Data::Base
|
6
|
+
|
7
|
+
attr_accessor :market_count,
|
8
|
+
:event_type
|
9
|
+
|
10
|
+
def self.from_json(json_row)
|
11
|
+
new(
|
12
|
+
event_type: Api::BF::Data::EventType.from_json(json_row['eventType']),
|
13
|
+
market_count: json_row['marketCount'],
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class MarketFilter < Api::BF::Data::Base
|
6
|
+
include Api::BF::Data::Attributes
|
7
|
+
include Api::BF::Data::Concerns::Hashable
|
8
|
+
|
9
|
+
attr_accessor *MARKET_FILTER_ATTRS
|
10
|
+
|
11
|
+
def self.to_hash_attrs
|
12
|
+
MARKET_FILTER_ATTRS
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class TimeRange < Api::BF::Data::Base
|
6
|
+
include Api::BF::Data::Attributes
|
7
|
+
|
8
|
+
attr_accessor *TIME_RANGE_ATTRS
|
9
|
+
|
10
|
+
def self.from_json(json_row)
|
11
|
+
new TIME_RANGE_ATTRS.inject({}) { |h, a| h[a] = json_row[a.to_s.camelize(:lower)]; h }
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Data
|
5
|
+
class TimeRangeResult < Api::BF::Data::Base
|
6
|
+
|
7
|
+
attr_accessor :time_range,
|
8
|
+
:market_count
|
9
|
+
|
10
|
+
def self.from_json(json_row)
|
11
|
+
new(
|
12
|
+
time_range: Api::BF::Data::TimeRange.from_json(json_row['timeRange']),
|
13
|
+
market_count: json_row['marketCount'],
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Enums
|
5
|
+
class ExecutionReportErrorCode
|
6
|
+
extend Api::BF::Enums::Concerns::Enumable
|
7
|
+
|
8
|
+
enumify "ERROR_IN_MATCHER",
|
9
|
+
"PROCESSED_WITH_ERRORS",
|
10
|
+
"BET_ACTION_ERROR",
|
11
|
+
"INVALID_ACCOUNT_STATE",
|
12
|
+
"INVALID_WALLET_STATUS",
|
13
|
+
"INSUFFICIENT_FUNDS",
|
14
|
+
"LOSS_LIMIT_EXCEEDED",
|
15
|
+
"MARKET_SUSPENDED",
|
16
|
+
"MARKET_NOT_OPEN_FOR_BETTING",
|
17
|
+
"DUPLICATE_TRANSACTION",
|
18
|
+
"INVALID_ORDER",
|
19
|
+
"INVALID_MARKET_ID",
|
20
|
+
"PERMISSION_DENIED",
|
21
|
+
"DUPLICATE_BETIDS",
|
22
|
+
"NO_ACTION_REQUIRED",
|
23
|
+
"SERVICE_UNAVAILABLE",
|
24
|
+
"REJECTED_BY_REGULATOR"
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Enums
|
5
|
+
class ExecutionReportStatus
|
6
|
+
extend Api::BF::Enums::Concerns::Enumable
|
7
|
+
|
8
|
+
enumify "SUCCESS",
|
9
|
+
"FAILURE",
|
10
|
+
"PROCESSED_WITH_ERRORS",
|
11
|
+
"TIMEOUT"
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Enums
|
5
|
+
class GroupBy
|
6
|
+
extend Api::BF::Enums::Concerns::Enumable
|
7
|
+
|
8
|
+
enumify "EVENT_TYPE",
|
9
|
+
"EVENT",
|
10
|
+
"MARKET",
|
11
|
+
"RUNNER",
|
12
|
+
"SIDE",
|
13
|
+
"BET"
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module BetfairApiNgRails
|
2
|
+
module Api
|
3
|
+
module BF
|
4
|
+
module Enums
|
5
|
+
class InstructionReportErrorCode
|
6
|
+
extend Api::BF::Enums::Concerns::Enumable
|
7
|
+
|
8
|
+
enumify "INVALID_BET_SIZE",
|
9
|
+
"INVALID_RUNNER",
|
10
|
+
"BET_TAKEN_OR_LAPSED",
|
11
|
+
"BET_IN_PROGRESS",
|
12
|
+
"RUNNER_REMOVED",
|
13
|
+
"MARKET_NOT_OPEN_FOR_BETTING",
|
14
|
+
"LOSS_LIMIT_EXCEEDED",
|
15
|
+
"MARKET_NOT_OPEN_FOR_BSP_BETTING",
|
16
|
+
"INVALID_PRICE_EDIT",
|
17
|
+
"INVALID_ODDS",
|
18
|
+
"INSUFFICIENT_FUNDS",
|
19
|
+
"INVALID_PERSISTENCE_TYPE",
|
20
|
+
"ERROR_IN_MATCHER",
|
21
|
+
"INVALID_BACK_LAY_COMBINATION",
|
22
|
+
"ERROR_IN_ORDER",
|
23
|
+
"INVALID_BID_TYPE",
|
24
|
+
"INVALID_BET_ID",
|
25
|
+
"CANCELLED_NOT_PLACED",
|
26
|
+
"RELATED_ACTION_FAILED",
|
27
|
+
"NO_ACTION_REQUIRED"
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|