Sha256: 37fbd1248a9c5b15543b5dccb5796ccca566da77c132e2a8133a42636ec5bbe0

Contents?: true

Size: 1015 Bytes

Versions: 2

Compression:

Stored size: 1015 Bytes

Contents

module Troo
  module API
    class Endpoints
      include Virtus.value_object

      values do
        attribute :board_by_id
        attribute :boards_all
        attribute :card_by_id
        attribute :cards_by_board_id
        attribute :cards_by_list_id
        attribute :comments_by_board_id
        attribute :comments_by_card_id
        attribute :comments_by_list_id
        attribute :create_board
        attribute :create_card
        attribute :create_comment
        attribute :create_list
        attribute :list_by_id
        attribute :lists_by_board_id
        attribute :member_by_id
        attribute :members_by_board_id
        attribute :move_card_board
        attribute :move_card_list
      end

      class << self
        def load(file, version)
          new(YAML.load_file(file)[version.to_s])
        end
      end

      def interpolate!(endpoint, value = {})
        return send(endpoint) % value if respond_to?(endpoint)
        fail EndpointNotFound
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troo-0.0.10 lib/troo/api/endpoints.rb
troo-0.0.9 lib/troo/api/endpoints.rb