Class: Wordnik::OperationParameter
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- lib/wordnik/operation_parameter.rb
Instance Attribute Summary collapse
-
#allow_multiple ⇒ Object
Returns the value of attribute allow_multiple.
-
#allowable_values ⇒ Object
Returns the value of attribute allowable_values.
-
#data_type ⇒ Object
Returns the value of attribute data_type.
-
#default_value ⇒ Object
Returns the value of attribute default_value.
-
#description ⇒ Object
Returns the value of attribute description.
-
#internal_description ⇒ Object
Returns the value of attribute internal_description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#param_access ⇒ Object
Returns the value of attribute param_access.
-
#param_type ⇒ Object
Returns the value of attribute param_type.
-
#required ⇒ Object
Returns the value of attribute required.
-
#value_type_internal ⇒ Object
Returns the value of attribute value_type_internal.
-
#wrapper_name ⇒ Object
Returns the value of attribute wrapper_name.
Instance Method Summary collapse
- #human_name ⇒ Object
-
#initialize(attributes = {}) ⇒ OperationParameter
constructor
A new instance of OperationParameter.
-
#persisted? ⇒ Boolean
It’s an ActiveModel thing..
-
#positional? ⇒ Boolean
Is this a required positional param used in a convenience method?.
- #required? ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ OperationParameter
Returns a new instance of OperationParameter.
12 13 14 15 16 17 18 19 |
# File 'lib/wordnik/operation_parameter.rb', line 12 def initialize(attributes = {}) attributes.each do |name, value| send("#{name.to_s.underscore.to_sym}=", value) end # Fudge body param into having the name :body self.name = :body if self.name.blank? end |
Instance Attribute Details
#allow_multiple ⇒ Object
Returns the value of attribute allow_multiple.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def allow_multiple @allow_multiple end |
#allowable_values ⇒ Object
Returns the value of attribute allowable_values.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def allowable_values @allowable_values end |
#data_type ⇒ Object
Returns the value of attribute data_type.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def data_type @data_type end |
#default_value ⇒ Object
Returns the value of attribute default_value.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def default_value @default_value end |
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def description @description end |
#internal_description ⇒ Object
Returns the value of attribute internal_description.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def internal_description @internal_description end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def name @name end |
#param_access ⇒ Object
Returns the value of attribute param_access.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def param_access @param_access end |
#param_type ⇒ Object
Returns the value of attribute param_type.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def param_type @param_type end |
#required ⇒ Object
Returns the value of attribute required.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def required @required end |
#value_type_internal ⇒ Object
Returns the value of attribute value_type_internal.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def value_type_internal @value_type_internal end |
#wrapper_name ⇒ Object
Returns the value of attribute wrapper_name.
9 10 11 |
# File 'lib/wordnik/operation_parameter.rb', line 9 def wrapper_name @wrapper_name end |
Instance Method Details
#human_name ⇒ Object
21 22 23 24 |
# File 'lib/wordnik/operation_parameter.rb', line 21 def human_name return "request body" if self.param_type == 'body' self.name.to_s end |
#persisted? ⇒ Boolean
It’s an ActiveModel thing..
38 39 40 |
# File 'lib/wordnik/operation_parameter.rb', line 38 def persisted? false end |
#positional? ⇒ Boolean
Is this a required positional param used in a convenience method?
31 32 33 34 35 |
# File 'lib/wordnik/operation_parameter.rb', line 31 def positional? return true if self.param_type == 'body' return true if self.param_type == 'path' && self.name.to_s != 'format' false end |
#required? ⇒ Boolean
26 27 28 |
# File 'lib/wordnik/operation_parameter.rb', line 26 def required? self.required || self.param_type == "path" end |