class Sendicate::Request

Attributes

response[RW]

Public Class Methods

delete(path, options={}, &block) click to toggle source
Calls superclass method
# File lib/sendicate/request.rb, line 26
def self.delete(path, options={}, &block)
  new(super)
end
get(path, options={}, &block) click to toggle source
Calls superclass method
# File lib/sendicate/request.rb, line 10
def self.get(path, options={}, &block)
  new(super)
end
new(response) click to toggle source
# File lib/sendicate/request.rb, line 30
def initialize(response)
  @response = response
  unless success?
    case response.code
    when 400
      raise BadRequest
    when 401
      raise Unauthorized
    when 404
      raise ResourceNotFound
    end
  end
end
patch(path, options={}, &block) click to toggle source
Calls superclass method
# File lib/sendicate/request.rb, line 18
def self.patch(path, options={}, &block)
  new(super)
end
post(path, options={}, &block) click to toggle source
Calls superclass method
# File lib/sendicate/request.rb, line 14
def self.post(path, options={}, &block)
  new(super)
end
put(path, options={}, &block) click to toggle source
Calls superclass method
# File lib/sendicate/request.rb, line 22
def self.put(path, options={}, &block)
  new(super)
end

Public Instance Methods

parsed_response() click to toggle source
# File lib/sendicate/request.rb, line 44
def parsed_response
  response.parsed_response
end
success?() click to toggle source
# File lib/sendicate/request.rb, line 48
def success?
  [200, 201].include?(response.code)
end