Class: Swagger::SwaggerObject
- Inherits:
-
Hashie::Dash
- Object
- Hashie::Dash
- Swagger::SwaggerObject
- Includes:
- Hashie::Extensions::Coercion, Hashie::Extensions::IndifferentAccess, Attachable
- Defined in:
- lib/swagger/swagger_object.rb
Overview
A class that represents an Object defined in the Swagger specification. Provides methods for defining fields in the object.
Direct Known Subclasses
API, V2::Info, V2::Info::Contact, V2::Info::License, V2::Operation, V2::Parameter, V2::Path, V2::Response, V2::Tag
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Class Method Summary collapse
-
.field(name, type, opts = {}) ⇒ Object
private
Defines a Swagger field on a class.
-
.required_field(name, type, opts = {}) ⇒ Object
private
Defines a required Swagger field on a class.
Instance Method Summary collapse
-
#initialize(hash) ⇒ SwaggerObject
constructor
private
Initializes a Swagger object, using Hashie::Dash, and attaches to children objects so navigation via
parent
androot
is possible.
Methods included from Attachable
#attach_parent, #attach_to_children, #root
Constructor Details
#initialize(hash) ⇒ SwaggerObject
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes a Swagger object, using Hashie::Dash, and attaches to children objects so navigation via parent
and root
is possible.
15 16 17 18 |
# File 'lib/swagger/swagger_object.rb', line 15 def initialize(hash) super attach_to_children end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
9 10 11 |
# File 'lib/swagger/swagger_object.rb', line 9 def parent @parent end |
Class Method Details
.field(name, type, opts = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Defines a Swagger field on a class.
26 27 28 29 |
# File 'lib/swagger/swagger_object.rb', line 26 def self.field(name, type, opts = {}) property name, opts coerce_key name, type end |
.required_field(name, type, opts = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Defines a required Swagger field on a class.
37 38 39 40 |
# File 'lib/swagger/swagger_object.rb', line 37 def self.required_field(name, type, opts = {}) opts[:required] = true field(name, type, opts) end |