Class: Restspec::Endpoints::URLBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/restspec/endpoints/url_builder.rb

Constant Summary collapse

PARAM_INTERPOLATION_REGEX =
/:([\w]+)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = '', url_params = {}, query_params = {}) ⇒ URLBuilder

Returns a new instance of URLBuilder.



8
9
10
11
12
# File 'lib/restspec/endpoints/url_builder.rb', line 8

def initialize(path = '', url_params = {}, query_params = {})
  self.path = path
  self.url_params = unbox_url_params(url_params)
  self.query_params = query_params
end

Instance Attribute Details

#url_paramsObject

Returns the value of attribute url_params.



4
5
6
# File 'lib/restspec/endpoints/url_builder.rb', line 4

def url_params
  @url_params
end

Instance Method Details

#full_urlObject



14
15
16
# File 'lib/restspec/endpoints/url_builder.rb', line 14

def full_url
  base_url + path_from_params + query_string
end