class Uber::ApiRequest
Attributes
client[RW]
options[RW]
path[RW]
request_method[RW]
verb[RW]
Public Class Methods
new(client, request_method, path, options = {})
click to toggle source
@param client [Uber::Client] @param request_method
[String, Symbol] @param path [String] @param options [Hash] @return [Uber::ApiRequest]
# File lib/uber/api_request.rb, line 11 def initialize(client, request_method, path, options = {}) @client = client @request_method = request_method.to_sym @path = path @options = options end
Public Instance Methods
perform()
click to toggle source
@return [Hash]
# File lib/uber/api_request.rb, line 19 def perform @client.send(@request_method, @path, @options).body end
perform_with_object(klass)
click to toggle source
@param klass [Class] @param request [Uber::ApiRequest] @return [Object]
# File lib/uber/api_request.rb, line 26 def perform_with_object(klass) klass.new(perform) end
perform_with_objects(klass)
click to toggle source
@param klass [Class] @return [Array]
# File lib/uber/api_request.rb, line 32 def perform_with_objects(klass) ((perform.values.find { |v| v.is_a?(Array) }) || []).collect do |element| klass.new(element) end end
perform_without_object()
click to toggle source
@return status_code [Integer]
# File lib/uber/api_request.rb, line 39 def perform_without_object @client.send(@request_method, @path, @options).status end