class Authy::User

Public Instance Methods

errors() click to toggle source
# File lib/authy/models/user.rb, line 7
def errors
  case
  when self.ok?
    {}
  when !@errors.empty?
    @errors
  else
    {"error" => error_msg}
  end
end
id() click to toggle source
# File lib/authy/models/user.rb, line 3
def id
  self['id']
end

Protected Instance Methods

parse_body() click to toggle source
# File lib/authy/models/user.rb, line 19
def parse_body
  begin
    body = JSON.parse(@raw_response.body)
    body = body['user'] if body['user']

    if self.ok?
      body.each do |k,v|
        self[k] = v
      end
    else
      if body.has_key?('errors')
        @errors = body['errors']
      else
        @errors = body
      end
    end
  rescue Exception => e
  end
end