Class: XIVAPI::Sheets

Inherits:
Object
  • Object
show all
Defined in:
lib/xivapi/sheets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ XIVAPI::Sheets

Initialize a new Sheets client for making API requests.

Parameters:



8
9
10
# File 'lib/xivapi/sheets.rb', line 8

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



3
4
5
# File 'lib/xivapi/sheets.rb', line 3

def client
  @client
end

Instance Method Details

#allArray<Hash>

List known excel sheets that can be read by the API.

Returns:

  • (Array<Hash>)

    The list of known sheets.



14
15
16
# File 'lib/xivapi/sheets.rb', line 14

def all
  client.request("sheet")
end

#get(sheet, row_id, params = {}) ⇒ Hash

Read detailed, filterable information from a single sheet row and its related data.

Parameters:

  • sheet (String)

    Name of the sheet to read.

  • row_id (Integer)

    The ID of the row to read.

  • params (Hash) (defaults to: {})

    The parameters to fetch the row with.

Returns:

  • (Hash)

    The row with typed fields.



31
32
33
# File 'lib/xivapi/sheets.rb', line 31

def get(sheet, row_id, params = {})
  client.request("sheet/#{sheet}/#{row_id}", params)
end

#list(sheet, params = {}) ⇒ Array<Hash>

Read information about one or more rows and their related data.

Parameters:

  • sheet (String)

    The sheet to fetch the rows from.

  • params (Hash) (defaults to: {})

    The parameters to fetch the rows with.

Returns:

  • (Array<Hash>)

    A list of rows with typed fields.



22
23
24
# File 'lib/xivapi/sheets.rb', line 22

def list(sheet, params = {})
  client.request("sheet/#{sheet}", params)
end