Class: Dina::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/dina/endpoints/endpoint.rb

Class Method Summary collapse

Class Method Details

.material_sample_summary(id:) ⇒ Object



7
8
9
10
11
# File 'lib/dina/endpoints/endpoint.rb', line 7

def self.material_sample_summary(id:)
  connection = EndpointConnection.new
  #TODO: not sure what the /api/ needs to be included here when already present in Dina.config.endpoint_url
  connection.run(:get, "/api/collection-api/material-sample-summary/" + id)
end

.resource_name_identifier(name:, type:, group:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/dina/endpoints/endpoint.rb', line 13

def self.resource_name_identifier(name:, type:, group:)
  params = {
    "filter[name][EQ]": name,
    "filter[type][EQ]": type,
    "filter[group][EQ]": group
  }
  connection = EndpointConnection.new
  response = connection.run(:get, "/api/collection-api/resource-name-identifier", params: params)
  response["data"][0]["id"] rescue nil
end