Class: Puree::API::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/puree/api/map.rb

Overview

Pure endpoints and corresponding XML root element in response.

Instance Method Summary collapse

Constructor Details

#initializeMap

Returns a new instance of Map.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/puree/api/map.rb', line 9

def initialize
  @convention = %w(
    event
    journal
    organisation
    person
    project
    publication
    publisher
  )

  @api_map = {
    resource_type: {
      dataset: {
        service: 'datasets',
        response: 'GetDataSetsResponse',
        family: 'dk.atira.pure.modules.datasets.external.model.dataset.DataSet'
      },
      download: {
        service: 'downloadcount',
        response: 'GetDownloadCountResponse'
      },
      server: {
        service: 'servermeta',
        response: 'GetServerMetaResponse'
      }
    }
  }

  add_convention
  # add_family
end

Instance Method Details

#getHash

Gets endpoints with their corresponding XML response names.

Returns:

  • (Hash)


45
46
47
# File 'lib/puree/api/map.rb', line 45

def get
  @api_map
end

#service_name(resource_type) ⇒ String?

Endpoint for resource type.

Parameters:

  • resource_type (Symbol)

Returns:

  • (String, nil)


53
54
55
# File 'lib/puree/api/map.rb', line 53

def service_name(resource_type)
  @api_map[:resource_type][resource_type][:service]
end