Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 836 Bytes

users.md

File metadata and controls

45 lines (32 loc) · 836 Bytes

Users

You can fetch and change data about the authenticated user using the API.

Fetch a user

With an API client you can fetch the authenticated user.

client = Bitly::API::Client.new(token: token)
user = client.user

Or you can use the class method:

user = Bitly::API::User.fetch(client: client)

User methods

User emails are objects themselves. A user can have more than one email address and they may be verified or the primary email.

email = user.emails.first
email.email
# => bitly@example.com
email.is_verified
# => true
email.is_primary
# => true

With a user you can fetch their default group:

user.default_group
# => <Bitly::API::Group>

You can update the user's name or default group guid:

user.update(name: "New name", default_group_guid: "ab1234")