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
5
6
7
8
|
# File 'lib/ruby-swagger/object.rb', line 5
def self.attr_swagger(*attributes)
attr_accessor(*attributes)
@@swagger_attribs[to_s] = *attributes
end
|
Instance Method Details
#bulk_set(object) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/ruby-swagger/object.rb', line 26
def bulk_set(object)
swagger_attributes.each do |attribute|
send("#{attribute}=", object[attribute.to_s])
end
self
end
|
#swagger_attributes ⇒ Object
10
11
12
|
# File 'lib/ruby-swagger/object.rb', line 10
def swagger_attributes
@@swagger_attribs[self.class.to_s]
end
|
#to_json(options = nil) ⇒ Object
14
15
16
|
# File 'lib/ruby-swagger/object.rb', line 14
def to_json(options = nil)
to_swagger.to_json(options)
end
|
#to_swagger ⇒ Object
22
23
24
|
# File 'lib/ruby-swagger/object.rb', line 22
def to_swagger
as_swagger
end
|
18
19
20
|
# File 'lib/ruby-swagger/object.rb', line 18
def to_yaml
to_swagger.to_yaml
end
|