-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce proper date formatting for Time params
- Loading branch information
Carlos Diaz-Padron
committed
Dec 23, 2013
1 parent
68614ff
commit 05cbb91
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
module Twilio | ||
module Util | ||
def url_encode(hash) | ||
hash.to_a.map {|p| p.map {|e| CGI.escape e.to_s}.join '='}.join '&' | ||
hash.to_a.map {|p| p.map {|e| CGI.escape get_string(e)}.join '='}.join '&' | ||
end | ||
|
||
def get_string(obj) | ||
if obj.respond_to?(:strftime) | ||
obj.strftime('%Y-%m-%d') | ||
else | ||
obj.to_s | ||
end | ||
end | ||
end | ||
end |