class SolscanApiRuby::Client::Response

Response class parses response from the API to the more convenient format.

Public Class Methods

new(response) click to toggle source

Initialize object with response body in json format.

@param response [Hash] hash with response from the API.

# File lib/solscan_api_ruby/client/response.rb, line 15
def initialize(response)
  @response = response
end

Public Instance Methods

body() click to toggle source

@return [Hash] parsed response body.

# File lib/solscan_api_ruby/client/response.rb, line 20
def body
  @body ||= Oj.load(@response.body)

rescue Oj::ParseError
  @response.body
end
headers() click to toggle source

@return [Hash] response headers.

# File lib/solscan_api_ruby/client/response.rb, line 28
def headers
  @response.headers
end
status() click to toggle source

@return [Integer] response status.

# File lib/solscan_api_ruby/client/response.rb, line 33
def status
  @response.status
end
successfull?() click to toggle source

@return [Boolean] response success.

# File lib/solscan_api_ruby/client/response.rb, line 38
def successfull?
  @response.success?
end