puree 0.20.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -2
- data/PITCHME.md +43 -21
- data/README.md +72 -18
- data/lib/puree.rb +66 -21
- data/lib/puree/api/api.rb +9 -0
- data/lib/puree/api/authentication.rb +33 -0
- data/lib/puree/api/configuration.rb +43 -0
- data/lib/puree/api/map.rb +76 -0
- data/lib/puree/api/request.rb +116 -0
- data/lib/puree/extractor/collection.rb +131 -0
- data/lib/puree/extractor/dataset.rb +48 -0
- data/lib/puree/extractor/download.rb +71 -0
- data/lib/puree/extractor/event.rb +33 -0
- data/lib/puree/extractor/extractor.rb +10 -0
- data/lib/puree/extractor/journal.rb +29 -0
- data/lib/puree/extractor/organisation.rb +34 -0
- data/lib/puree/extractor/person.rb +32 -0
- data/lib/puree/extractor/project.rb +40 -0
- data/lib/puree/extractor/publication.rb +40 -0
- data/lib/puree/extractor/publisher.rb +27 -0
- data/lib/puree/extractor/resource.rb +69 -0
- data/lib/puree/extractor/server.rb +56 -0
- data/lib/puree/model/address.rb +50 -0
- data/lib/puree/model/copyright_license.rb +26 -0
- data/lib/puree/model/dataset.rb +84 -0
- data/lib/puree/model/download_header.rb +21 -0
- data/lib/puree/model/endeavour_person.rb +34 -0
- data/lib/puree/model/event.rb +31 -0
- data/lib/puree/model/event_header.rb +26 -0
- data/lib/puree/model/file.rb +45 -0
- data/lib/puree/model/helper/validation.rb +15 -0
- data/lib/puree/model/journal.rb +20 -0
- data/lib/puree/model/legal_condition.rb +26 -0
- data/lib/puree/model/link.rb +26 -0
- data/lib/puree/model/model.rb +7 -0
- data/lib/puree/model/organisation.rb +34 -0
- data/lib/puree/model/organisation_header.rb +34 -0
- data/lib/puree/model/person.rb +28 -0
- data/lib/puree/model/person_name.rb +52 -0
- data/lib/puree/model/project.rb +49 -0
- data/lib/puree/model/publication.rb +53 -0
- data/lib/puree/model/publication_status.rb +21 -0
- data/lib/puree/model/publisher.rb +13 -0
- data/lib/puree/model/related_content_header.rb +34 -0
- data/lib/puree/model/resource.rb +42 -0
- data/lib/puree/model/server.rb +13 -0
- data/lib/puree/model/spatial_point.rb +16 -0
- data/lib/puree/model/structure.rb +18 -0
- data/lib/puree/model/temporal_range.rb +15 -0
- data/lib/puree/util/date.rb +86 -0
- data/lib/puree/util/util.rb +8 -0
- data/lib/puree/version.rb +1 -1
- data/lib/puree/xml_extractor/base.rb +47 -0
- data/lib/puree/xml_extractor/collection.rb +40 -0
- data/lib/puree/xml_extractor/dataset.rb +305 -0
- data/lib/puree/xml_extractor/download.rb +42 -0
- data/lib/puree/xml_extractor/event.rb +63 -0
- data/lib/puree/xml_extractor/journal.rb +33 -0
- data/lib/puree/xml_extractor/organisation.rb +75 -0
- data/lib/puree/xml_extractor/person.rb +57 -0
- data/lib/puree/xml_extractor/project.rb +135 -0
- data/lib/puree/xml_extractor/publication.rb +189 -0
- data/lib/puree/xml_extractor/publisher.rb +28 -0
- data/lib/puree/xml_extractor/resource.rb +71 -0
- data/lib/puree/xml_extractor/server.rb +32 -0
- data/lib/puree/xml_extractor/shared.rb +31 -0
- data/lib/puree/xml_extractor/xml_extractor.rb +10 -0
- data/puree.gemspec +11 -8
- data/spec/download_http_spec.rb +31 -0
- data/spec/open_api_dataset_http_spec.rb +15 -0
- data/spec/resource/collection_all_http_spec.rb +77 -0
- data/spec/resource/collection_http_spec.rb +65 -0
- data/spec/resource/dataset_http_spec.rb +104 -0
- data/spec/resource/event_http_spec.rb +52 -0
- data/spec/resource/journal_http_spec.rb +36 -0
- data/spec/resource/organisation_http_spec.rb +52 -0
- data/spec/resource/person_http_spec.rb +48 -0
- data/spec/resource/project_http_spec.rb +76 -0
- data/spec/resource/publication_http_spec.rb +78 -0
- data/spec/resource/publisher_http_spec.rb +26 -0
- data/spec/server_http_spec.rb +26 -0
- data/spec/spec_helper.rb +106 -21
- metadata +110 -46
- data/lib/puree/collection.rb +0 -285
- data/lib/puree/configuration.rb +0 -15
- data/lib/puree/dataset.rb +0 -483
- data/lib/puree/date.rb +0 -63
- data/lib/puree/download.rb +0 -189
- data/lib/puree/event.rb +0 -133
- data/lib/puree/journal.rb +0 -75
- data/lib/puree/map.rb +0 -68
- data/lib/puree/organisation.rb +0 -177
- data/lib/puree/person.rb +0 -136
- data/lib/puree/project.rb +0 -231
- data/lib/puree/publication.rb +0 -258
- data/lib/puree/publisher.rb +0 -64
- data/lib/puree/resource.rb +0 -261
- data/lib/puree/server.rb +0 -156
- data/spec/collection_spec.rb +0 -62
- data/spec/dataset_spec.rb +0 -148
- data/spec/download_spec.rb +0 -33
- data/spec/event_spec.rb +0 -108
- data/spec/journal_spec.rb +0 -92
- data/spec/organisation_spec.rb +0 -112
- data/spec/person_spec.rb +0 -104
- data/spec/project_spec.rb +0 -120
- data/spec/publication_spec.rb +0 -128
- data/spec/publisher_spec.rb +0 -89
- data/spec/server_spec.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fcfce1e04c1a07280ef3792f67c7bb4b7fea7e9
|
4
|
+
data.tar.gz: ed700b052232a17ccb11b3337eca880d71e00541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1087979e95515396a9eceb0a7db3e32dd87130d4505fc95626043f48e657767b762f8861787ce652597098019db2b20a6b365831705a8f633dac89eb27e187cd
|
7
|
+
data.tar.gz: 1fe7778084eecac9c214a354a999825b089e5b4c417ceb3b03cc8db8dc39e7a57d8b1fd1debe87af9dd4170f6d56a948e97b5fbccca93290fc878618cf030f89
|
data/CHANGELOG.md
CHANGED
@@ -4,8 +4,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
5
5
|
## Unreleased
|
6
6
|
- Metadata: activity?, clipping?, externalPerson?
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
## 1.0.0 - 2017-03-15
|
9
|
+
### Added
|
10
|
+
- Dataset - legal conditions.
|
11
|
+
- Collection - random resource.
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Simplified authentication.
|
15
|
+
- Hash data structures converted to model classes.
|
16
|
+
- All dates in Time format.
|
17
|
+
|
18
|
+
### Removed
|
19
|
+
- Global configuration.
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
- Event - end date extraction.
|
9
23
|
|
10
24
|
## 0.20.0 - 2017-02-03
|
11
25
|
### Added
|
data/PITCHME.md
CHANGED
@@ -56,53 +56,75 @@ Ingesting research data management data from the Current Research Information Sy
|
|
56
56
|
#VSLIDE
|
57
57
|
|
58
58
|
- Consumes the Pure API.
|
59
|
-
- Metadata available
|
59
|
+
- Metadata available as Ruby data models. <!-- .element: class="fragment" -->
|
60
60
|
- No XML processing needed in any code. <!-- .element: class="fragment" -->
|
61
61
|
|
62
62
|
#VSLIDE
|
63
63
|
|
64
|
-
##
|
65
|
-
|
64
|
+
## Resource
|
65
|
+
|
66
|
+
Configure an extractor to retrieve data from a Pure host.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
dataset_extractor = Puree::Extractor::Dataset.new config
|
70
|
+
```
|
71
|
+
|
72
|
+
Fetch the metadata for a resource with a particular identifier.
|
66
73
|
|
67
74
|
```ruby
|
68
|
-
|
69
|
-
|
75
|
+
dataset = dataset_extractor.find uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
76
|
+
# =>
|
77
|
+
#<Puree::Model::Dataset:0x987f7a4>
|
70
78
|
```
|
71
|
-
|
79
|
+
|
80
|
+
Access specific metadata e.g. an internal person's name.
|
72
81
|
|
73
82
|
```ruby
|
74
|
-
|
83
|
+
dataset.persons_internal[0].name
|
84
|
+
# =>
|
85
|
+
#<Puree::Model::PersonName:0x9add67c @first="Foo", @last="Bar">
|
75
86
|
```
|
76
87
|
|
77
|
-
|
88
|
+
Select a formatting style for a person's name.
|
78
89
|
|
79
90
|
```ruby
|
80
|
-
|
91
|
+
dataset.persons_internal[0].name.last_initial
|
92
|
+
# =>
|
93
|
+
# "Bar, F."
|
81
94
|
```
|
82
95
|
|
83
96
|
#VSLIDE
|
84
97
|
|
85
|
-
## Collection
|
86
|
-
|
98
|
+
## Collection
|
99
|
+
|
100
|
+
Configure a collection extractor to retrieve data from a Pure host.
|
87
101
|
|
88
102
|
```ruby
|
89
|
-
|
90
|
-
|
103
|
+
collection_extractor = Puree::Extractor::Collection.new config: config,
|
104
|
+
resource: :dataset
|
91
105
|
```
|
92
|
-
...and get the data from an array of hashes or from an array of instances.
|
93
106
|
|
94
|
-
|
107
|
+
Fetch a bunch of resources.
|
95
108
|
|
96
|
-
|
109
|
+
```ruby
|
110
|
+
dataset_collection = collection_extractor.find limit: 2
|
111
|
+
# =>
|
112
|
+
#<Puree::Model::Dataset:0xa62fd90>
|
113
|
+
#<Puree::Model::Dataset:0xa5e8c24>
|
114
|
+
```
|
97
115
|
|
98
|
-
|
116
|
+
Fetch a random resource from the entire collection.
|
99
117
|
|
100
|
-
|
118
|
+
```ruby
|
119
|
+
random_dataset = collection_extractor.random_resource
|
120
|
+
# =>
|
121
|
+
#<Puree::Model::Dataset:0x97998bc>
|
122
|
+
```
|
101
123
|
|
102
124
|
#VSLIDE
|
103
125
|
|
104
|
-
##
|
126
|
+
## Location
|
105
127
|
|
106
|
-
<a href="
|
128
|
+
<a href="https://rubygems.org/gems/puree" target="_blank">RubyGems</a>
|
107
129
|
|
108
|
-
<a href="https://
|
130
|
+
<a href="https://github.com/lulibrary/puree" target="_blank">GitHub</a>
|
data/README.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
# Purée
|
2
|
-
|
1
|
+
# Purée
|
2
|
+
|
3
|
+
Metadata extraction from the Pure Research Information System.
|
4
|
+
|
5
|
+
## Status
|
6
|
+
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/puree.svg)](https://badge.fury.io/rb/puree)
|
8
|
+
[![Build Status](https://semaphoreci.com/api/v1/aalbinclark/puree/branches/master/badge.svg)](https://semaphoreci.com/aalbinclark/puree)
|
9
|
+
[![Code Climate](https://codeclimate.com/github/lulibrary/puree/badges/gpa.svg)](https://codeclimate.com/github/lulibrary/puree)
|
10
|
+
[![Dependency Status](https://www.versioneye.com/user/projects/5899d253a86053003f389e1f/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/5899d253a86053003f389e1f)
|
11
|
+
[![GitPitch](https://gitpitch.com/assets/badge.svg)](https://gitpitch.com/lulibrary/puree)
|
3
12
|
|
4
13
|
## Installation
|
5
14
|
|
@@ -19,35 +28,80 @@ Or install it yourself as:
|
|
19
28
|
## Usage
|
20
29
|
The following examples are for the Dataset resource type.
|
21
30
|
|
22
|
-
###
|
23
|
-
|
31
|
+
### Configuration
|
32
|
+
|
33
|
+
Create a hash for passing to an extractor.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# Pure host with authentication.
|
37
|
+
config = {
|
38
|
+
url: ENV['PURE_URL'],
|
39
|
+
username: ENV['PURE_USERNAME'],
|
40
|
+
password: ENV['PURE_PASSWORD']
|
41
|
+
}
|
42
|
+
```
|
24
43
|
|
25
44
|
```ruby
|
26
|
-
|
27
|
-
|
45
|
+
# Pure host without authentication.
|
46
|
+
config = {
|
47
|
+
url: ENV['PURE_URL']
|
48
|
+
}
|
28
49
|
```
|
29
|
-
|
50
|
+
|
51
|
+
### Resource
|
52
|
+
|
53
|
+
Configure an extractor to retrieve data from a Pure host.
|
30
54
|
|
31
55
|
```ruby
|
32
|
-
|
56
|
+
dataset_extractor = Puree::Extractor::Dataset.new config
|
33
57
|
```
|
34
58
|
|
35
|
-
|
59
|
+
Fetch the metadata for a resource with a particular identifier.
|
36
60
|
|
37
61
|
```ruby
|
38
|
-
|
62
|
+
dataset = dataset_extractor.find uuid: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
63
|
+
# =>
|
64
|
+
#<Puree::Model::Dataset:0x987f7a4>
|
39
65
|
```
|
40
66
|
|
41
|
-
|
42
|
-
Tell Purée what you are looking for...
|
67
|
+
Access specific metadata e.g. an internal person's name.
|
43
68
|
|
44
69
|
```ruby
|
45
|
-
|
46
|
-
|
70
|
+
dataset.persons_internal[0].name
|
71
|
+
# =>
|
72
|
+
#<Puree::Model::PersonName:0x9add67c @first="Foo", @last="Bar">
|
47
73
|
```
|
48
|
-
...and get the data from an array of hashes or from an array of instances.
|
49
74
|
|
50
|
-
|
51
|
-
|
75
|
+
Select a formatting style for a person's name.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
dataset.persons_internal[0].name.last_initial
|
79
|
+
# =>
|
80
|
+
# "Bar, F."
|
81
|
+
```
|
52
82
|
|
53
|
-
|
83
|
+
### Collection
|
84
|
+
|
85
|
+
Configure a collection extractor to retrieve data from a Pure host.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
collection_extractor = Puree::Extractor::Collection.new config: config,
|
89
|
+
resource: :dataset
|
90
|
+
```
|
91
|
+
|
92
|
+
Fetch a bunch of resources.
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
dataset_collection = collection_extractor.find limit: 2
|
96
|
+
# =>
|
97
|
+
#<Puree::Model::Dataset:0xa62fd90>
|
98
|
+
#<Puree::Model::Dataset:0xa5e8c24>
|
99
|
+
```
|
100
|
+
|
101
|
+
Fetch a random resource from the entire collection.
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
random_dataset = collection_extractor.random_resource
|
105
|
+
# =>
|
106
|
+
#<Puree::Model::Dataset:0x97998bc>
|
107
|
+
```
|
data/lib/puree.rb
CHANGED
@@ -1,30 +1,75 @@
|
|
1
1
|
require 'http'
|
2
2
|
require 'nokogiri'
|
3
|
-
|
4
|
-
require 'puree/date'
|
5
|
-
require 'puree/map'
|
6
|
-
require 'puree/resource'
|
7
|
-
require 'puree/dataset'
|
8
|
-
require 'puree/event'
|
9
|
-
require 'puree/journal'
|
10
|
-
require 'puree/organisation'
|
11
|
-
require 'puree/person'
|
12
|
-
require 'puree/project'
|
13
|
-
require 'puree/publication'
|
14
|
-
require 'puree/publisher'
|
15
|
-
require 'puree/collection'
|
16
|
-
require 'puree/download'
|
17
|
-
require 'puree/server'
|
3
|
+
|
18
4
|
require 'puree/version'
|
19
5
|
|
20
|
-
|
21
|
-
|
22
|
-
|
6
|
+
require 'puree/util/date'
|
7
|
+
|
8
|
+
require 'puree/xml_extractor/shared'
|
9
|
+
require 'puree/xml_extractor/base'
|
10
|
+
require 'puree/xml_extractor/collection'
|
11
|
+
require 'puree/xml_extractor/resource'
|
12
|
+
require 'puree/xml_extractor/dataset'
|
13
|
+
require 'puree/xml_extractor/download'
|
14
|
+
require 'puree/xml_extractor/event'
|
15
|
+
require 'puree/xml_extractor/journal'
|
16
|
+
require 'puree/xml_extractor/organisation'
|
17
|
+
require 'puree/xml_extractor/person'
|
18
|
+
require 'puree/xml_extractor/project'
|
19
|
+
require 'puree/xml_extractor/publication'
|
20
|
+
require 'puree/xml_extractor/publisher'
|
21
|
+
require 'puree/xml_extractor/server'
|
22
|
+
|
23
|
+
require 'puree/api/map'
|
24
|
+
require 'puree/api/request'
|
25
|
+
require 'puree/api/configuration'
|
26
|
+
require 'puree/api/authentication'
|
23
27
|
|
24
|
-
|
28
|
+
require 'puree/model/helper/validation'
|
29
|
+
require 'puree/model/structure'
|
25
30
|
|
26
|
-
|
31
|
+
require 'puree/model/resource'
|
32
|
+
require 'puree/model/dataset'
|
33
|
+
require 'puree/model/download_header'
|
34
|
+
require 'puree/model/event'
|
35
|
+
require 'puree/model/event_header'
|
36
|
+
require 'puree/model/journal'
|
37
|
+
require 'puree/model/link'
|
38
|
+
require 'puree/model/organisation'
|
39
|
+
require 'puree/model/person'
|
40
|
+
require 'puree/model/project'
|
41
|
+
require 'puree/model/publication'
|
42
|
+
require 'puree/model/publisher'
|
43
|
+
require 'puree/model/related_content_header'
|
44
|
+
require 'puree/model/spatial_point'
|
27
45
|
|
28
|
-
|
46
|
+
require 'puree/model/address'
|
47
|
+
require 'puree/model/copyright_license'
|
48
|
+
require 'puree/model/event_header'
|
49
|
+
require 'puree/model/file'
|
50
|
+
require 'puree/model/legal_condition'
|
51
|
+
require 'puree/model/organisation_header'
|
52
|
+
require 'puree/model/endeavour_person'
|
53
|
+
require 'puree/model/person_name'
|
54
|
+
require 'puree/model/publication_status'
|
55
|
+
require 'puree/model/server'
|
56
|
+
require 'puree/model/temporal_range'
|
57
|
+
|
58
|
+
require 'puree/extractor/resource'
|
59
|
+
require 'puree/extractor/dataset'
|
60
|
+
require 'puree/extractor/event'
|
61
|
+
require 'puree/extractor/journal'
|
62
|
+
require 'puree/extractor/organisation'
|
63
|
+
require 'puree/extractor/person'
|
64
|
+
require 'puree/extractor/project'
|
65
|
+
require 'puree/extractor/publication'
|
66
|
+
require 'puree/extractor/publisher'
|
67
|
+
require 'puree/extractor/collection'
|
68
|
+
require 'puree/extractor/download'
|
69
|
+
require 'puree/extractor/server'
|
70
|
+
|
71
|
+
# Metadata extraction from the Pure Research Information System.
|
72
|
+
#
|
73
|
+
module Puree
|
29
74
|
|
30
75
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Puree
|
2
|
+
|
3
|
+
module API
|
4
|
+
|
5
|
+
# Mixin to configure authentication.
|
6
|
+
#
|
7
|
+
module Authentication
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# Configure a Pure host for API access.
|
12
|
+
#
|
13
|
+
# @param config [Hash]
|
14
|
+
# @option config [String] :url The URL of the Pure host.
|
15
|
+
# @option config [String] :username The username of the Pure host account.
|
16
|
+
# @option config [String] :password The password of the Pure host account.
|
17
|
+
def configure_api(config)
|
18
|
+
@config = Puree::API::Configuration.new url: config[:url]
|
19
|
+
@config.basic_auth username: config[:username],
|
20
|
+
password: config[:password]
|
21
|
+
|
22
|
+
@request = Puree::API::Request.new url: @config.url
|
23
|
+
if @config.basic_auth?
|
24
|
+
@request.basic_auth username: @config.username,
|
25
|
+
password: @config.password
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Puree
|
2
|
+
|
3
|
+
module API
|
4
|
+
|
5
|
+
# Configuration for Pure host and credentials.
|
6
|
+
#
|
7
|
+
class Configuration
|
8
|
+
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :url
|
11
|
+
|
12
|
+
# @return [String, nil]
|
13
|
+
attr_reader :username
|
14
|
+
|
15
|
+
# @return [String, nil]
|
16
|
+
attr_reader :password
|
17
|
+
|
18
|
+
def initialize(url:)
|
19
|
+
raise 'Missing URL in configuration' if !url
|
20
|
+
@url = url
|
21
|
+
end
|
22
|
+
|
23
|
+
# Provide Basic Authentication credentials if required
|
24
|
+
#
|
25
|
+
# @param username [String]
|
26
|
+
# @param password [String]
|
27
|
+
def basic_auth(username:, password:)
|
28
|
+
@username = username
|
29
|
+
@password = password
|
30
|
+
msg = 'Credentials incomplete in configuration'
|
31
|
+
raise msg if username && !password
|
32
|
+
raise msg if password && !username
|
33
|
+
end
|
34
|
+
|
35
|
+
def basic_auth?
|
36
|
+
@username && @password
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Puree
|
2
|
+
|
3
|
+
module API
|
4
|
+
|
5
|
+
# Pure endpoints and corresponding XML root element in response.
|
6
|
+
#
|
7
|
+
class Map
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@convention = %w(
|
11
|
+
event
|
12
|
+
journal
|
13
|
+
organisation
|
14
|
+
person
|
15
|
+
project
|
16
|
+
publication
|
17
|
+
publisher
|
18
|
+
)
|
19
|
+
|
20
|
+
@api_map = {
|
21
|
+
resource_type: {
|
22
|
+
dataset: {
|
23
|
+
service: 'datasets',
|
24
|
+
response: 'GetDataSetsResponse',
|
25
|
+
family: 'dk.atira.pure.modules.datasets.external.model.dataset.DataSet'
|
26
|
+
},
|
27
|
+
download: {
|
28
|
+
service: 'downloadcount',
|
29
|
+
response: 'GetDownloadCountResponse'
|
30
|
+
},
|
31
|
+
server: {
|
32
|
+
service: 'servermeta',
|
33
|
+
response: 'GetServerMetaResponse'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
add_convention
|
39
|
+
# add_family
|
40
|
+
end
|
41
|
+
|
42
|
+
# Gets endpoints with their corresponding XML response names.
|
43
|
+
#
|
44
|
+
# @return [Hash]
|
45
|
+
def get
|
46
|
+
@api_map
|
47
|
+
end
|
48
|
+
|
49
|
+
# Endpoint for resource type.
|
50
|
+
#
|
51
|
+
# @param resource_type [Symbol]
|
52
|
+
# @return [String, nil]
|
53
|
+
def service_name(resource_type)
|
54
|
+
@api_map[:resource_type][resource_type][:service]
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def add_convention
|
60
|
+
@convention.each do |c|
|
61
|
+
resource_type = {}
|
62
|
+
resource_type[:service] = c
|
63
|
+
resource_type[:response] = 'Get' + c.capitalize + 'Response'
|
64
|
+
@api_map[:resource_type][c.to_sym] = resource_type
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# def add_family
|
69
|
+
# @api_map[:resource_type][:event][:family] = 'dk.atira.pure.api.shared.model.event.Event'
|
70
|
+
# end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|