Class: Apipie::ResponseDescription::ResponseObject
- Inherits:
-
Object
- Object
- Apipie::ResponseDescription::ResponseObject
- Includes:
- DSL::Base, DSL::Param
- Defined in:
- lib/apipie/response_description.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
Returns the value of attribute additional_properties.
-
#typename ⇒ Object
Returns the value of attribute typename.
Attributes included from DSL::Base
#api_params, #apipie_resource_descriptions
Instance Method Summary collapse
-
#_default_param_group_scope ⇒ Object
this routine overrides Param#_default_param_group_scope and is called if Param#param_group is invoked during the instance_exec call in ResponseObject#initialize.
-
#initialize(method_description, scope, block, typename) ⇒ ResponseObject
constructor
A new instance of ResponseObject.
- #name ⇒ Object
- #params_ordered ⇒ Object
- #prepare_hash_params ⇒ Object
Methods included from DSL::Param
#param, #param_group, #property, #returns
Methods included from DSL::Base
Constructor Details
#initialize(method_description, scope, block, typename) ⇒ ResponseObject
Returns a new instance of ResponseObject.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/apipie/response_description.rb', line 10 def initialize(method_description, scope, block, typename) @method_description = method_description @scope = scope @param_group = {scope: scope} @additional_properties = false @typename = typename self.instance_exec(&block) if block prepare_hash_params end |
Instance Attribute Details
#additional_properties ⇒ Object
Returns the value of attribute additional_properties.
8 9 10 |
# File 'lib/apipie/response_description.rb', line 8 def additional_properties @additional_properties end |
#typename ⇒ Object
Returns the value of attribute typename.
8 9 10 |
# File 'lib/apipie/response_description.rb', line 8 def typename @typename end |
Instance Method Details
#_default_param_group_scope ⇒ Object
this routine overrides Param#_default_param_group_scope and is called if Param#param_group is invoked during the instance_exec call in ResponseObject#initialize
24 25 26 |
# File 'lib/apipie/response_description.rb', line 24 def _default_param_group_scope @scope end |
#name ⇒ Object
28 29 30 |
# File 'lib/apipie/response_description.rb', line 28 def name "response #{@code} for #{@method_description.method}" end |
#params_ordered ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/apipie/response_description.rb', line 32 def params_ordered @params_ordered ||= _apipie_dsl_data[:params].map do |args| = args.find { |arg| arg.is_a? Hash } [:param_group] = @param_group Apipie::ParamDescription.from_dsl_data(@method_description, args) unless [:only_in] == :request end.compact end |
#prepare_hash_params ⇒ Object
40 41 42 43 44 |
# File 'lib/apipie/response_description.rb', line 40 def prepare_hash_params @hash_params = params_ordered.reduce({}) do |h, param| h.update(param.name.to_sym => param) end end |