Sha256: 3dc414d9ea42b16d67229411502471ff1debfd9fb38a20dd052e11aa2b27bfdf

Contents?: true

Size: 1.76 KB

Versions: 3

Compression:

Stored size: 1.76 KB

Contents

module Troo
  module Remote
    class Member
      include Virtus.model(finalize: false)
      include Troo::RemoteModelHelpers

      attribute :id
      attribute :avatarHash
      attribute :bio
      attribute :bioData
      attribute :confirmed
      attribute :fullName
      attribute :idPremOrgsAdmin
      attribute :initials
      attribute :memberType
      attribute :products
      attribute :status
      attribute :url
      attribute :username
      attribute :avatarSource
      attribute :email
      attribute :gravatarHash
      attribute :idBoards
      attribute :idBoardsInvited
      attribute :idBoardsPinned
      attribute :idOrganizations
      attribute :idOrganizationsInvited
      attribute :loginTypes
      attribute :newEmail
      attribute :oneTimeMessagesDismissed
      attribute :prefs
      attribute :trophies
      attribute :uploadedAvatarHash
      attribute :premiumFeatures

      class << self
        # @return [Hash]
        def remote_options
          { mode: :member }
        end

        # @return [Hash]
        def by_board_id
          {
            endpoint: :members_by_board_id,
            query:    { filter: :all }
          }
        end

        # @return [Hash]
        def by_member_id
          { endpoint: :member_by_id }
        end
      end

      # @return [Array]
      def associations
        []
      end

      # @return [Troo::Member]
      def local_model
        Troo::Member
      end

      # @return [Hash]
      def adapted
        {
          external_id: id,
          username:    username,
          email:       email,
          full_name:   fullName,
          initials:    initials,
          avatar_id:   avatarHash,
          bio:         bio,
          url:         url
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.14 lib/troo/remote/member.rb
troo-0.0.13 lib/troo/remote/member.rb
troo-0.0.12 lib/troo/remote/member.rb