Class: Swagger::Object
- Inherits:
-
Object
show all
- Defined in:
- lib/ruby-swagger/object.rb
Direct Known Subclasses
Data::Contact, Data::Definitions, Data::Document, Data::Example, Data::ExternalDocumentation, Data::Header, Data::Headers, Data::Info, Data::Items, Data::License, Data::Operation, Data::Parameter, Data::Parameters, Data::Path, Data::Paths, Data::Reference, Data::Response, Data::Responses, Data::Schema, Data::Scopes, Data::SecurityDefinitions, Data::SecurityRequirement, Data::SecurityScheme, Data::Tag, Data::XMLObject
Constant Summary
collapse
- @@swagger_attribs =
{}
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.attr_swagger(*attributes) ⇒ Object
6
7
8
9
|
# File 'lib/ruby-swagger/object.rb', line 6
def self.attr_swagger(*attributes)
attr_accessor(*attributes)
@@swagger_attribs[self.to_s] = *attributes
end
|
Instance Method Details
#bulk_set(object) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/ruby-swagger/object.rb', line 27
def bulk_set(object)
swagger_attributes.each do |attribute|
self.send("#{attribute}=", object[attribute.to_s])
end
self
end
|
#swagger_attributes ⇒ Object
11
12
13
|
# File 'lib/ruby-swagger/object.rb', line 11
def swagger_attributes
@@swagger_attribs[self.class.to_s]
end
|
#to_json(options = nil) ⇒ Object
15
16
17
|
# File 'lib/ruby-swagger/object.rb', line 15
def to_json(options = nil)
to_swagger.to_json(options)
end
|
#to_swagger ⇒ Object
23
24
25
|
# File 'lib/ruby-swagger/object.rb', line 23
def to_swagger
as_swagger
end
|
19
20
21
|
# File 'lib/ruby-swagger/object.rb', line 19
def to_yaml
to_swagger.to_yaml
end
|