Sha256: d7ab16b64f93dff7e69426fd2e307a256ee7c96c1aa22ab2006885a2f82611b4

Contents?: true

Size: 620 Bytes

Versions: 7

Compression:

Stored size: 620 Bytes

Contents

module OasRails
  class PathItem
    attr_reader :path, :operations, :parameters

    def initialize(path:, operations:, parameters:)
      @path = path
      @operations = operations
      @parameters = parameters
    end

    def self.from_oas_routes(path:, oas_routes:)
      new(path: path, operations: oas_routes.map do |oas_route|
                                    Operation.from_oas_route(oas_route: oas_route)
                                  end, parameters: [])
    end

    def to_spec
      spec = {}
      @operations.each do |o|
        spec[o.method] = o.to_spec
      end
      spec
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
oas_rails-0.3.0 lib/oas_rails/path_item.rb
oas_rails-0.2.3 lib/oas_rails/path_item.rb
oas_rails-0.2.2 lib/oas_rails/path_item.rb
oas_rails-0.2.1 lib/oas_rails/path_item.rb
oas_rails-0.2.0 lib/oas_rails/path_item.rb
oas_rails-0.1.1 lib/oas_rails/path_item.rb
oas_rails-0.1.0 lib/oas_rails/path_item.rb