Class: Psc::Client
- Inherits:
-
Object
- Object
- Psc::Client
- Defined in:
- lib/psc/client.rb
Overview
A high-level interface to a PSC instance's API. This class does not expose everything you can do with the API — only a few of the more common elements. Refer to the API documentation and use Connection for complete access.
Instance Attribute Summary collapse
-
#connection ⇒ Psc::Connection
readonly
The connection that the client is using to access PSC.
Instance Method Summary collapse
-
#initialize(url, options, &block) ⇒ Client
constructor
Create a new client instance.
-
#studies ⇒ Array<Hash>
Returns an array of hashes describing the studies in the system.
Constructor Details
#initialize(url, options, &block) ⇒ Client
Create a new client instance. The given url and options will be used to create a Psc::Connection for the client to use; see that class for more details about what is permitted
21 22 23 |
# File 'lib/psc/client.rb', line 21 def initialize(url, , &block) @connection = Psc::Connection.new(url, , &block) end |
Instance Attribute Details
#connection ⇒ Psc::Connection (readonly)
The connection that the client is using to access PSC. Use it to make requests that the high-level interface doesn't support.
15 16 17 |
# File 'lib/psc/client.rb', line 15 def connection @connection end |
Instance Method Details
#studies ⇒ Array<Hash>
Returns an array of hashes describing the studies in the system.
The contents are from the JSON representation of the /studies
resource.
31 32 33 |
# File 'lib/psc/client.rb', line 31 def studies connection.get('studies.json').body['studies'] end |