Sha256: 4e551bc61fa8ad94072b3d3af50e88d0a0fa286162075631fa5303edba9c1337

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

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

      attribute :id
      attribute :name
      attribute :closed,  Boolean
      attribute :idBoard
      attribute :pos,     Integer

      class << self
        # @return [Hash]
        def remote_options
          { mode: :list }
        end

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

        # @return [Hash]
        def by_list_id
          { endpoint: :list_by_id }
        end
      end

      # @return [Array]
      def associations
        []
      end

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

      # @return [Hash]
      def adapted
        {
          external_board_id: idBoard,
          external_id:       id,
          name:              name,
          position:          pos,
          closed:            closed
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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