Class: InterpolSchema::Parser
- Inherits:
-
Object
- Object
- InterpolSchema::Parser
- Defined in:
- lib/interpol_schema/parser.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #http_method ⇒ Object
-
#initialize(path) ⇒ Parser
constructor
A new instance of Parser.
- #request_params_in_path ⇒ Object
- #request_params_in_query ⇒ Object
- #response_code ⇒ Object
- #response_params ⇒ Object
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
#schema ⇒ Object (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_method ⇒ Object
11 12 13 |
# File 'lib/interpol_schema/parser.rb', line 11 def http_method schema.dig("method") end |
#request_params_in_path ⇒ Object
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_query ⇒ Object
19 20 21 |
# File 'lib/interpol_schema/parser.rb', line 19 def request_params_in_query schema.dig("definitions", 0, "query_params") end |
#response_code ⇒ Object
23 24 25 |
# File 'lib/interpol_schema/parser.rb', line 23 def response_code schema.dig("definitions", 1, "status_codes", 0) end |
#response_params ⇒ Object
27 28 29 |
# File 'lib/interpol_schema/parser.rb', line 27 def response_params schema.dig("definitions", 1, "schema") end |