Class: Believe::Resources::Teams
- Inherits:
-
Object
- Object
- Believe::Resources::Teams
- Defined in:
- lib/believe/resources/teams.rb,
lib/believe/resources/teams/logo.rb
Overview
Operations related to football teams
Defined Under Namespace
Classes: Logo
Instance Attribute Summary collapse
-
#logo ⇒ ::Believe::Resources::Teams::Logo
readonly
Operations related to football teams.
Instance Method Summary collapse
-
#create(culture_score:, founded_year:, league:, name:, stadium:, values:, annual_budget_gbp: nil, average_attendance: nil, contact_email: nil, is_active: nil, nickname: nil, primary_color: nil, rival_teams: nil, secondary_color: nil, stadium_location: nil, website: nil, win_percentage: nil, request_options: {}) ⇒ ::Believe::Models::Team
Add a new team to the league.
-
#delete(team_id, request_options: {}) ⇒ nil
Remove a team from the database (relegation to oblivion).
-
#get_culture(team_id, request_options: {}) ⇒ Hash{Symbol=>Object}
Get detailed culture and values information for a team.
-
#get_rivals(team_id, request_options: {}) ⇒ Array<::Believe::Models::Team>
Get all rival teams for a specific team.
-
#initialize(client:) ⇒ Teams
constructor
private
A new instance of Teams.
-
#list(league: nil, limit: nil, min_culture_score: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Team>
Get a paginated list of all teams with optional filtering by league or culture score.
-
#list_logos(team_id, request_options: {}) ⇒ Array<::Believe::Models::Teams::FileUpload>
List all uploaded logos for a team.
-
#retrieve(team_id, request_options: {}) ⇒ ::Believe::Models::Team
Retrieve detailed information about a specific team.
-
#update(team_id, annual_budget_gbp: nil, average_attendance: nil, contact_email: nil, culture_score: nil, founded_year: nil, is_active: nil, league: nil, name: nil, nickname: nil, primary_color: nil, rival_teams: nil, secondary_color: nil, stadium: nil, stadium_location: nil, values: nil, website: nil, win_percentage: nil, request_options: {}) ⇒ ::Believe::Models::Team
Update specific fields of an existing team.
Constructor Details
#initialize(client:) ⇒ Teams
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Teams.
244 245 246 247 |
# File 'lib/believe/resources/teams.rb', line 244 def initialize(client:) @client = client @logo = ::Believe::Resources::Teams::Logo.new(client: client) end |
Instance Attribute Details
#logo ⇒ ::Believe::Resources::Teams::Logo (readonly)
Operations related to football teams
9 10 11 |
# File 'lib/believe/resources/teams.rb', line 9 def logo @logo end |
Instance Method Details
#create(culture_score:, founded_year:, league:, name:, stadium:, values:, annual_budget_gbp: nil, average_attendance: nil, contact_email: nil, is_active: nil, nickname: nil, primary_color: nil, rival_teams: nil, secondary_color: nil, stadium_location: nil, website: nil, win_percentage: nil, request_options: {}) ⇒ ::Believe::Models::Team
Add a new team to the league.
54 55 56 57 |
# File 'lib/believe/resources/teams.rb', line 54 def create(params) parsed, = ::Believe::TeamCreateParams.dump_request(params) @client.request(method: :post, path: "teams", body: parsed, model: ::Believe::Team, options: ) end |
#delete(team_id, request_options: {}) ⇒ nil
Remove a team from the database (relegation to oblivion).
175 176 177 178 179 180 181 182 |
# File 'lib/believe/resources/teams.rb', line 175 def delete(team_id, params = {}) @client.request( method: :delete, path: ["teams/%1$s", team_id], model: NilClass, options: params[:request_options] ) end |
#get_culture(team_id, request_options: {}) ⇒ Hash{Symbol=>Object}
Get detailed culture and values information for a team.
194 195 196 197 198 199 200 201 |
# File 'lib/believe/resources/teams.rb', line 194 def get_culture(team_id, params = {}) @client.request( method: :get, path: ["teams/%1$s/culture", team_id], model: ::Believe::Internal::Type::HashOf[::Believe::Internal::Type::Unknown], options: params[:request_options] ) end |
#get_rivals(team_id, request_options: {}) ⇒ Array<::Believe::Models::Team>
Get all rival teams for a specific team.
213 214 215 216 217 218 219 220 |
# File 'lib/believe/resources/teams.rb', line 213 def get_rivals(team_id, params = {}) @client.request( method: :get, path: ["teams/%1$s/rivals", team_id], model: ::Believe::Internal::Type::ArrayOf[::Believe::Team], options: params[:request_options] ) end |
#list(league: nil, limit: nil, min_culture_score: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Team>
Get a paginated list of all teams with optional filtering by league or culture score.
152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/believe/resources/teams.rb', line 152 def list(params = {}) parsed, = ::Believe::TeamListParams.dump_request(params) query = ::Believe::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "teams", query: query, page: ::Believe::Internal::SkipLimitPage, model: ::Believe::Team, options: ) end |
#list_logos(team_id, request_options: {}) ⇒ Array<::Believe::Models::Teams::FileUpload>
List all uploaded logos for a team.
232 233 234 235 236 237 238 239 |
# File 'lib/believe/resources/teams.rb', line 232 def list_logos(team_id, params = {}) @client.request( method: :get, path: ["teams/%1$s/logos", team_id], model: ::Believe::Internal::Type::ArrayOf[::Believe::Teams::FileUpload], options: params[:request_options] ) end |
#retrieve(team_id, request_options: {}) ⇒ ::Believe::Models::Team
Retrieve detailed information about a specific team.
69 70 71 72 73 74 75 76 |
# File 'lib/believe/resources/teams.rb', line 69 def retrieve(team_id, params = {}) @client.request( method: :get, path: ["teams/%1$s", team_id], model: ::Believe::Team, options: params[:request_options] ) end |
#update(team_id, annual_budget_gbp: nil, average_attendance: nil, contact_email: nil, culture_score: nil, founded_year: nil, is_active: nil, league: nil, name: nil, nickname: nil, primary_color: nil, rival_teams: nil, secondary_color: nil, stadium: nil, stadium_location: nil, values: nil, website: nil, win_percentage: nil, request_options: {}) ⇒ ::Believe::Models::Team
Update specific fields of an existing team.
123 124 125 126 127 128 129 130 131 132 |
# File 'lib/believe/resources/teams.rb', line 123 def update(team_id, params = {}) parsed, = ::Believe::TeamUpdateParams.dump_request(params) @client.request( method: :patch, path: ["teams/%1$s", team_id], body: parsed, model: ::Believe::Team, options: ) end |