Sha256: 1459f1f67217cef939da1bdf92c6b92484b9f113446d9fc55b06a73d2f2e92d4

Contents?: true

Size: 541 Bytes

Versions: 10

Compression:

Stored size: 541 Bytes

Contents

module DceLti
  class UserInitializer
    TOOL_PROVIDER_ATTRIBUTES = %i|
    roles
    lis_person_contact_email_primary
    lis_person_name_family
    lis_person_name_full
    lis_person_name_given
    lis_person_sourcedid
    user_image
    |

    def self.find_from(tool_provider)
      User.find_or_create_by(lti_user_id: tool_provider.user_id).tap do |user|
        TOOL_PROVIDER_ATTRIBUTES.each do |attribute|
          user.send("#{attribute}=", tool_provider.send(attribute))
        end
        user.save
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dce_lti-0.6.1 app/services/dce_lti/user_initializer.rb
dce_lti-0.6.0 app/services/dce_lti/user_initializer.rb
dce_lti-0.5.4 app/services/dce_lti/user_initializer.rb
dce_lti-0.5.3 app/services/dce_lti/user_initializer.rb
dce_lti-0.5.2 app/services/dce_lti/user_initializer.rb
dce_lti-0.5.1 app/services/dce_lti/user_initializer.rb
dce_lti-0.5.0 app/services/dce_lti/user_initializer.rb
dce_lti-0.4.0 app/services/dce_lti/user_initializer.rb
dce_lti-0.3.0 app/services/dce_lti/user_initializer.rb
dce_lti-0.2.0 app/services/dce_lti/user_initializer.rb