Class: OasParser::Response

Inherits:
Payload
  • Object
show all
Includes:
RawAccessor
Defined in:
lib/oas_parser/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RawAccessor

included, #method_missing, #respond_to_missing?

Methods inherited from Payload

#exhibits_one_of_multiple_schemas?, #formats, #schema, #split_schemas

Constructor Details

#initialize(endpoint, code, raw) ⇒ Response

Returns a new instance of Response.



8
9
10
11
12
# File 'lib/oas_parser/response.rb', line 8

def initialize(endpoint, code, raw)
  @endpoint = endpoint
  @code = code
  @raw = raw
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OasParser::RawAccessor

Instance Attribute Details

#codeObject

Returns the value of attribute code.



6
7
8
# File 'lib/oas_parser/response.rb', line 6

def code
  @code
end

#endpointObject

Returns the value of attribute endpoint.



6
7
8
# File 'lib/oas_parser/response.rb', line 6

def endpoint
  @endpoint
end

#rawObject

Returns the value of attribute raw.



6
7
8
# File 'lib/oas_parser/response.rb', line 6

def raw
  @raw
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/oas_parser/response.rb', line 14

def success?
  code.match?(/^2\d\d$/)
end