Module: OpenSTF::Client

Defined in:
lib/openstf/client.rb

Defined Under Namespace

Classes: Service

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#serviceObject

Returns the value of attribute service.



9
10
11
# File 'lib/openstf/client.rb', line 9

def service
  @service
end

Class Method Details

.init(host:, token:) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/openstf/client.rb', line 10

def self.init(host:, token:)
  authentication_middleware_stack =
      [[
          Faraday::Request::TokenAuthentication,
          token
      ]]
  @service = Svelte::Service.create(
      url: "http://#{host}/api/v1/swagger.json",
      module_name: 'Internal',
      options: { middleware_stack: authentication_middleware_stack,
                 host: host}
  )
  self.module_eval("include #{@service}")
  return Service.new(@service)
end