Class: Puree::Project
Overview
Project resource
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#acronym ⇒ String
Acronym.
-
#description ⇒ String
Description.
-
#initialize(endpoint: nil, username: nil, password: nil, basic_auth: nil) ⇒ Project
constructor
A new instance of Project.
-
#metadata ⇒ Hash
All metadata.
-
#organisation ⇒ Array<Hash>
Organisation.
-
#owner ⇒ Hash
Owner.
-
#person ⇒ Array<Hash>
Person (internal, external, other).
-
#status ⇒ String
Status.
-
#temporal ⇒ Hash
Temporal, expected and actual start and end dates as UTC datetime.
-
#title ⇒ String
Title.
-
#type ⇒ String
Type.
-
#url ⇒ String
URL.
Methods inherited from Resource
#content, #created, #get, #modified, #set_content, #uuid
Constructor Details
#initialize(endpoint: nil, username: nil, password: nil, basic_auth: nil) ⇒ Project
Returns a new instance of Project.
11 12 13 14 15 16 17 18 |
# File 'lib/puree/project.rb', line 11 def initialize(endpoint: nil, username: nil, password: nil, basic_auth: nil) super(api: :project, endpoint: endpoint, username: username, password: password, bleeding: false, basic_auth: basic_auth) end |
Instance Method Details
#acronym ⇒ String
Acronym
25 26 27 28 |
# File 'lib/puree/project.rb', line 25 def acronym path = '/acronym' xpath_query_for_single_value path end |
#description ⇒ String
Description
33 34 35 36 |
# File 'lib/puree/project.rb', line 33 def description path = '/description/localizedString' xpath_query_for_single_value path end |
#metadata ⇒ Hash
All metadata
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/puree/project.rb', line 169 def o = super o['acronym'] = acronym o['description'] = description o['organisation'] = organisation o['owner'] = owner o['person'] = person o['status'] = status o['temporal'] = temporal o['title'] = title o['type'] = type o['url'] = url o end |
#organisation ⇒ Array<Hash>
Organisation
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puree/project.rb', line 41 def organisation path = '/organisations/association/organisation' xpath_result = xpath_query path data = [] xpath_result.each do |i| o = {} o['uuid'] = i.xpath('@uuid').text.strip o['name'] = i.xpath('name/localizedString').text.strip o['type'] = i.xpath('typeClassification/term/localizedString').text.strip data << o end data end |
#owner ⇒ Hash
Owner
58 59 60 61 62 63 64 65 66 |
# File 'lib/puree/project.rb', line 58 def owner path = '/owner' xpath_result = xpath_query path o = {} o['uuid'] = xpath_result.xpath('@uuid').text.strip o['name'] = xpath_result.xpath('name/localizedString').text.strip o['type'] = xpath_result.xpath('typeClassification/term/localizedString').text.strip o end |
#person ⇒ Array<Hash>
Person (internal, external, other)
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/puree/project.rb', line 71 def person data = {} # internal path = '/persons/participantAssociation' xpath_result = xpath_query path internal = [] external = [] other = [] xpath_result.each do |i| o = {} name = {} name['first'] = i.xpath('person/name/firstName').text.strip name['last'] = i.xpath('person/name/lastName').text.strip o['name'] = name o['role'] = i.xpath('personRole/term/localizedString').text.strip uuid_internal = i.at_xpath('person/@uuid') uuid_external = i.at_xpath('externalPerson/@uuid') if uuid_internal o['uuid'] = uuid_internal internal << o elsif uuid_external o['uuid'] = uuid_external external << o else other << o o['uuid'] = '' end end data['internal'] = internal data['external'] = external data['other'] = other data end |
#status ⇒ String
Status
110 111 112 113 |
# File 'lib/puree/project.rb', line 110 def status path = '/status/term/localizedString' xpath_query_for_single_value path end |
#temporal ⇒ Hash
Temporal, expected and actual start and end dates as UTC datetime.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/puree/project.rb', line 118 def temporal o = {} o['expected'] = {} o['actual'] = {} path = '/expectedStartDate' xpath_result = xpath_query path o['expected']['start'] = xpath_result.text.strip path = '/expectedEndDate' xpath_result = xpath_query path o['expected']['end'] = xpath_result.text.strip path = '/startFinishDate/startDate' xpath_result = xpath_query path o['actual']['start'] = xpath_result.text.strip path = '/startFinishDate/endDate' xpath_result = xpath_query path o['actual']['end'] = xpath_result.text.strip o end |
#title ⇒ String
Title
145 146 147 148 |
# File 'lib/puree/project.rb', line 145 def title path = '/title/localizedString' xpath_query_for_single_value path end |
#type ⇒ String
Type
153 154 155 156 |
# File 'lib/puree/project.rb', line 153 def type path = '/typeClassification/term/localizedString' xpath_query_for_single_value path end |
#url ⇒ String
URL
161 162 163 164 |
# File 'lib/puree/project.rb', line 161 def url path = '/projectURL' xpath_query_for_single_value path end |