Module: Urbanairship::Util
- Defined in:
- lib/urbanairship/util.rb
Class Method Summary collapse
-
.time_format(datetime) ⇒ String
The datetime formatted as expected by the API.
- .validate(obj, name, regex) ⇒ Object
Class Method Details
.time_format(datetime) ⇒ String
Returns the datetime formatted as expected by the API.
11 12 13 |
# File 'lib/urbanairship/util.rb', line 11 def time_format(datetime) datetime.strftime('%Y-%m-%dT%H:%M:%S') end |
.validate(obj, name, regex) ⇒ Object
6 7 8 |
# File 'lib/urbanairship/util.rb', line 6 def validate(obj, name, regex) fail ArgumentError, "#{obj} isn't a valid #{name}" unless obj =~ regex end |