class Duedil::Response

Public Class Methods

new(http_response) click to toggle source
# File lib/duedil/response.rb, line 6
def initialize(http_response)
  @http_response = http_response
end

Public Instance Methods

hash() click to toggle source
# File lib/duedil/response.rb, line 22
def hash
  object.hash
end
json?() click to toggle source
# File lib/duedil/response.rb, line 30
def json?
  self['Content-Type'].split(';').first == 'application/json'
end
list() click to toggle source
# File lib/duedil/response.rb, line 26
def list
  hash['data'].map(&:hash) if hash['data'].present?
end
method_missing(name, *args, &block) click to toggle source
# File lib/duedil/response.rb, line 14
def method_missing(name, *args, &block)
  @http_response.send(name, *args, &block)
end
object() click to toggle source
# File lib/duedil/response.rb, line 34
def object
  @object ||= JSON.parse(body, :object_class => Struct).response
end
ok?() click to toggle source
# File lib/duedil/response.rb, line 18
def ok?
  code.to_i == 200
end
respond_to_missing?(name, include_private = false) click to toggle source
# File lib/duedil/response.rb, line 10
def respond_to_missing?(name, include_private = false)
  @http_response.respond_to?(name)
end