Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 1.88 KB

groups.md

File metadata and controls

80 lines (54 loc) · 1.88 KB

Groups

Groups are a subdivision within an organization. A user belongs to a group within an organization. Most actions in the API are on behalf of a group. For example, when you shorten a link, it will be on behalf of a user and a group.

See the full Bitly API documentation for Groups.

List Groups

With an API client you can list the groups available to the authorized user.

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

Or with the class method

groups = Bitly::API::Group.list(client: client)

You can also filter groups by an organization guid or an organization object, using the client.

groups = client.groups(organization: organization_guid)
groups = client.groups(organization: organization)

Or the class method

groups = Bitly::API::Group.list(client: client, organization: organization_guid)
groups = Bitly::API::Group.list(client: client, organization: organization)

Fetch a Group

If you have the guid of an group, you can fetch it directly.

group = client.group(guid)

Or with the class method

group = Bitly::API::Group.fetch(client: client, guid: guid)

Group attributes

Groups have the following attributes:

  • name
  • guid
  • is_active
  • role
  • bsds
  • organization_guid
  • created
  • modified

A Group's organization

With the organization_guid we can get the group's organization directly from the group object.

organization = group.organization

Group preferences

You can set one preference for a group, the domain that is used to shorten links. Free accounts can only choose bit.ly and pro accounts can use any domains they have set up.

preferences = group.preferences
puts preferences.domain_preference

preferences.update(domain_preference: 'bit.ly')