lib/ragoon/services.rb in ragoon-0.7.0 vs lib/ragoon/services.rb in ragoon-0.8.0

- old
+ new

@@ -33,6 +33,21 @@ def base_endpoint endpoint = URI(@options[:endpoint]) "#{endpoint.scheme}://#{endpoint.host}#{endpoint.path}" end + def parse_time(str) + return nil if str.nil? + Time.parse(str).localtime + end + + def to_date_str(time) + return nil if time.nil? + time.localtime.strftime('%F') + end + + def to_datetime_str(time) + return nil if time.nil? + time.utc.strftime('%FT%TZ') + end + end