class OmiseGO::Response

Public Class Methods

new(body, client) click to toggle source
# File lib/omisego/response.rb, line 3
def initialize(body, client)
  @body = body
  @client = client
  @config = @client.config
end

Public Instance Methods

data() click to toggle source
# File lib/omisego/response.rb, line 17
def data
  type = @body['data']['object'].to_sym
  unless @config[:models] && @config[:models].keys.include?(type)
    raise "Unknown Object '#{@body['data']['object']}'"
  end

  klass = @config[:models][type]
  klass.new(@body['data'], client: @client)
end
success?() click to toggle source
# File lib/omisego/response.rb, line 9
def success?
  @success ||= @body['success'] == true
end
version() click to toggle source
# File lib/omisego/response.rb, line 13
def version
  @version ||= @body['version']
end