Method: Seahorse::Client::Plugins::Endpoint#after_initialize

Defined in:
lib/seahorse/client/plugins/endpoint.rb

#after_initialize(client) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/seahorse/client/plugins/endpoint.rb', line 26

def after_initialize(client)
  endpoint = client.config.endpoint
  if endpoint.nil?
    msg = "missing required option `:endpoint'"
    raise ArgumentError, msg
  end

  endpoint = URI.parse(endpoint.to_s)
  if URI::HTTPS === endpoint or URI::HTTP === endpoint
    client.config.endpoint = endpoint
  else
    msg = 'expected :endpoint to be a HTTP or HTTPS endpoint'
    raise ArgumentError, msg
  end
end