Class: UriQueryMerger

Inherits:
Object
  • Object
show all
Defined in:
lib/uri_query_merger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, params) ⇒ UriQueryMerger

Returns a new instance of UriQueryMerger.



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

def initialize(uri, params)
  @params = params
  @uri    = uri
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/uri_query_merger.rb', line 3

def params
  @params
end

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/uri_query_merger.rb', line 3

def uri
  @uri
end

Instance Method Details

#mergeObject



10
11
12
13
14
# File 'lib/uri_query_merger.rb', line 10

def merge
  new_uri = URI.parse(uri)
  new_uri.query = merged_query
  new_uri.to_s
end