Class: Lookbook::SearchParamEncoder

Inherits:
Service
  • Object
show all
Defined in:
lib/lookbook/services/urls/search_param_encoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(data) ⇒ SearchParamEncoder

Returns a new instance of SearchParamEncoder.



7
8
9
# File 'lib/lookbook/services/urls/search_param_encoder.rb', line 7

def initialize(data)
  @data = data.to_h
end

Instance Attribute Details

#dataObject (readonly)



5
6
7
# File 'lib/lookbook/services/urls/search_param_encoder.rb', line 5

def data
  @data
end

Instance Method Details

#callObject



11
12
13
14
# File 'lib/lookbook/services/urls/search_param_encoder.rb', line 11

def call
  json = JSON.generate(data)
  CGI.escape(json)
end