Class: Warframe::REST::Request
- Inherits:
-
Object
- Object
- Warframe::REST::Request
- Defined in:
- lib/warframe/rest/request.rb
Overview
A request to send to the Warframe Stat API.
Instance Attribute Summary collapse
- #client ⇒ Warframe::REST::Client readonly
- #path ⇒ String readonly
Instance Method Summary collapse
-
#initialize(client, path, klass) ⇒ Warframe:REST:Request
constructor
Instantiate a Request.
-
#send ⇒ Warframe::Models, Array<[Warframe::Models]>
Sends an HTTP request with the attached parameters and headers.
Constructor Details
#initialize(client, path, klass) ⇒ Warframe:REST:Request
Instantiate a Request
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
#client ⇒ Warframe::REST::Client (readonly)
11 12 13 |
# File 'lib/warframe/rest/request.rb', line 11 def client @client end |
#path ⇒ String (readonly)
14 15 16 |
# File 'lib/warframe/rest/request.rb', line 14 def path @path end |
Instance Method Details
#send ⇒ Warframe::Models, Array<[Warframe::Models]>
Sends an HTTP request with the attached parameters and headers. Will either return the Model, or collection of Models.
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 |