Sha256: 7823509d4ca6c83bb5a75ae93f30613667d13e26420d4e61d8161399f59e8565

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

require_relative './util'

module Kong
  class Plugin
    include Base
    include BelongsToApi

    ATTRIBUTE_NAMES = %w(id api_id name config enabled consumer_id).freeze
    API_END_POINT = '/plugins/'.freeze

    # Create resource
    def create
      flatten_config
      super
    end

    # update resource
    def update
      flatten_config
      super
    end

    private

    def flatten_config
      if attributes['config']
        attributes.merge!(Util.flatten(attributes.delete('config'), 'config'))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
kong-client-0.4.0 lib/kong/plugin.rb
kong-0.3.4 lib/kong/plugin.rb
kong-0.3.3 lib/kong/plugin.rb