Sha256: 6b8d58f2d18e94b21feed08224f65cf863b9753eb90e5d206d27ff96eaa69988

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

require 'swagger/v2/api_operation'

module Swagger
  module V2
    class Path < DefinitionSection
      extend Forwardable
      def_delegator :parent, :host

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

      section :parameters, Array[Parameter]

      VERBS.each do | verb |
        section verb, APIOperation
      end

      def initialize(hash)
        hash[:parameters] ||= []
        super
      end

      def operations
        VERBS.each_with_object({}) do | v, h |
          operation = send v
          h[v] = operation if operation
        end
      end

      def uri_template
        "#{parent.host}#{parent.base_path}#{path}"
      end

      def path
        parent.paths.key self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
swagger-core-0.2.0 lib/swagger/v2/path.rb