Sha256: 710a0081aa269464b29c1cf0c3e1464ef75803b23b27d1d1807f89c1ba72169f

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

class FolioClient
  # Query user records in Folio; see
  # https://s3.amazonaws.com/foliodocs/api/mod-users/r/users.html
  class Users
    attr_accessor :client

    # @param client [FolioClient] the configured client
    def initialize(client)
      @client = client
    end

    # @param query [String] an optional query to limit the number of users returned
    # @param limit [Integer] the number of results to return (defaults to 10,000)
    # @param offset [Integer] the offset for results returned (defaults to 0)
    # @param lang [String] language code for returned results (defaults to 'en')
    def fetch_list(query: nil, limit: 10000, offset: 0, lang: "en")
      params = {limit: limit, offset: offset, lang: lang}
      params[:query] = query if query
      client.get("/users", params)
    end

    # @param id [String] id for requested user
    # @param lang [String] language code for returned results (defaults to 'en')
    def fetch_user_details(id:, lang: "en")
      client.get("/users/#{id}", {
        lang: lang
      })
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
folio_client-0.15.0 lib/folio_client/users.rb
folio_client-0.14.0 lib/folio_client/users.rb