Class: Football::Butler::Apifootball::Players

Inherits:
BaseApifootball show all
Defined in:
lib/football/butler/apifootball/players.rb

Constant Summary collapse

PATH =
:get_players

Constants inherited from Base

Base::MSG_INVALID_CONFIG

Class Method Summary collapse

Methods inherited from BaseApifootball

build_path

Methods inherited from Base

api_class, api_switch, api_switch_method, api_switch_result, error_message, invalid_config_result, not_found_result, reached_limit?, this_class, unsupported_api_call, unsupported_api_endpoint

Class Method Details

.by_id(id:) ⇒ Object

PLAYER action=get_players?player_id=id



13
14
15
16
# File 'lib/football/butler/apifootball/players.rb', line 13

def by_id(id:)
  filters = { player_id: id }
  Api.get(path: build_path(PATH), filters: filters, result: :parsed_response)
end

.by_name(name:, result:) ⇒ Object

action=get_players?name=name



19
20
21
22
# File 'lib/football/butler/apifootball/players.rb', line 19

def by_name(name:, result:)
  filters = { player_name: name }
  Api.get(path: build_path(PATH), filters: filters, result: result)
end