class Nvlope::Request

Constants

Failed

Attributes

method[R]
nvlope[R]
options[R]
path[R]
url[R]

Public Class Methods

new(nvlope, method, path, options={}) click to toggle source
# File lib/nvlope/request.rb, line 13
def initialize nvlope, method, path, options={}
  @nvlope, @method, @path, @options = nvlope, method, path, options
  @url = File.join(nvlope.domain, nvlope.api_version, path)
end

Public Instance Methods

perform() click to toggle source
# File lib/nvlope/request.rb, line 26
def perform
  response
end
perform!() click to toggle source
# File lib/nvlope/request.rb, line 30
def perform!
  case response.code
  when 200..299
    return response
  else
    raise Failed.new(response.request, response)
  end
end
response() click to toggle source
# File lib/nvlope/request.rb, line 19
def response
  @response ||= begin
    nvlope.logger.info "Nvlope request: #{method.to_s.upcase} #{url} #{options.inspect}"
    HTTParty.send(method, url, options)
  end
end