Sha256: fa71a2c6f969470ab146f10d8556a4b049c69ee66db66892a1608a96aa1f16e8

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Notion
  module Api
    module Endpoints
      module Users
        #
        # Retrieves a User object using the ID specified in the request.
        #
        # @option options [id] :id
        #   User to get info on.
        def user(options = {})
          throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
          get("users/#{options[: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.
        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

6 entries across 6 versions & 1 rubygems

Version Path
notion-ruby-client-0.0.8 lib/notion/api/endpoints/users.rb
notion-ruby-client-0.0.7 lib/notion/api/endpoints/users.rb
notion-ruby-client-0.0.6 lib/notion/api/endpoints/users.rb
notion-ruby-client-0.0.5 lib/notion/api/endpoints/users.rb
notion-ruby-client-0.0.4 lib/notion/api/endpoints/users.rb
notion-ruby-client-0.0.3 lib/notion/api/endpoints/users.rb