Class: CollectionJSON::Query

Inherits:
Attribute show all
Defined in:
lib/collection-json/attributes/query.rb

Instance Method Summary collapse

Methods inherited from Attribute

attribute, from_hash, nested_attributes, root_node, #to_hash, #to_json

Instance Method Details

#build(params = {}) ⇒ Object



15
16
17
18
19
# File 'lib/collection-json/attributes/query.rb', line 15

def build(params = {})
  URI(href).tap do |uri|
    uri.query = add_query_params(uri.query || '', params)
  end.to_s.gsub(/\?$/, '')
end