class Vkponchik::Response

API response

Public Class Methods

new(hash) click to toggle source

@param hash [Hash]

# File lib/vkponchik/response.rb, line 7
def initialize(hash)
  @hash = hash
end

Public Instance Methods

[](arg) click to toggle source

@return [Object?]

# File lib/vkponchik/response.rb, line 29
def [](arg)
  @hash[arg.to_s]
end
error?() click to toggle source

@return [Boolean]

# File lib/vkponchik/response.rb, line 12
def error?
  !@hash['success']
end
error_full_message() click to toggle source

@return [String?]

# File lib/vkponchik/response.rb, line 22
def error_full_message
  return unless error?

  "#{@hash['error']}: #{@hash['msg']}"
end
success?() click to toggle source

@return [Boolean]

# File lib/vkponchik/response.rb, line 17
def success?
  !error?
end