Sha256: 7e9f5188806ebacb28f643198106bf999ea9568bf18e565e21e2d18b32775f75

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

module Devrant
  class Users
    include HTTParty
    include Devrant

    def get_user_by_id(id)
      user = structuralize(self.class.get("/users/#{id}")).profile

      return user unless user.nil?

      raise ArgumentError.new("No user found for id #{id}")
    end

    def get_user_id(username)
      id = structuralize(self.class.get('/get-user-id', extend_request_query({username: username}))).user_id

      return id unless id.nil?

      raise ArgumentError.new("No user called #{username} found.")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devrant-0.9.0 lib/devrant/users.rb