class APIGatewayDSL::Template::Collection

Public Class Methods

new(context) click to toggle source
# File lib/api_gateway_dsl/template/collection.rb, line 5
def initialize(context)
  @fallback = Template.new_if_schema_present(context)
end

Public Instance Methods

as_json() click to toggle source
# File lib/api_gateway_dsl/template/collection.rb, line 22
def as_json
  currents.index_by(&:content_type).transform_values(&:as_json)
end
content_types() click to toggle source
# File lib/api_gateway_dsl/template/collection.rb, line 9
def content_types
  currents.map(&:content_type).uniq
end
current() click to toggle source
# File lib/api_gateway_dsl/template/collection.rb, line 13
def current
  any? ? first : @fallback
end
currents() click to toggle source

Array containing current or empty array

# File lib/api_gateway_dsl/template/collection.rb, line 18
def currents
  Array(current)
end
parameters() click to toggle source
# File lib/api_gateway_dsl/template/collection.rb, line 26
def parameters
  Parameter::Collection.new.concat(currents.map(&:parameter))
end