Sha256: ba5adaa6ef757a37bd52b01d6c279c40636c514044f6dda7a6401034e13a317c

Contents?: true

Size: 1.61 KB

Versions: 2

Compression:

Stored size: 1.61 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
        def remote_options
          { mode: :member }
        end

        def by_board_id
          {
            endpoint: :members_by_board_id,
            query:    { filter: :all }
          }
        end

        def by_member_id
          { endpoint: :member_by_id }
        end
      end

      def associations
        []
      end

      def local_model
        Troo::Member
      end

      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

2 entries across 2 versions & 1 rubygems

Version Path
troo-0.0.10 lib/troo/remote/member.rb
troo-0.0.9 lib/troo/remote/member.rb