Sha256: e7c2623cebb5ebbb62a3729476031d61902574609aa513bc9f2cd6e504fe4fb3
Contents?: true
Size: 414 Bytes
Versions: 2
Compression:
Stored size: 414 Bytes
Contents
module OpenpayUtils class SearchParams < OpenStruct #"?creation[gte]=2013-11-01&limit=2&amount[lte]=100" def to_str filter = '?' self.marshal_dump.each do |attribute, value| if attribute =~ /(\w+)_(gte|lte)/ attribute = "#{$1}[#{$2}]" end filter << "#{attribute}=#{value}&" end filter.sub(/\&$/, '') end alias :to_s :to_str end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openpay-1.0.5 | lib/openpay/utils/search_params.rb |
openpay-1.0.4 | lib/openpay/utils/search_params.rb |