Class: BundleUp::Unify::Me

Inherits:
Base
  • Object
show all
Defined in:
lib/bundleup/unify/me.rb,
sig/bundleup/unify/me.rbs

Overview

Client for the root-level identity endpoint.

me is the one unified method every provider implements, so the API mounts it at the root rather than under a vertical. It is exposed on the Unify client as unify.me rather than as a namespace.

Constant Summary

Constants inherited from Base

Base::API_VERSION, Base::BASE_URL

Instance Attribute Summary

Attributes inherited from Base

#api_key, #connection_id

Instance Method Summary collapse

Methods inherited from Base

#connection, #initialize

Constructor Details

This class inherits a constructor from BundleUp::Unify::Base

Instance Method Details

#get(params = {}) ⇒ { data: account }

Fetches the account the connection is authenticated as.

Providers that authorize per workspace, portal, tenant or company return that account instead of a user, and fields the provider does not expose come back as nil.

Parameters:

  • params (Hash[Symbol, untyped]) (defaults to: {})

Returns:

  • ({ data: account })


16
17
18
19
20
21
22
23
24
# File 'lib/bundleup/unify/me.rb', line 16

def get(params = {})
  response = connection.get('me') do |req|
    req.params = params
  end

  raise "Failed to fetch me: #{response.status}" unless response.success?

  response.body
end