class ApiModel::HttpRequest

Attributes

api_call[RW]
builder[RW]
cache_id[RW]
config[RW]
method[RW]
options[RW]
path[RW]

Public Instance Methods

full_path() click to toggle source
# File lib/api_model/http_request.rb, line 40
def full_path
  return path if path =~ /^http/
  "#{config.host}#{path}"
end
request_method() click to toggle source
# File lib/api_model/http_request.rb, line 45
def request_method
  api_call.request.original_options[:method]
end
run() click to toggle source
# File lib/api_model/http_request.rb, line 24
def run
  run_callbacks :run_request do
    Log.debug "#{method.to_s.upcase} #{full_path} with headers: #{options[:headers]}"
    self.api_call = Typhoeus.send method, full_path, options
    Response.new self, config
  end
end

Private Instance Methods

set_default_options() click to toggle source
# File lib/api_model/http_request.rb, line 51
def set_default_options
  options[:headers] ||= {}
  options[:headers].reverse_merge! config.headers if config.try(:headers)
end