Sha256: 426548983567fd153b7bcab0be9531561a9cc84aef2f18166dd5b43ba30e458b

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

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
        # @param  [String]
        # @param  [String]
        # @return [Troo::API::Endpoints]
        def load(file, version)
          new(YAML.load_file(file)[version])
        end
      end

      # @param  [Symbol]
      # @param  [Hash]
      # @return [String, EndpointNotFound]
      def interpolate!(endpoint, value = {})
        return send(endpoint) % value if respond_to?(endpoint)
        fail EndpointNotFound
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.11 lib/troo/api/endpoints.rb