Class: URIHelper::URIBuilder

Inherits:
Object
  • Object
show all
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.



6
7
8
# File 'lib/uri_helper.rb', line 6

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/uri_helper.rb', line 4

def options
  @options
end

Instance Method Details

#build_url(endpoint) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/uri_helper.rb', line 10

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