Class: ApiSketch::DSL::Parameters
- Defined in:
- lib/api_sketch/dsl/parameters.rb
Instance Method Summary collapse
- #body(container_type, &block) ⇒ Object
-
#initialize(&block) ⇒ Parameters
constructor
A new instance of Parameters.
- #query(container_type, &block) ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(&block) ⇒ Parameters
Returns a new instance of Parameters.
3 4 5 6 7 8 9 10 |
# File 'lib/api_sketch/dsl/parameters.rb', line 3 def initialize(&block) @query = [] @body = [] @query_container_type = nil @body_container_type = nil define_singleton_method(:initialize_parameters_list, block) initialize_parameters_list end |
Instance Method Details
#body(container_type, &block) ⇒ Object
26 27 28 29 |
# File 'lib/api_sketch/dsl/parameters.rb', line 26 def body(container_type, &block) @body_container_type = container_type @body += ::ApiSketch::DSL::Attributes.new(container_type, &block).to_a end |
#query(container_type, &block) ⇒ Object
21 22 23 24 |
# File 'lib/api_sketch/dsl/parameters.rb', line 21 def query(container_type, &block) @query_container_type = container_type @query += ::ApiSketch::DSL::Attributes.new(container_type, &block).to_a end |
#to_h ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/api_sketch/dsl/parameters.rb', line 12 def to_h { query: @query, body: @body, query_container_type: @query_container_type, body_container_type: @body_container_type } end |