Class: Concourse::SubClients::SkymarshalClient

Inherits:
Object
  • Object
show all
Includes:
Http
Defined in:
lib/concourse/sub_clients/skymarshal_client.rb

Constant Summary collapse

VERSION_6_1 =
Semantic::Version.new('6.1.0')

Instance Method Summary collapse

Methods included from Http

#assert_successful

Constructor Details

#initialize(options) ⇒ SkymarshalClient

Returns a new instance of SkymarshalClient.



16
17
18
19
# File 'lib/concourse/sub_clients/skymarshal_client.rb', line 16

def initialize(options)
  @url = options[:url]
  @version = Semantic::Version.new(options[:version])
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
# File 'lib/concourse/sub_clients/skymarshal_client.rb', line 33

def ==(other)
  other.class == self.class && other.state == state
end

#create_token(parameters) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/concourse/sub_clients/skymarshal_client.rb', line 21

def create_token(parameters)
  url = create_token_url
  headers = create_token_headers
  body = create_token_body(parameters)

  token_request = Http::Request.new(url, headers, body)
  token_response = Excon.post(url, headers: headers, body: body)

  assert_successful(token_request, token_response)
  token(token_response)
end