Sha256: 30e9fe67973a8bc1959d27b55718331dbb30a93752439ba9ee7f2d3f46d4cb96

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

module Troo
  module Adaptors
    class Comment < Resource
      def adapted
        {
          external_comment_id: external_comment_id,
          external_board_id:   external_board_id,
          external_card_id:    external_card_id,
          external_member_id:  external_member_id,
          date:                date,
          text:                text
        }
      end

      private

      def external_comment_id
        resource.id
      end

      def external_board_id
        resource.data.fetch('board', {}).fetch('id', '')
      end

      def external_card_id
        resource.data.fetch('card', {}).fetch('id', '')
      end

      def external_member_id
        resource.member_creator_id
      end

      def date
        resource.date.to_s
      end

      def text
        resource.data.fetch('text', '')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/adaptors/comment.rb