class OasParser::Path
Attributes
owner[RW]
path[RW]
raw[RW]
Public Class Methods
new(owner, path, raw)
click to toggle source
# File lib/oas_parser/path.rb, line 5 def initialize(owner, path, raw) @owner = owner @path = path @raw = raw end
Public Instance Methods
callback()
click to toggle source
# File lib/oas_parser/path.rb, line 41 def callback owner if owner.class == OasParser::Callback end
definition()
click to toggle source
# File lib/oas_parser/path.rb, line 37 def definition owner if owner.class == OasParser::Definition end
endpoint_by_method(method)
click to toggle source
# File lib/oas_parser/path.rb, line 20 def endpoint_by_method(method) definition = raw[method] raise OasParser::MethodNotFound.new("HTTP method not found: '#{method}'") unless definition OasParser::Endpoint.new(self, method, definition) end
endpoints()
click to toggle source
# File lib/oas_parser/path.rb, line 11 def endpoints a = raw.map do |method, definition| next unless %w[get head post put patch delete trace options].include? method OasParser::Endpoint.new(self, method, definition) end a.compact end
parameter_keys()
click to toggle source
# File lib/oas_parser/path.rb, line 26 def parameter_keys path.scan(/{(.+?)}/).flatten end
parameters()
click to toggle source
# File lib/oas_parser/path.rb, line 30 def parameters return [] unless raw['parameters'] raw['parameters'].map do |definition| OasParser::Parameter.new(self, definition) end end