Class: Swagger::Data::Info
- Inherits:
-
Object
- Object
- Object
- Swagger::Data::Info
show all
- Defined in:
- lib/ruby-swagger/data/info.rb
Overview
Constant Summary
collapse
- DEFAULT_TITLE =
'My uber-duper API'
- DEFAULT_DESCRIPTION =
'My uber-duper API description'
- DEFAULT_VERSION =
'0.1'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Object
attr_swagger, #bulk_set, #swagger_attributes, #to_json, #to_swagger, #to_yaml
Constructor Details
#initialize ⇒ Info
Returns a new instance of Info.
Class Method Details
.parse(info) ⇒ Object
20
21
22
23
24
|
# File 'lib/ruby-swagger/data/info.rb', line 20
def self.parse(info)
raise (ArgumentError.new("Swagger::Data::Info#parse - info object is nil")) unless info
Swagger::Data::Info.new.bulk_set(info)
end
|
Instance Method Details
31
32
33
34
35
36
37
38
39
|
# File 'lib/ruby-swagger/data/info.rb', line 31
def contact=(new_contact)
return nil unless new_contact
if(!new_contact.is_a?(Swagger::Data::Contact))
new_contact = Swagger::Data::Contact.parse(new_contact)
end
@contact = new_contact
end
|
#license=(new_license) ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/ruby-swagger/data/info.rb', line 41
def license=(new_license)
return nil unless new_license
if(!new_license.is_a?(Swagger::Data::License))
new_license = Swagger::Data::License.parse(new_license)
end
@license = new_license
end
|
#title=(new_title) ⇒ Object
26
27
28
29
|
# File 'lib/ruby-swagger/data/info.rb', line 26
def title=(new_title)
raise (ArgumentError.new("Swagger::Data::Info#title= - title is invalid")) if new_title.nil? || new_title.empty?
@title = new_title
end
|
#valid? ⇒ Boolean
51
52
53
|
# File 'lib/ruby-swagger/data/info.rb', line 51
def valid?
@license.valid? && @contact.valid?
end
|