Class: Kong::Plugin

Inherits:
Object
  • Object
show all
Includes:
Base, BelongsToApi
Defined in:
lib/kong/plugin.rb

Constant Summary collapse

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

Instance Attribute Summary

Attributes included from BelongsToApi

#api

Attributes included from Base

#api_end_point, #attributes

Instance Method Summary collapse

Methods included from BelongsToApi

#api_id=, #use_api_end_point

Methods included from Base

#client, #create_or_update, #delete, #get, included, #initialize, #method_missing, #new?, #respond_to?, #save

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Kong::Base

Instance Method Details

#createObject

Create resource



10
11
12
13
14
15
16
17
18
# File 'lib/kong/plugin.rb', line 10

def create
  if attributes['config']
    attributes['config'].each do |key, value|
      attributes["config.#{key}"] = value
    end
    attributes.delete('config')
  end
  super
end

#updateObject

update resource



21
22
23
24
25
26
27
28
29
# File 'lib/kong/plugin.rb', line 21

def update
  if attributes['config']
    attributes['config'].each do |key, value|
      attributes["config.#{key}"] = value
    end
    attributes.delete('config')
  end
  super
end