Class: Server
- Inherits:
-
NesstarObject
- Object
- NesstarObject
- Server
- Defined in:
- lib/nesstar-api/server.rb
Overview
Represents the server.
Instance Method Summary collapse
-
#get_studies ⇒ Object
Get a list of studies on the server.
-
#get_study(id) ⇒ Object
Get a particular study identified by its ID.
Instance Method Details
#get_studies ⇒ Object
Get a list of studies on the server.
10 11 12 13 14 15 |
# File 'lib/nesstar-api/server.rb', line 10 def get_studies json_studies = get_values "studies" json_studies.collect do | study | Study.new study end end |
#get_study(id) ⇒ Object
Get a particular study identified by its ID.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nesstar-api/server.rb', line 19 def get_study(id) json = get_values "study/#{id}" if json study_id = dig(json, :ID) name = dig(json, :stdyDscr, :citation, :titlStmt, :titl) abstract = dig(json, :stdyDscr, :stdyInfo, :abstract) Study.new({'id' => study_id, 'name' => name, 'abstract' => abstract}) end end |