Class: APIGatewayDSL::Integration
- Inherits:
-
Object
- Object
- APIGatewayDSL::Integration
- Defined in:
- lib/api_gateway_dsl/integration.rb,
lib/api_gateway_dsl/integration/http.rb,
lib/api_gateway_dsl/integration/mock.rb,
lib/api_gateway_dsl/integration/lambda.rb,
lib/api_gateway_dsl/integration/collection.rb,
lib/api_gateway_dsl/integration/http_proxy.rb
Defined Under Namespace
Classes: Collection, HTTP, HTTPProxy, Lambda, Mock
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#mappings ⇒ Object
readonly
Returns the value of attribute mappings.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#as_json ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#initialize(operation, *args, &_block) ⇒ Integration
constructor
A new instance of Integration.
Constructor Details
#initialize(operation, *args, &_block) ⇒ Integration
Returns a new instance of Integration.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/api_gateway_dsl/integration.rb', line 6 def initialize(operation, *args, &_block) = args.last.is_a?(Hash) ? args.last : {} @operation = operation @context = @operation.context.dup.tap { |c| c.default_body_file = 'request/body' } @passthrough_behavior = [:passthrough_behavior] || 'WHEN_NO_TEMPLATES' @content_handling = [:content_handling] || 'CONVERT_TO_TEXT' @credentials = [:credentials] @mappings = Mapping::Collection.new @templates = Template::Collection.new(@context) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/api_gateway_dsl/integration.rb', line 4 def context @context end |
#mappings ⇒ Object (readonly)
Returns the value of attribute mappings.
4 5 6 |
# File 'lib/api_gateway_dsl/integration.rb', line 4 def mappings @mappings end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/api_gateway_dsl/integration.rb', line 4 def method @method end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
4 5 6 |
# File 'lib/api_gateway_dsl/integration.rb', line 4 def templates @templates end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/api_gateway_dsl/integration.rb', line 4 def url @url end |
Instance Method Details
#as_json ⇒ Object
rubocop:disable Metrics/MethodLength
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/api_gateway_dsl/integration.rb', line 21 def as_json # rubocop:disable Metrics/MethodLength {}.tap do |result| if (request_parameters = mappings.as_json).present? result[:requestParameters] = request_parameters end result[:passthroughBehavior] = @passthrough_behavior result[:contentHandling] = @content_handling if (request_templates = @templates.as_json).present? result[:requestTemplates] = request_templates end if (responses = @operation.responses.response_integrations.as_json).present? result[:responses] = responses end end end |