Class: Warframe::REST::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/warframe/rest/request.rb

Overview

A request to send to the Warframe Stat API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, path, klass) ⇒ Warframe:REST:Request

Instantiate a Request

Parameters:



22
23
24
25
26
27
# File 'lib/warframe/rest/request.rb', line 22

def initialize(client, path, klass)
  @client = client
  @route = path
  @path = client.base_url + path + "?language=#{@client.language}"
  @klass = klass
end

Instance Attribute Details

#clientWarframe::REST::Client (readonly)



11
12
13
# File 'lib/warframe/rest/request.rb', line 11

def client
  @client
end

#pathString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/warframe/rest/request.rb', line 14

def path
  @path
end

Instance Method Details

#sendWarframe::Models, Array<[Warframe::Models]>

Sends an HTTP request with the attached parameters and headers. Will either return the Model, or collection of Models.

Returns:



32
33
34
35
36
37
# File 'lib/warframe/rest/request.rb', line 32

def send
  uri = URI(path)
  req = Net::HTTP::Get.new(uri)
  resp = get_response uri, req
  return_parsed resp
end