Class: URIHelper::URIBuilder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/uri_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ URIBuilder

Returns a new instance of URIBuilder.



13
14
15
# File 'lib/uri_helper.rb', line 13

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



10
11
12
# File 'lib/uri_helper.rb', line 10

def options
  @options
end

Instance Method Details

#build_url(endpoint) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/uri_helper.rb', line 18

def build_url(endpoint)
  api = @options.api_url_base
  if endpoint == 'download_config_specs' && !@options.api_url_download_config_specs.nil?
    api = T.must(@options.api_url_download_config_specs)
  end
  unless api.end_with?('/')
    api += '/'
  end
  "#{api}#{endpoint}"
end