HabitatMap/AirCasting

View on GitHub
app/services/api/to_threshold_alerts_array.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Api
  class ToThresholdAlertsArray
    def initialize(alerts:)
      @alerts = alerts
    end

    def call
      alerts.map do |alert|
        {
          id: alert.id,
          session_uuid: alert.session_uuid,
          sensor_name: alert.sensor_name,
          threshold_value: alert.threshold_value,
          frequency: alert.frequency,
          timezone_offset: alert.timezone_offset,
        }
      end
    end

    private

    attr_reader :alerts
  end
end