Class: Praxis::Docs::OpenApi::ServerObject
- Inherits:
-
Object
- Object
- Praxis::Docs::OpenApi::ServerObject
- Defined in:
- lib/praxis/docs/open_api/server_object.rb
Instance Attribute Summary collapse
- #description ⇒ Object readonly
- #url ⇒ Object readonly
- #variables ⇒ Object readonly
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(url:, description: nil, variables: []) ⇒ ServerObject
constructor
A new instance of ServerObject.
Constructor Details
#initialize(url:, description: nil, variables: []) ⇒ ServerObject
Returns a new instance of ServerObject.
10 11 12 13 14 15 |
# File 'lib/praxis/docs/open_api/server_object.rb', line 10 def initialize(url:, description: nil, variables: []) @url = url @description = description @variables = variables raise "OpenApi docs require a 'url' for your server object." unless url end |
Instance Attribute Details
#description ⇒ Object (readonly)
8 9 10 |
# File 'lib/praxis/docs/open_api/server_object.rb', line 8 def description @description end |
#url ⇒ Object (readonly)
8 9 10 |
# File 'lib/praxis/docs/open_api/server_object.rb', line 8 def url @url end |
#variables ⇒ Object (readonly)
8 9 10 |
# File 'lib/praxis/docs/open_api/server_object.rb', line 8 def variables @variables end |
Instance Method Details
#dump ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/praxis/docs/open_api/server_object.rb', line 17 def dump result = { url: url } result[:description] = description if description result[:variables] = variables unless variables.empty? result end |