Class: R2OAS::Schema::V3::PathItemObject::HttpStatusManager

Inherits:
Object
  • Object
show all
Defined in:
lib/r2-oas/schema/v3/object/from_routes/path_item_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, verb, http_statuses_when_http_method) ⇒ HttpStatusManager

Returns a new instance of HttpStatusManager.



161
162
163
164
165
# File 'lib/r2-oas/schema/v3/object/from_routes/path_item_object.rb', line 161

def initialize(path, verb, http_statuses_when_http_method)
  @path_comp                      = Routing::PathComponent.new(path)
  @verb                           = verb
  @http_statuses_when_http_method = http_statuses_when_http_method
end

Instance Method Details

#http_statusesObject



167
168
169
170
# File 'lib/r2-oas/schema/v3/object/from_routes/path_item_object.rb', line 167

def http_statuses
  key = @path_comp.exist_path_parameters? ? :path_parameter : :default
  @http_statuses_when_http_method[@verb.to_sym][key]
end