Module: RubyKong::Request::Plugin

Defined in:
lib/ruby-kong/request/plugin.rb

Defined Under Namespace

Classes: Stub

Class Method Summary collapse

Class Method Details

.create(*args) ⇒ Object



5
6
7
8
9
# File 'lib/ruby-kong/request/plugin.rb', line 5

def create(*args)
  path = RubyKong.paths[:plugin][:create]
  path.gsub!(':api_id', args[0][:api])
  Request.post(path, args[0][:plugin])
end

.delete(*args) ⇒ Object



51
52
53
54
55
# File 'lib/ruby-kong/request/plugin.rb', line 51

def delete(*args)
  resource = args[0][:username] || args[0][:id]
  path     = RubyKong.paths[:plugin][:update] + resource
  Request.delete(path, args[0])
end

.list(*args) ⇒ Object



11
12
13
14
# File 'lib/ruby-kong/request/plugin.rb', line 11

def list(*args)
  path = RubyKong.paths[:plugin][:list]
  Request.get(path, args[0])
end

.list_by_api(*args) ⇒ Object



16
17
18
19
20
# File 'lib/ruby-kong/request/plugin.rb', line 16

def list_by_api(*args)
  path = RubyKong.paths[:plugin][:list_by_api]
  path.gsub!(':api_id', args[0][:api])
  Request.get(path, args[0][:filter])
end

.retrieve(*args) ⇒ Object



22
23
24
25
26
27
# File 'lib/ruby-kong/request/plugin.rb', line 22

def retrieve(*args)
  plugin_id = args[0][:id]
  path      = RubyKong.paths[:plugin][:retrieve]
  path.gsub!(':plugin_id', plugin_id)
  Request.get(path)
end

.retrieve_enabled(*args) ⇒ Object



29
30
31
32
# File 'lib/ruby-kong/request/plugin.rb', line 29

def retrieve_enabled(*args)
  path      = RubyKong.paths[:plugin][:retrieve_enabled]
  Request.get(path)
end

.retrieve_schema(*args) ⇒ Object



34
35
36
37
38
39
# File 'lib/ruby-kong/request/plugin.rb', line 34

def retrieve_schema(*args)
  plugin_name = args[0][:plugin_name]
  path        = RubyKong.paths[:plugin][:retrieve_schema]
  path.gsub!(':plugin_name', plugin_name)
  Request.get(path)
end

.update(*args) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/ruby-kong/request/plugin.rb', line 41

def update(*args)
  api_id    = args[0][:api]
  plugin_id = args[0][:plugin]
  path      = RubyKong.paths[:plugin][:update]
  path.gsub!(':api_id', api_id)
  path.gsub!(':plugin_id', plugin_id)

  Request.patch(path, args[0][:params])
end