Class: Etna::Clients::Polyphemus

Inherits:
BaseClient show all
Defined in:
lib/etna/clients/polyphemus/client.rb,
lib/etna/clients/polyphemus/models.rb,
lib/etna/clients/polyphemus/workflows/set_configuration_workflow.rb

Defined Under Namespace

Classes: ConfigurationRequest, ConfigurationResponse, EnvironmentConfiguration, JobType, RedcapJobRequest, SetConfigurationWorkflow

Instance Attribute Summary

Attributes inherited from BaseClient

#host, #ignore_ssl, #token

Instance Method Summary collapse

Methods inherited from BaseClient

#initialize, #token_expired?, #token_will_expire?

Constructor Details

This class inherits a constructor from Etna::Clients::BaseClient

Instance Method Details

#configuration(configuration_request = ConfigurationRequest.new) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/etna/clients/polyphemus/client.rb', line 10

def configuration(configuration_request = ConfigurationRequest.new)
  json = nil
  @etna_client.get(
    "/configuration",
    configuration_request) do |res|
    json = JSON.parse(res.body, symbolize_names: true)
  end

  ConfigurationResponse.new(json)
end

#job(job_request = JobRequest.new) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/etna/clients/polyphemus/client.rb', line 21

def job(job_request = JobRequest.new)
  # Because this is a streaming response, just yield the response back.
  #   The consumer will have to iterate over the response.read_body, like
  #
  # polyphemus_client.job(request) do |response|
  #   response.read_body do |fragment|
  #     <fragment contains a chunk of text streamed back from the server>
  #   end
  # end
  @etna_client.post(
    "/#{job_request.project_name}/job",
    job_request) do |res|
      yield res
  end
end