Class: FuelSDK::HTTPResponse

Inherits:
Response show all
Defined in:
lib/fuelsdk/http_request.rb

Instance Attribute Summary

Attributes inherited from Response

#body, #code, #message, #raw, #request_id, #results

Instance Method Summary collapse

Methods inherited from Response

#more, #success

Constructor Details

#initialize(raw, client, request) ⇒ HTTPResponse

Returns a new instance of HTTPResponse.



45
46
47
48
# File 'lib/fuelsdk/http_request.rb', line 45

def initialize raw, client, request
  super raw, client
  @request = request
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)

by default try everything against results



77
78
79
# File 'lib/fuelsdk/http_request.rb', line 77

def method_missing method, *args, &block
  @results.send(method, *args, &block)
end

Instance Method Details

#[](key) ⇒ Object



62
63
64
# File 'lib/fuelsdk/http_request.rb', line 62

def [] key
  @results[key]
end

#continueObject



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/fuelsdk/http_request.rb', line 50

def continue
  rsp = nil
  if more?
   @request['options']['page'] = @results['page'].to_i + 1
   rsp = unpack @client.rest_get(@request['url'], @request['options'])
  else
    puts 'No more data'
  end

  rsp
end