Class: Swagger::Diff::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger/diff/specification.rb

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Specification

Returns a new instance of Specification.



4
5
6
7
8
9
# File 'lib/swagger/diff/specification.rb', line 4

def initialize(spec)
  @spec = spec
  @parsed = parse_swagger(spec)
  validate_swagger
  @endpoint_hash = parsed_to_hash(@parsed)
end

Instance Method Details

#endpointsObject



11
12
13
# File 'lib/swagger/diff/specification.rb', line 11

def endpoints
  @endpoint_hash.keys.to_set
end

#request_paramsObject



15
16
17
18
19
20
21
22
23
# File 'lib/swagger/diff/specification.rb', line 15

def request_params
  @request_params ||= begin
    ret = {}
    @endpoint_hash.each do |key, endpoint|
      ret[key] = request_params_inner(params_or_nil(endpoint))
    end
    ret
  end
end

#response_attributesObject



25
26
27
28
29
30
31
32
33
# File 'lib/swagger/diff/specification.rb', line 25

def response_attributes
  @response_attributes ||= begin
    ret = {}
    @endpoint_hash.each do |key, endpoint|
      ret[key] = response_attributes_inner(endpoint)
    end
    ret
  end
end