Sha256: 01d0a856f7aa4b1f20268171a3152aa548f5af22aca6ee7c0bee6eab95f9d131

Contents?: true

Size: 732 Bytes

Versions: 7

Compression:

Stored size: 732 Bytes

Contents

require 'apiture/swagger/node'
require 'apiture/swagger/operation'

module Apiture
  module Swagger
    class Path < Node
      attr_reader :id
      alias :path_name :id

      REQUEST_METHODS = [:get, :put, :post, :delete, :options, :head, :patch]

      REQUEST_METHODS.each do |m|
        attribute m, validate: true
      end

      list :parameters, validate: true

      def initialize(id)
        super()
        @id = id
      end

      def operations
        REQUEST_METHODS.map { |m| __send__(m) }.compact
      end

      def operations_map
        REQUEST_METHODS.reduce({}) do |m, method|
          if op = __send__(method)
            m[method] = op
          end
          m
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
apiture-0.2.6 lib/apiture/swagger/path.rb
apiture-0.2.5 lib/apiture/swagger/path.rb
apiture-0.2.4 lib/apiture/swagger/path.rb
apiture-0.2.3 lib/apiture/swagger/path.rb
apiture-0.2.2 lib/apiture/swagger/path.rb
apiture-0.2.1 lib/apiture/swagger/path.rb
apiture-0.2.0 lib/apiture/swagger/path.rb