Sha256: e2f58a3c430bc20f85c0a9a435a36d30e25a09231e37053b2c4efe283cd22cf0

Contents?: true

Size: 533 Bytes

Versions: 15

Compression:

Stored size: 533 Bytes

Contents

module Jets::Cfn::Resource::ApiGateway
  class ResourceId
    def initialize(path)
      @path = path
    end

    # Used by Method and Cors
    def resource_id
      @path == '/' ?
        "RootResourceId" :
        resource_logical_id.camelize + "ApiResource"
    end

    # Example: Posts
    def resource_logical_id
      camelized_path.underscore
    end

    def camelized_path
      path = @path
      path = "homepage" if path == '/'
      path.gsub('/','_').gsub(':','').gsub('*','').gsub('.','').camelize
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.12 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.11 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.10 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.9 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.8 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.7 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.6 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.5 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.4 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.3 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.2 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.1 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.0 lib/jets/cfn/resource/api_gateway/resource_id.rb
jets-5.0.0.beta1 lib/jets/cfn/resource/api_gateway/resource_id.rb