Class: NBA::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/nba/client.rb

Overview

API client for making requests to the NBA Stats API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection: Connection.new) ⇒ NBA::Client

Initializes a new Client object

Examples:

client = NBA::Client.new


28
29
30
# File 'lib/nba/client.rb', line 28

def initialize(connection: Connection.new)
  @connection = connection
end

Instance Attribute Details

#connectionConnection (readonly)

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 the connection used for HTTP requests



19
20
21
# File 'lib/nba/client.rb', line 19

def connection
  @connection
end

Instance Method Details

#get(path) ⇒ String

Makes a GET request to the specified path

Examples:

client.get("commonplayerinfo?PlayerID=2544")


13
# File 'lib/nba/client.rb', line 13

def get(path) = connection.get(path)