Class: APIGatewayDSL::Operation::Collection
- Inherits:
-
Array
- Object
- Array
- APIGatewayDSL::Operation::Collection
- Defined in:
- lib/api_gateway_dsl/operation/collection.rb
Constant Summary collapse
- ACCESS_CONTROL_ALLOW_HEADERS =
%w( Content-Type Authorization X-Amz-Date X-Api-Key X-Amz-Security-Token ).freeze
Instance Method Summary collapse
-
#as_json ⇒ Object
Indexes a flat array of operarations by path and HTTP method:.
Instance Method Details
#as_json ⇒ Object
Indexes a flat array of operarations by path and HTTP method:
Given:
- operationA ( path = '/path1', method = 'get' )
- operationB ( path = '/path1', method = 'post' )
- operationC ( path = '/path2', method = 'get' )
Result:
/path1:
get:
operationA
post:
operationB
/path2:
get:
operationC
32 33 34 35 36 37 |
# File 'lib/api_gateway_dsl/operation/collection.rb', line 32 def as_json group_by(&:path).transform_values do |operations| append_cors_operation!(operations) operations.index_by(&:method).transform_values(&:as_json) end end |