Class: InterpolSchema::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/interpol_schema/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Parser

Returns a new instance of Parser.



7
8
9
# File 'lib/interpol_schema/parser.rb', line 7

def initialize(path)
  @schema = YAML.load_file path
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



5
6
7
# File 'lib/interpol_schema/parser.rb', line 5

def schema
  @schema
end

Instance Method Details

#http_methodObject



11
12
13
# File 'lib/interpol_schema/parser.rb', line 11

def http_method
  schema.dig("method")
end

#request_params_in_pathObject



15
16
17
# File 'lib/interpol_schema/parser.rb', line 15

def request_params_in_path
  schema.dig("definitions", 0, "path_params")
end

#request_params_in_queryObject



19
20
21
# File 'lib/interpol_schema/parser.rb', line 19

def request_params_in_query
  schema.dig("definitions", 0, "query_params")
end

#response_codeObject



23
24
25
# File 'lib/interpol_schema/parser.rb', line 23

def response_code
  schema.dig("definitions", 1, "status_codes", 0)
end

#response_paramsObject



27
28
29
# File 'lib/interpol_schema/parser.rb', line 27

def response_params
  schema.dig("definitions", 1, "schema")
end