Sha256: e5d8cc34dda4b5cf1c39c9b0ddbf28511d3504a948c4f5a4d1af5df7f5e9029a

Contents?: true

Size: 1.63 KB

Versions: 15

Compression:

Stored size: 1.63 KB

Contents

# frozen_string_literal: true

module Meibo
  class UserProfile
    DataModel.define(
      self,
      attribute_name_to_header_field_map: {
        sourced_id: "sourcedId",
        status: "status",
        date_last_modified: "dateLastModified",
        user_sourced_id: "userSourcedId",
        profile_type: "profileType",
        vendor_id: "vendorId",
        application_id: "applicationId",
        description: "description",
        credential_type: "credentialType",
        username: "username",
        password: "password"
      },
      converters: {
        datetime: [:date_last_modified],
        required: %i[sourced_id user_sourced_id profile_type vendor_id credential_type username],
        status: [:status]
      }
    )

    def initialize(sourced_id:, user_sourced_id:, profile_type:, vendor_id:, credential_type:, username:, status: nil, date_last_modified: nil,
                   application_id: nil, description: nil, password: nil, **extension_fields)
      @sourced_id = sourced_id
      @status = status
      @date_last_modified = date_last_modified
      @user_sourced_id = user_sourced_id
      @profile_type = profile_type
      @vendor_id = vendor_id
      @application_id = application_id
      @description = description
      @credential_type = credential_type
      @username = username
      @password = password
      @extension_fields = extension_fields
    end

    def collection
      Meibo.current_roster.user_profiles
    end

    def user
      Meibo.current_roster.users.find(user_sourced_id)
    end

    def role
      Meibo.current_roster.roles.where(user_profile_sourced_id: sourced_id).first
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
meibo-0.27.1 lib/meibo/user_profile.rb
meibo-0.27.0 lib/meibo/user_profile.rb
meibo-0.26.0 lib/meibo/user_profile.rb
meibo-0.25.3 lib/meibo/user_profile.rb
meibo-0.25.2 lib/meibo/user_profile.rb
meibo-0.25.1 lib/meibo/user_profile.rb
meibo-0.25.0 lib/meibo/user_profile.rb
meibo-0.24.0 lib/meibo/user_profile.rb
meibo-0.23.0 lib/meibo/user_profile.rb
meibo-0.22.0 lib/meibo/user_profile.rb
meibo-0.21.0 lib/meibo/user_profile.rb
meibo-0.20.0 lib/meibo/user_profile.rb
meibo-0.19.0 lib/meibo/user_profile.rb
meibo-0.18.0 lib/meibo/user_profile.rb
meibo-0.17.0 lib/meibo/user_profile.rb