Class: APIGatewayDSL::Document
- Inherits:
-
Object
- Object
- APIGatewayDSL::Document
- Defined in:
- lib/api_gateway_dsl/document.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#host ⇒ Object
Returns the value of attribute host.
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
-
#schemes ⇒ Object
Returns the value of attribute schemes.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#as_json ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#initialize(&block) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(&block) ⇒ Document
Returns a new instance of Document.
17 18 19 20 21 |
# File 'lib/api_gateway_dsl/document.rb', line 17 def initialize(&block) @operations = Operation::Collection.new DSL::DocumentNode.new(self, &block) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
15 16 17 |
# File 'lib/api_gateway_dsl/document.rb', line 15 def description @description end |
#host ⇒ Object
Returns the value of attribute host.
15 16 17 |
# File 'lib/api_gateway_dsl/document.rb', line 15 def host @host end |
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
14 15 16 |
# File 'lib/api_gateway_dsl/document.rb', line 14 def operations @operations end |
#schemes ⇒ Object
Returns the value of attribute schemes.
15 16 17 |
# File 'lib/api_gateway_dsl/document.rb', line 15 def schemes @schemes end |
#title ⇒ Object
Returns the value of attribute title.
15 16 17 |
# File 'lib/api_gateway_dsl/document.rb', line 15 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
15 16 17 |
# File 'lib/api_gateway_dsl/document.rb', line 15 def version @version end |
Class Method Details
Instance Method Details
#as_json ⇒ Object
rubocop:disable Metrics/MethodLength
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/api_gateway_dsl/document.rb', line 23 def as_json # rubocop:disable Metrics/MethodLength {}.tap do |result| result[:swagger] = '2.0' result[:info] = {}.tap do |info| info[:title] = title info[:version] = version info[:description] = description.strip_heredoc if description end result[:host] = host result[:schemes] = schemes result[:paths] = operations.as_json end.deep_stringify_keys end |