Class: ConstantContact::Util::Helpers
- Inherits:
-
Object
- Object
- ConstantContact::Util::Helpers
- Defined in:
- lib/constantcontact/util/helpers.rb
Class Method Summary collapse
-
.encode(str) ⇒ Object
Escape special characters.
-
.http_build_query(params) ⇒ String
Build the HTTP query from the given parameters.
Class Method Details
.encode(str) ⇒ Object
Escape special characters
21 22 23 |
# File 'lib/constantcontact/util/helpers.rb', line 21 def encode(str) CGI.escape(str).gsub('.', '%2E').gsub('-', '%2D') end |
.http_build_query(params) ⇒ String
Build the HTTP query from the given parameters
15 16 17 |
# File 'lib/constantcontact/util/helpers.rb', line 15 def http_build_query(params) params.collect{ |k,v| "#{k.to_s}=#{encode(v.to_s)}" }.reverse.join('&') end |