Class: Warcraft::ApiResponse

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/warcraft/api_response.rb

Direct Known Subclasses

Character::Achievements, Character::Profile

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, response) ⇒ ApiResponse

Returns a new instance of ApiResponse.

Parameters:

  • response (Hash)

    A parsed character profile document



12
13
14
15
16
# File 'lib/warcraft/api_response.rb', line 12

def initialize(client, response)
  @client = client
  @response = response
  @memoized_responses = {}
end

Class Method Details

.convert_time(timestamp) ⇒ Time

Returns:

  • (Time)


24
25
26
# File 'lib/warcraft/api_response.rb', line 24

def self.convert_time(timestamp)
  Time.at(timestamp / 1000)
end

Instance Method Details

#urlString

Returns:

  • (String)


19
20
21
# File 'lib/warcraft/api_response.rb', line 19

def url
  @response.dig(:_links, :self, :href)
end