Class: Psc::Client

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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, options, &block)
  @connection = Psc::Connection.new(url, options, &block)
end

Instance Attribute Details

#connectionPsc::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.

Returns:



15
16
17
# File 'lib/psc/client.rb', line 15

def connection
  @connection
end

Instance Method Details

#studiesArray<Hash>

Returns an array of hashes describing the studies in the system. The contents are from the JSON representation of the /studies resource.

Returns:

  • (Array<Hash>)


31
32
33
# File 'lib/psc/client.rb', line 31

def studies
  connection.get('studies.json').body['studies']
end