Sha256: 55e653b7b7f986d8e80bad5eec9be9a4da9a6ce036ae9d75e2ead3f250f4c0be

Contents?: true

Size: 540 Bytes

Versions: 4

Compression:

Stored size: 540 Bytes

Contents

module OpenStax
  module Accounts
    class FindOrCreateFromSso

      lev_routine express_output: :account

      def exec(attrs)
        attrs.stringify_keys!
        uid = attrs.delete('id')
        uuid = attrs.delete('uuid')
        account = Account.find_or_initialize_by(
          uuid: uuid, openstax_uid: uid
        )
        account.update_attributes!(
          attrs.slice(*Account.column_names)
        )
        transfer_errors_from(account, {type: :verbatim})
        outputs.account = account
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
openstax_accounts-8.1.1 app/routines/openstax/accounts/find_or_create_from_sso.rb
openstax_accounts-8.1.0 app/routines/openstax/accounts/find_or_create_from_sso.rb
openstax_accounts-8.0.1 app/routines/openstax/accounts/find_or_create_from_sso.rb
openstax_accounts-8.0.0 app/routines/openstax/accounts/find_or_create_from_sso.rb