Class: XIVAPI::Assets

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

Overview

Endpoints for accessing game data on a file-by-file basis. Commonly useful for fetching icons or other textures to display on the web.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ XIVAPI::Assets

Initialize a new Assets client for making API requests.

Parameters:



9
10
11
# File 'lib/xivapi/assets.rb', line 9

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/xivapi/assets.rb', line 4

def client
  @client
end

Instance Method Details

#get(params = {}) ⇒ Buffer, String

Read an asset from the game at the specified path, converting it into a usable format. If no valid conversion between the game file type and specified format exists, an error will be returned.

Parameters:

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

    Query parameters accepted by the asset endpoint.

Returns:

  • (Buffer, String)

    An image of the specified asset in the specified format.



16
17
18
# File 'lib/xivapi/assets.rb', line 16

def get(params = {})
  client.request("asset", params)
end

#map(territory, index, params = {}) ⇒ Buffer, String

Retrieve the specified map, composing it from split source files if necessary.

Parameters:

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

    Query parameters accepted by the map endpoint.

Returns:

  • (Buffer, String)

    An image of the specified map in the specified format.



23
24
25
# File 'lib/xivapi/assets.rb', line 23

def map(territory, index, params = {})
  client.request("asset/map/#{territory}/#{index}", params)
end