Class: Openlayer::Resources::Governance::Frameworks::Documents

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/resources/governance/frameworks/documents.rb,
sig/openlayer/resources/governance/frameworks/documents.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Documents

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Documents.

Parameters:



73
74
75
# File 'lib/openlayer/resources/governance/frameworks/documents.rb', line 73

def initialize(client:)
  @client = client
end

Instance Method Details

#list(framework_id, page: nil, per_page: nil, request_options: {}) ⇒ Openlayer::Models::Governance::Frameworks::DocumentListResponse

List the documents attached to a framework.

A document holds the text of the standard the framework is based on, split into sections and subsections. Retrieve a single document to get that structure, along with the rules mapped to each part of it.

Parameters:

  • framework_id (String) —

    The framework id.

  • page (Integer) —

    The page to return in a paginated query.

  • per_page (Integer) —

    Maximum number of items to return per page.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/openlayer/resources/governance/frameworks/documents.rb', line 58

def list(framework_id, params = {})
  parsed, options = Openlayer::Governance::Frameworks::DocumentListParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["frameworks/%1$s/documents", framework_id],
    query: query.transform_keys(per_page: "perPage"),
    model: Openlayer::Models::Governance::Frameworks::DocumentListResponse,
    options: options
  )
end

#retrieve(document_id, framework_id:, request_options: {}) ⇒ Openlayer::Models::Governance::Frameworks::DocumentRetrieveResponse

Retrieve a framework document, including its sections, subsections, and the rules mapped to each.

Each section and subsection carries a ruleCount, so you can tell which requirements have rules mapped to them before drilling in.

Parameters:

  • document_id (String) —

    The framework document id.

  • framework_id (String) —

    The framework id.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/openlayer/resources/governance/frameworks/documents.rb', line 25

def retrieve(document_id, params)
  parsed, options = Openlayer::Governance::Frameworks::DocumentRetrieveParams.dump_request(params)
  framework_id =
    parsed.delete(:framework_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["frameworks/%1$s/documents/%2$s", framework_id, document_id],
    model: Openlayer::Models::Governance::Frameworks::DocumentRetrieveResponse,
    options: options
  )
end