class Instamojo::Response
Attributes
body[R]
code[R]
Public Class Methods
new(hash)
click to toggle source
# File lib/response.rb, line 5 def initialize(hash) @code = hash.status if hash.body begin @body = JSON.parse(hash.body) rescue JSON::ParserError @body = {:client_error => "Something went wrong", :original => hash.body.to_s} end @body.symbolize_keys! @status = @body[:success] end end
Public Instance Methods
response_success?()
click to toggle source
# File lib/response.rb, line 18 def response_success? [200, 201, 202, 203, 204].include? @code end
success?()
click to toggle source
# File lib/response.rb, line 22 def success? (@status && (@status.eql?(true) || @status.downcase == 'success')) || response_success? end