Method: Bitly::API::Organization.list

Defined in:
lib/bitly/api/organization.rb

.list(client:) ⇒ Bitly::API::Organization::List

Get a list of organizations from the API. It receives an authorized ‘Bitly::API::Client` object and uses it to request the `/organizations` endpoint. [`GET /v4/organizations`](dev.bitly.com/v4/#operation/getOrganizations)

Examples:

organizations = Bitly::API::Organization.list(client: client)

Parameters:

Returns:



29
30
31
32
33
34
35
# File 'lib/bitly/api/organization.rb', line 29

def self.list(client:)
  response = client.request(path: '/organizations')
  organizations = response.body['organizations'].map do |org|
    Organization.new(data: org, client: client)
  end
  List.new(items: organizations, response: response)
end