Class: OpenpayUtils::SearchParams
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- OpenpayUtils::SearchParams
- Defined in:
- lib/openpay/utils/search_params.rb
Instance Method Summary collapse
-
#to_str ⇒ Object
(also: #to_s)
“?creation=2013-11-01&limit=2&amount=100”.
Instance Method Details
#to_str ⇒ Object Also known as: to_s
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/openpay/utils/search_params.rb', line 8 def to_str filter = '?' self.marshal_dump.each do |attribute, value| if attribute =~ /(\w+)_(gte|lte)/ square_bracket_open_encode = CGI.escape('[') square_bracket_close_encode = CGI.escape(']') attribute = "#{$1}#{square_bracket_open_encode}#{$2}#{square_bracket_close_encode}" end filter << "#{attribute}=#{value}&" end filter.sub(/\&$/, '') end |