module Urbanairship::Util

Public Instance Methods

time_format(datetime) click to toggle source

@return [String] the datetime formatted as expected by the API

# File lib/urbanairship/util.rb, line 11
def time_format(datetime)
  datetime.strftime('%Y-%m-%dT%H:%M:%S')
end
validate(obj, name, regex) click to toggle source

@raise [ArgumentError] unless obj matches the pattern.

# File lib/urbanairship/util.rb, line 6
def validate(obj, name, regex)
  fail ArgumentError, "#{obj} isn't a valid #{name}" unless obj =~ regex
end