class Cloudhdr::Response

Attributes

body[RW]
code[RW]
raw_body[RW]
raw_response[RW]

Public Class Methods

new(options={}) click to toggle source
# File lib/cloudhdr/response.rb, line 6
def initialize(options={})
  options.each do |k, v|
    send("#{k}=", v) if respond_to?("#{k}=")
  end
end

Public Instance Methods

body_without_wrapper() click to toggle source
# File lib/cloudhdr/response.rb, line 24
def body_without_wrapper
  if body.is_a?(Hash) && body['api_response']
    body['api_response']
  else
    body
  end
end
errors() click to toggle source
# File lib/cloudhdr/response.rb, line 16
def errors
  if body.is_a?(Hash)
    Array(body['errors']).compact
  else
    []
  end
end
success?() click to toggle source
# File lib/cloudhdr/response.rb, line 12
def success?
  code.to_i > 199 && code.to_i < 300
end