Sha256: 1952824195f446011a1b6f7598228afe509c1b878462d7c51c89488703cdc36d

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

class FolioClient
  # Query organization records in Folio; see
  # https://s3.amazonaws.com/foliodocs/api/mod-organizations/p/organizations.html
  # https://s3.amazonaws.com/foliodocs/api/mod-organizations-storage/p/interface.html
  class Organizations
    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 organizations 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("/organizations/organizations", params)
    end

    # @param query [String] an optional query to limit the number of organization interfaces 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_interface_list(query: nil, limit: 10000, offset: 0, lang: "en")
      params = {limit: limit, offset: offset, lang: lang}
      params[:query] = query if query
      client.get("/organizations-storage/interfaces", params)
    end

    # @param id [String] id for requested storage interface
    # @param lang [String] language code for returned result (defaults to 'en')
    def fetch_interface_details(id:, lang: "en")
      client.get("/organizations-storage/interfaces/#{id}", {
        lang: lang
      })
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
folio_client-0.15.0 lib/folio_client/organizations.rb
folio_client-0.14.0 lib/folio_client/organizations.rb
folio_client-0.13.0 lib/folio_client/organizations.rb
folio_client-0.12.0 lib/folio_client/organizations.rb
folio_client-0.11.0 lib/folio_client/organizations.rb
folio_client-0.10.1 lib/folio_client/organizations.rb
folio_client-0.10.0 lib/folio_client/organizations.rb