Sha256: d235404eec1c7e9c49473a29a3b9679f9cdb01648fef91833cef9a26aba65407

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

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

      attribute :id
      attribute :name
      attribute :desc
      attribute :descData
      attribute :closed,        Boolean
      attribute :idOrganization
      attribute :pinned
      attribute :url
      attribute :shortUrl
      attribute :prefs
      attribute :labelNames
      attribute :lists,         Array[Troo::Remote::List]
      attribute :cards,         Array[Troo::Remote::Card]
      attribute :members,       Array[Troo::Remote::Member]

      class << self
        def remote_options
          { mode: :board }
        end

        def all
          {
            endpoint: :boards_all,
            query:    { filter: :open }
          }
        end

        def by_board_id
          {
            endpoint: :board_by_id,
            query:    {
                        cards:   :open,
                        lists:   :open,
                        members: :all
                      }
          }
        end
      end

      def associations
        [:lists, :cards, :members]
      end

      def local_model
        Troo::Board
      end

      def adapted
        {
          external_id: id,
          name:        name,
          description: desc,
          closed:      closed
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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