Sha256: 095bc88f89974775b0f6fe78ce8344da625480a90f97beaed24fa8ae8a2376fc

Contents?: true

Size: 1.54 KB

Versions: 7

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

module Notion
  module Api
    module Endpoints
      module Users
        #
        # Retrieves the bot User associated with the API token provided in
        # the authorization header. The bot will have an `owner` field with
        # information about the person who authorized the integration.
        def me
          get("users/me")
        end

        #
        # Retrieves a User object using the ID specified in the request.
        #
        # @option options [id] :user_id
        #   User to get info on.
        def user(options = {})
          throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
          get("users/#{options[:user_id]}")
        end

        #
        # Returns a paginated list of User objects for the workspace.
        #
        # @option options [UUID] :start_cursor
        # Paginate through collections of data by setting the cursor parameter
        # to a start_cursor attribute returned by a previous request's next_cursor.
        # Default value fetches the first "page" of the collection.
        # See pagination for more detail.
        #
        # @option options [integer] :page_size
        #   The number of items from the full list desired in the response. Maximum: 100
        def users_list(options = {})
          if block_given?
            Pagination::Cursor.new(self, :users_list, options).each do |page|
              yield page
            end
          else
            get("users", options)
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
notion-ruby-client-1.2.2 lib/notion/api/endpoints/users.rb
notion-ruby-client-1.2.1 lib/notion/api/endpoints/users.rb
notion-ruby-client-1.2.0 lib/notion/api/endpoints/users.rb
notion-ruby-client-1.1.0 lib/notion/api/endpoints/users.rb
notion-ruby-client-1.0.0 lib/notion/api/endpoints/users.rb
notion-ruby-client-1.0.0.pre.beta2 lib/notion/api/endpoints/users.rb
notion-ruby-client-1.0.0.pre.beta1 lib/notion/api/endpoints/users.rb