sports-butler 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/lib/sports/butler/api.rb +91 -0
- data/lib/sports/butler/api_base.rb +19 -0
- data/lib/sports/butler/base.rb +137 -0
- data/lib/sports/butler/basketball.rb +26 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/competitions.rb +19 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/countries.rb +19 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/matches.rb +13 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/odds.rb +17 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/seasons.rb +13 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/standings.rb +12 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/statistics.rb +12 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/teams.rb +20 -0
- data/lib/sports/butler/basketball_api/api_basketball_com/timezones.rb +13 -0
- data/lib/sports/butler/basketball_api/base.rb +14 -0
- data/lib/sports/butler/basketball_api/competitions.rb +11 -0
- data/lib/sports/butler/basketball_api/countries.rb +14 -0
- data/lib/sports/butler/basketball_api/matches.rb +18 -0
- data/lib/sports/butler/basketball_api/odds.rb +18 -0
- data/lib/sports/butler/basketball_api/seasons.rb +18 -0
- data/lib/sports/butler/basketball_api/standings.rb +18 -0
- data/lib/sports/butler/basketball_api/statistics.rb +18 -0
- data/lib/sports/butler/basketball_api/teams.rb +18 -0
- data/lib/sports/butler/basketball_api/timezones.rb +18 -0
- data/lib/sports/butler/configuration.rb +103 -0
- data/lib/sports/butler/endpoints.rb +58 -0
- data/lib/sports/butler/shared/all_sports.rb +175 -0
- data/lib/sports/butler/shared/api_coms.rb +24 -0
- data/lib/sports/butler/soccer.rb +36 -0
- data/lib/sports/butler/soccer_api/api_football_com/coachs.rb +12 -0
- data/lib/sports/butler/soccer_api/api_football_com/competitions.rb +24 -0
- data/lib/sports/butler/soccer_api/api_football_com/countries.rb +17 -0
- data/lib/sports/butler/soccer_api/api_football_com/head_to_head.rb +23 -0
- data/lib/sports/butler/soccer_api/api_football_com/injuries.rb +12 -0
- data/lib/sports/butler/soccer_api/api_football_com/lineups.rb +19 -0
- data/lib/sports/butler/soccer_api/api_football_com/matches.rb +19 -0
- data/lib/sports/butler/soccer_api/api_football_com/odds.rb +19 -0
- data/lib/sports/butler/soccer_api/api_football_com/players.rb +21 -0
- data/lib/sports/butler/soccer_api/api_football_com/predictions.rb +12 -0
- data/lib/sports/butler/soccer_api/api_football_com/scorers.rb +19 -0
- data/lib/sports/butler/soccer_api/api_football_com/sidelineds.rb +13 -0
- data/lib/sports/butler/soccer_api/api_football_com/standings.rb +15 -0
- data/lib/sports/butler/soccer_api/api_football_com/statistics.rb +19 -0
- data/lib/sports/butler/soccer_api/api_football_com/teams.rb +19 -0
- data/lib/sports/butler/soccer_api/api_football_com/timezones.rb +13 -0
- data/lib/sports/butler/soccer_api/api_football_com/transfers.rb +14 -0
- data/lib/sports/butler/soccer_api/api_football_com/trophies.rb +12 -0
- data/lib/sports/butler/soccer_api/api_football_com/venues.rb +12 -0
- data/lib/sports/butler/soccer_api/apifootball_com/competitions.rb +25 -0
- data/lib/sports/butler/soccer_api/apifootball_com/countries.rb +25 -0
- data/lib/sports/butler/soccer_api/apifootball_com/head_to_head.rb +27 -0
- data/lib/sports/butler/soccer_api/apifootball_com/lineups.rb +19 -0
- data/lib/sports/butler/soccer_api/apifootball_com/matches.rb +39 -0
- data/lib/sports/butler/soccer_api/apifootball_com/odds.rb +24 -0
- data/lib/sports/butler/soccer_api/apifootball_com/players.rb +33 -0
- data/lib/sports/butler/soccer_api/apifootball_com/predictions.rb +19 -0
- data/lib/sports/butler/soccer_api/apifootball_com/scorers.rb +27 -0
- data/lib/sports/butler/soccer_api/apifootball_com/standings.rb +24 -0
- data/lib/sports/butler/soccer_api/apifootball_com/statistics.rb +23 -0
- data/lib/sports/butler/soccer_api/apifootball_com/teams.rb +27 -0
- data/lib/sports/butler/soccer_api/base.rb +22 -0
- data/lib/sports/butler/soccer_api/coachs.rb +18 -0
- data/lib/sports/butler/soccer_api/competitions.rb +14 -0
- data/lib/sports/butler/soccer_api/countries.rb +14 -0
- data/lib/sports/butler/soccer_api/football_data_org/base.rb +20 -0
- data/lib/sports/butler/soccer_api/football_data_org/competitions.rb +22 -0
- data/lib/sports/butler/soccer_api/football_data_org/countries.rb +43 -0
- data/lib/sports/butler/soccer_api/football_data_org/head_to_head.rb +28 -0
- data/lib/sports/butler/soccer_api/football_data_org/lineups.rb +32 -0
- data/lib/sports/butler/soccer_api/football_data_org/matches.rb +58 -0
- data/lib/sports/butler/soccer_api/football_data_org/odds.rb +26 -0
- data/lib/sports/butler/soccer_api/football_data_org/players.rb +23 -0
- data/lib/sports/butler/soccer_api/football_data_org/scorers.rb +20 -0
- data/lib/sports/butler/soccer_api/football_data_org/standings.rb +16 -0
- data/lib/sports/butler/soccer_api/football_data_org/teams.rb +19 -0
- data/lib/sports/butler/soccer_api/head_to_head.rb +14 -0
- data/lib/sports/butler/soccer_api/injuries.rb +18 -0
- data/lib/sports/butler/soccer_api/lineups.rb +18 -0
- data/lib/sports/butler/soccer_api/matches.rb +14 -0
- data/lib/sports/butler/soccer_api/odds.rb +18 -0
- data/lib/sports/butler/soccer_api/players.rb +14 -0
- data/lib/sports/butler/soccer_api/predictions.rb +18 -0
- data/lib/sports/butler/soccer_api/scorers.rb +14 -0
- data/lib/sports/butler/soccer_api/sidelineds.rb +18 -0
- data/lib/sports/butler/soccer_api/standings.rb +18 -0
- data/lib/sports/butler/soccer_api/statistics.rb +14 -0
- data/lib/sports/butler/soccer_api/teams.rb +18 -0
- data/lib/sports/butler/soccer_api/timezones.rb +18 -0
- data/lib/sports/butler/soccer_api/transfers.rb +18 -0
- data/lib/sports/butler/soccer_api/trophies.rb +18 -0
- data/lib/sports/butler/soccer_api/venues.rb +18 -0
- data/lib/sports/butler/utility.rb +96 -0
- data/lib/sports/butler/version.rb +18 -0
- data/lib/sports/butler.rb +48 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b3e17fd5165580e881b932d07db6bf3397ae625b352585258446706001942524
|
4
|
+
data.tar.gz: 5103324841fbb476f0be686a7270830c3e9235baae94315c1ac356d21f9a194f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ba8a193569f349de76c0ae0105a3b023b7d04f8b3b07e49362c3e02bf5a3d02df06217db10e25be7f85954cf9c9e6e515cd605c07c397c597eb56a3c3bb5969
|
7
|
+
data.tar.gz: 054a5aa66ba39f7020b5af5c9e2e1a7b01f72234a8acd44d876929269f5edd0b73040972f20e7ecc3d5337ccb710059227d8b7a895726af74afb3da113d86c1f
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Joerg Kirschstein
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'httparty'
|
3
|
+
require 'sports/butler/api_base'
|
4
|
+
|
5
|
+
module Sports
|
6
|
+
module Butler
|
7
|
+
class Api < ApiBase
|
8
|
+
|
9
|
+
attr_accessor :response, :parsed_response, :success, :errors, :response_code,
|
10
|
+
:sport, :api_name, :url, :headers, :query, :uri
|
11
|
+
|
12
|
+
def initialize(sport, api_name)
|
13
|
+
@sport = sport
|
14
|
+
@api_name = api_name
|
15
|
+
|
16
|
+
@response = nil
|
17
|
+
@success = false
|
18
|
+
@errors = []
|
19
|
+
|
20
|
+
@response_code = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(path:, filters: {})
|
24
|
+
if Configuration.invalid_config?(sport, api_name)
|
25
|
+
@response = Sports::Butler::ApiBase.invalid_config_result
|
26
|
+
@response_code = 400
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
|
30
|
+
@response = process_http_party(path, filters)
|
31
|
+
@response_code = response.code
|
32
|
+
@success = true if response_code == 200
|
33
|
+
@parsed_response = process_response(response)
|
34
|
+
@uri = response.request.last_uri&.to_s
|
35
|
+
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
39
|
+
def process_http_party(path, filters)
|
40
|
+
@headers = Configuration.http_party_headers(sport, api_name)
|
41
|
+
@url = Configuration.http_party_url(path, sport, api_name)
|
42
|
+
@query = filters || {}
|
43
|
+
|
44
|
+
http_party_get
|
45
|
+
end
|
46
|
+
|
47
|
+
def process_response(response)
|
48
|
+
if response.parsed_response.is_a?(Hash) && response.dig('message')
|
49
|
+
error_message(response['message'])
|
50
|
+
else
|
51
|
+
response.parsed_response
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def error_message(error)
|
56
|
+
{ message: error }.with_indifferent_access
|
57
|
+
end
|
58
|
+
|
59
|
+
def http_party_get
|
60
|
+
HTTParty.get(
|
61
|
+
"#{url}",
|
62
|
+
headers: headers,
|
63
|
+
query: query,
|
64
|
+
format: :json
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# direct calls
|
69
|
+
class << self
|
70
|
+
def get(url:, sport: nil, api_name: nil, filters: {}, headers: {})
|
71
|
+
|
72
|
+
if sport && api_name
|
73
|
+
if Configuration.invalid_config?(sport, api_name)
|
74
|
+
return Sports::Butler::ApiBase.invalid_config_result
|
75
|
+
end
|
76
|
+
|
77
|
+
headers = Configuration.http_party_headers(sport, api_name)
|
78
|
+
url = Configuration.http_party_url_suffix(url, sport, api_name)
|
79
|
+
end
|
80
|
+
|
81
|
+
query = filters || {}
|
82
|
+
|
83
|
+
HTTParty.get "#{url}",
|
84
|
+
headers: headers,
|
85
|
+
query: query,
|
86
|
+
format: :json
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sports
|
4
|
+
module Butler
|
5
|
+
class ApiBase
|
6
|
+
MSG_INVALID_CONFIG = 'Invalid Configuration, check empty api_token or empty / invalid api_base_url.'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def invalid_config_result
|
10
|
+
error_message(MSG_INVALID_CONFIG)
|
11
|
+
end
|
12
|
+
|
13
|
+
def error_message(error)
|
14
|
+
{ message: error }.with_indifferent_access
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
## SOCCER
|
4
|
+
Dir.glob(File.expand_path("../soccer_api/*.rb", __FILE__)).each do |file|
|
5
|
+
require file
|
6
|
+
end
|
7
|
+
|
8
|
+
# api_football_com
|
9
|
+
Dir.glob(File.expand_path("../soccer_api/api_football_com/*.rb", __FILE__)).each do |file|
|
10
|
+
require file
|
11
|
+
end
|
12
|
+
|
13
|
+
# football_data_org
|
14
|
+
Dir.glob(File.expand_path("../soccer_api/football_data_org/*.rb", __FILE__)).each do |file|
|
15
|
+
require file
|
16
|
+
end
|
17
|
+
|
18
|
+
# apifootball_com
|
19
|
+
Dir.glob(File.expand_path("../soccer_api/apifootball_com/*.rb", __FILE__)).each do |file|
|
20
|
+
require file
|
21
|
+
end
|
22
|
+
|
23
|
+
## BASKETBALL
|
24
|
+
Dir.glob(File.expand_path("../basketball_api/*.rb", __FILE__)).each do |file|
|
25
|
+
require file
|
26
|
+
end
|
27
|
+
|
28
|
+
# api_basketball_com
|
29
|
+
Dir.glob(File.expand_path("../basketball_api/api_basketball_com/*.rb", __FILE__)).each do |file|
|
30
|
+
require file
|
31
|
+
end
|
32
|
+
|
33
|
+
module Sports
|
34
|
+
module Butler
|
35
|
+
class Base
|
36
|
+
|
37
|
+
ALIASES = {
|
38
|
+
areas: :countries,
|
39
|
+
leagues: :competitions,
|
40
|
+
events: :matches,
|
41
|
+
fixtures: :matches,
|
42
|
+
top_scorers: :scorers
|
43
|
+
}
|
44
|
+
|
45
|
+
AVAILABLE_ENDPOINTS = {}
|
46
|
+
AVAILABLE_ENDPOINTS = {
|
47
|
+
soccer: {},
|
48
|
+
basketball: {}
|
49
|
+
}
|
50
|
+
|
51
|
+
AVAILABLE_ENDPOINTS[:soccer][:api_football_com] = Dir.
|
52
|
+
glob(File.expand_path("../soccer_api/api_football_com/*.rb", __FILE__))
|
53
|
+
AVAILABLE_ENDPOINTS[:soccer][:apifootball_com] = Dir.
|
54
|
+
glob(File.expand_path("../soccer_api/apifootball_com/*.rb", __FILE__))
|
55
|
+
AVAILABLE_ENDPOINTS[:soccer][:football_data_org] = Dir.
|
56
|
+
glob(File.expand_path("../soccer_api/football_data_org/*.rb", __FILE__))
|
57
|
+
|
58
|
+
AVAILABLE_ENDPOINTS[:basketball][:api_basketball_com] = Dir.
|
59
|
+
glob(File.expand_path("../basketball_api/api_basketball_com/*.rb", __FILE__))
|
60
|
+
|
61
|
+
attr_accessor :sport, :api_name, :api_class, :sport_class,
|
62
|
+
:endpoints, :available_endpoints, :valid_configuration
|
63
|
+
|
64
|
+
def initialize(sport:, api_name:)
|
65
|
+
@sport = sport
|
66
|
+
@api_name = api_name
|
67
|
+
@api_class = api_name.to_s.camelize
|
68
|
+
@sport_class = "#{sport.to_s.camelize}Api"
|
69
|
+
|
70
|
+
@endpoints = {}
|
71
|
+
|
72
|
+
@available_endpoints = get_available_endpoints
|
73
|
+
@valid_configuration = !Configuration.invalid_config?(sport, api_name)
|
74
|
+
end
|
75
|
+
|
76
|
+
def method_missing(method, *args, &block)
|
77
|
+
endpoint_name = eval_endpoint_name(method)
|
78
|
+
if endpoint_name.present?
|
79
|
+
@endpoints[method].present? ?
|
80
|
+
@endpoints[method] : @endpoints[method] = build_endpoint_classes(endpoint_name)
|
81
|
+
else
|
82
|
+
raise MissingEndpoint, endpoint_not_available(method)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def get_available_endpoints
|
89
|
+
result = {}.with_indifferent_access
|
90
|
+
|
91
|
+
AVAILABLE_ENDPOINTS[sport][api_name].each do |path|
|
92
|
+
next if File.basename(path, ".*") == 'base'
|
93
|
+
|
94
|
+
endpoint = File.basename(path, ".*")
|
95
|
+
endpoint_methods = self.send(endpoint).available_endpoint_methods
|
96
|
+
|
97
|
+
result_endpoints = {}.with_indifferent_access
|
98
|
+
endpoint_methods.each do |endpoint_method|
|
99
|
+
result_endpoints[endpoint_method] = self.send(endpoint).method(endpoint_method).parameters
|
100
|
+
end
|
101
|
+
|
102
|
+
result[endpoint] = result_endpoints
|
103
|
+
end
|
104
|
+
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
def eval_endpoint_name(endpoint_name)
|
109
|
+
endpoint = ALIASES[endpoint_name].present? ? ALIASES[endpoint_name] : endpoint_name
|
110
|
+
Kernel.const_defined?( "#{scope}::#{endpoint.to_s.camelize}") ? endpoint.to_s.camelize : nil
|
111
|
+
end
|
112
|
+
|
113
|
+
def scope
|
114
|
+
"Sports::Butler::#{sport_class}::#{api_class}"
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_api_object
|
118
|
+
Api.new(sport, api_name)
|
119
|
+
end
|
120
|
+
|
121
|
+
def build_endpoint_classes(name)
|
122
|
+
"#{scope}::#{name}".constantize.new(sport: sport, api_name: api_name, api: build_api_object)
|
123
|
+
end
|
124
|
+
|
125
|
+
def endpoint_not_available(name)
|
126
|
+
"NOT AVAILABLE: the endpoint '#{name}' is not available for this sport/api combination."
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
class MissingEndpoint < StandardError
|
132
|
+
def initialize(msg)
|
133
|
+
super
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
class Basketball < Sports::Butler::Base
|
7
|
+
|
8
|
+
ENDPOINTS = [
|
9
|
+
:countries,
|
10
|
+
:competitions,
|
11
|
+
:matches,
|
12
|
+
:odds,
|
13
|
+
:seasons,
|
14
|
+
:standings,
|
15
|
+
:statistics,
|
16
|
+
:teams,
|
17
|
+
:timezones
|
18
|
+
]
|
19
|
+
|
20
|
+
def initialize(sport:, api_name:)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sports
|
4
|
+
module Butler
|
5
|
+
module BasketballApi
|
6
|
+
module ApiBasketballCom
|
7
|
+
class Competitions < Sports::Butler::BasketballApi::Competitions
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:all, :by_id, :by_name, :by_country_name, :by_country, :cups, :leagues, :by_season]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:leagues
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sports
|
4
|
+
module Butler
|
5
|
+
module BasketballApi
|
6
|
+
module ApiBasketballCom
|
7
|
+
class Countries < Sports::Butler::BasketballApi::Countries
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:all, :by_name, :by_id, :by_code, :search_by_name]
|
10
|
+
end
|
11
|
+
|
12
|
+
def filters_search_by_name(name)
|
13
|
+
{ search: name }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sports
|
4
|
+
module Butler
|
5
|
+
module BasketballApi
|
6
|
+
module ApiBasketballCom
|
7
|
+
class Odds < Sports::Butler::BasketballApi::Odds
|
8
|
+
|
9
|
+
def filters_by_match(id)
|
10
|
+
{ game: id }
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sports
|
4
|
+
module Butler
|
5
|
+
module BasketballApi
|
6
|
+
module ApiBasketballCom
|
7
|
+
class Teams < Sports::Butler::BasketballApi::Teams
|
8
|
+
|
9
|
+
def filters_search_by_name(name)
|
10
|
+
{ search: name }
|
11
|
+
end
|
12
|
+
|
13
|
+
def filters_by_competition(id)
|
14
|
+
{ league: id }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "sports/butler/endpoints"
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Base < Sports::Butler::Endpoints
|
8
|
+
def method_missing(method, *args, &block)
|
9
|
+
return error_missing_endpoint_method(method)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Matches < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:by_id, :by_competition_and_year, :all]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:games
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Odds < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:by_match]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:odds
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Seasons < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:all]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:seasons
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Standings < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:by_competition_and_team_and_season]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:standings
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Statistics < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:by_competition_and_team_and_season]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:statistics
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Teams < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:by_id, :by_name, :by_competition, :by_season, :search_by_name ]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:teams
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'sports/butler/basketball_api/base'
|
3
|
+
|
4
|
+
module Sports
|
5
|
+
module Butler
|
6
|
+
module BasketballApi
|
7
|
+
class Timezones < Sports::Butler::BasketballApi::Base
|
8
|
+
def available_endpoint_methods
|
9
|
+
[:all]
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
:timezones
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|