class Swaggable::CheckResponseCode

Attributes

endpoint[R]
response[R]

Public Class Methods

call(*args) click to toggle source
# File lib/swaggable/check_response_code.rb, line 10
def self.call(*args)
  new(*args).send :errors
end
new(args) click to toggle source
# File lib/swaggable/check_response_code.rb, line 5
def initialize args
  @endpoint = args.fetch(:endpoint)
  @response = args.fetch(:response)
end

Private Instance Methods

errors() click to toggle source
# File lib/swaggable/check_response_code.rb, line 16
def errors
  Errors::ValidationsCollection.new.tap do |errors|
    unless endpoint.responses[response.code]
      errors << Errors::Validation.new("Status code #{response.code.inspect} not supported")
    end
  end
end