Class: PagerDuty::Connection::ConvertTimesParametersToISO8601

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/pager_duty/connection.rb

Constant Summary collapse

TIME_KEYS =
[:since, :until]

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/pager_duty/connection.rb', line 94

def call(env)

  body = env[:body]
  unless body.nil?
    TIME_KEYS.each do |key|
      if body.has_key?(key)
        body[key] = body[key].iso8601 if body[key].respond_to?(:iso8601)
      end
    end
  end

  @app.call env
end