Class: RailsApiDoc::Controller::Response::Param
- Defined in:
- lib/rails_api_doc/controller/response/param.rb
Overview
name - attribute key returned in json response attr - actual attribute usage attribute nested - attribute nesting if present model - attribute model if nested and has model desc - description for attribute type - attribute type if set id - param id in DB for lookup on display
Constant Summary
Constants inherited from Param
Param::COMMON_VALID_KEYS, Param::HELPER_KEYS, Param::VALID_KEYS, Param::VALID_REQUEST_KEYS, Param::VALID_RESPONSE_KEYS
Instance Method Summary collapse
- #display_value ⇒ Object
-
#initialize(name, attr, nested, model = nil, desc = nil, type = nil, id = nil, action_type = nil, is_new: false) ⇒ Param
constructor
A new instance of Param.
- #nested? ⇒ Boolean
Methods inherited from Param
#add_updated_field, #created?, define_accessors, #destroyed?, #display_name, #display_special, #display_type, #updated?
Constructor Details
#initialize(name, attr, nested, model = nil, desc = nil, type = nil, id = nil, action_type = nil, is_new: false) ⇒ Param
Returns a new instance of Param.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rails_api_doc/controller/response/param.rb', line 21 def initialize(name, attr, nested, model = nil, desc = nil, type = nil, id = nil, action_type = nil, is_new: false) @name = name @store = { name: name, attr: attr, nested: nested, model: model, desc: desc, type: type, action_type: action_type, id: id }.compact @is_new = is_new @new = [] end |
Instance Method Details
#display_value ⇒ Object
42 43 44 45 46 |
# File 'lib/rails_api_doc/controller/response/param.rb', line 42 def display_value title = attr.to_s title += '(NESTED)' if nested? title end |
#nested? ⇒ Boolean
38 39 40 |
# File 'lib/rails_api_doc/controller/response/param.rb', line 38 def nested? !nested.nil? end |