Class: Rafflesia::OntologyContexts

Inherits:
Object
  • Object
show all
Defined in:
lib/rafflesia/ontology_contexts.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OntologyContexts

Returns a new instance of OntologyContexts.



9
10
11
# File 'lib/rafflesia/ontology_contexts.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#get(q: nil, relation: nil, neighbor_hops: 1, max_relations: 8, max_columns: 24, request_options: {}) ⇒ Rafflesia::EnvelopeOntologyContextData

GET /v1/ontology_contexts

Parameters:

  • q (String, nil) (defaults to: nil)
  • relation (Array<String>, nil) (defaults to: nil)
  • neighbor_hops (Integer, nil) (defaults to: 1)
  • max_relations (Integer, nil) (defaults to: 8)
  • max_columns (Integer, nil) (defaults to: 24)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rafflesia/ontology_contexts.rb', line 21

def get(
  q: nil,
  relation: nil,
  neighbor_hops: 1,
  max_relations: 8,
  max_columns: 24,
  request_options: {}
)
  params = {
    'q' => q,
    'relation' => relation,
    'neighbor_hops' => neighbor_hops,
    'max_relations' => max_relations,
    'max_columns' => max_columns
  }.compact
  response = @client.request(
    method: :get,
    path: '/v1/ontology_contexts',
    auth: true,
    params: params,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeOntologyContextData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end