Sha256: c146462e8eab8a06672cfd801179c43d861062a515b5cb2ef4bf32882a5ce8a8
Contents?: true
Size: 573 Bytes
Versions: 1
Compression:
Stored size: 573 Bytes
Contents
module Xio class Response attr_accessor :request, :code, :body, :raw_body, :raw_response def initialize(options={}) options.each do |k, v| send("#{k}=", v) if respond_to?("#{k}=") end end def success? code.to_i > 199 && code.to_i < 300 end def errors if body.is_a?(Hash) Array(body['errors']).compact else [] end end def body_without_wrapper if body.is_a?(Hash) && body['api_response'] body['api_response'] else body end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xio-1.0.0 | lib/xio/response.rb |