Sha256: f6552d62f024be0c276eabc7b8fe8590436443a6be053faa1ac626f62cb1e692

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 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
        # @return [Hash]
        def remote_options
          { mode: :board }
        end

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

        # @return [Hash]
        def by_board_id
          {
            endpoint: :board_by_id,
            query:    {
                        cards:   :open,
                        lists:   :open,
                        members: :all
                      }
          }
        end
      end

      # @return [Hash]
      def associations
        [:lists, :cards, :members]
      end

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

      # @return [Hash]
      def adapted
        {
          external_id: id,
          name:        name,
          description: desc,
          closed:      closed
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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