class Ocs::Response

Attributes

raw_body[R]

Public Class Methods

new(faraday_response) click to toggle source
# File lib/ocs/response.rb, line 5
def initialize(faraday_response)
  @raw_body    = faraday_response.body.with_indifferent_access
  @raw_headers = faraday_response.headers
  @raw_status  = faraday_response.status
end

Public Instance Methods

content() click to toggle source
# File lib/ocs/response.rb, line 11
def content
  @content ||= raw_body[response_key]
end
response_key() click to toggle source
# File lib/ocs/response.rb, line 15
def response_key
  @response_key ||= raw_body.keys.first
end
status() click to toggle source
# File lib/ocs/response.rb, line 19
def status
  @raw_status
end
success?() click to toggle source
# File lib/ocs/response.rb, line 23
def success?
  !content.has_key?("errorcode")
end