Sha256: f4194fa6bba075600fc14f7acd027e4c22892a3374454b823f670f5dd78462fc

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

module Troo
  module External
    class MemberAdaptor
      class << self
        def adapt(resource)
          new(resource).adapted
        end
      end

      def initialize(resource)
        @resource = resource
      end

      def adapted
        {
          external_member_id: external_member_id,
          username:           username,
          email:              email,
          full_name:          full_name,
          initials:           initials,
          avatar_id:          avatar_id,
          bio:                bio,
          url:                url,
        }
      end

      private
      attr_reader :resource

      def external_member_id
        resource.id
      end

      def username
        resource.username
      end

      def email
        resource.email
      end

      def full_name
        resource.full_name
      end

      def initials
        resource.initials
      end

      def avatar_id
        resource.avatar_id
      end

      def bio
        resource.bio
      end

      def url
        resource.url
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/external/member_adaptor.rb
troo-0.0.6 lib/troo/external/member_adaptor.rb
troo-0.0.5 lib/troo/external/member_adaptor.rb
troo-0.0.4 lib/troo/external/member_adaptor.rb
troo-0.0.3 lib/troo/external/member_adaptor.rb
troo-0.0.2 lib/troo/external/member_adaptor.rb