Sha256: 393df3a3454cc0f9dfc03503b20e299e65a1ad3def6d9714c3b255991a3c8ef2

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module Troo
  module External
    class Board < Resource
      class << self
        def fetch(external_id, options = {})
          new(external_id, options).fetch_by_external_id.map do |resource|
            BoardPersistence.for(resource) unless closed?(resource)
          end
        end

        def fetch_all
          new.fetch_all.map do |resource|
            BoardPersistence.for(resource) unless closed?(resource)
          end
        end
      end

      def initialize(external_id = nil, options = {})
        @external_id = external_id
        @options     = options
      end

      def fetch_by_external_id
        [Trello::Board.find(external_id)]
      rescue Trello::InvalidAccessToken
        raise Troo::InvalidAccessToken
      rescue Trello::Error
        []
      end

      def fetch_all
        Trello::Board.all
      rescue Trello::InvalidAccessToken
        raise Troo::InvalidAccessToken
      rescue Trello::Error
        []
      end

      private
      attr_reader :external_id
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/external/board.rb
troo-0.0.6 lib/troo/external/board.rb
troo-0.0.5 lib/troo/external/board.rb