HabitatMap/AirCasting

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

Summary

Maintainability
A
0 mins
Test Coverage
class Api::ToUserSessionsHash
  def initialize(form:)
    @form = form
  end

  def call(user)
    return Failure.new(form.errors) if form.invalid?

    Success.new(user.sync(form.to_h.data.map(&:to_h)))
  end

  private

  attr_reader :form
end