Method: PDC::Resource::RestApi::ClassMethods#fetch

Defined in:
lib/pdc/resource/rest_api.rb

#fetch(relation) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/pdc/resource/rest_api.rb', line 22

def fetch(relation)
  # TODO: handle v1/release-variant/(:release)/(:variant)
  # attributes won't contain (:release) and (:variant_id)
  params = relation.params
  resource_path = Path.new(relation.uri, params)

  uri = resource_path.expanded
  query = params.except(*resource_path.variables)
  request(:get, uri, query)
end