Class: Kong::Consumer
Constant Summary collapse
- ATTRIBUTE_NAMES =
%w(id custom_id username created_at).freeze
- API_END_POINT =
'/consumers/'.freeze
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
-
#acls ⇒ Array<Kong::Acl>
List Acls.
-
#basic_auths ⇒ Array<Kong::KeyAuth]
List KeyAuth credentials.
- #delete ⇒ Object
-
#jwts ⇒ Array<Kong::JWT>
List JWTs.
-
#key_auths ⇒ Array<Kong::KeyAuth]
List KeyAuth credentials.
-
#oauth2_tokens ⇒ Array<Kong::OAuth2Token>
List OAuth2Tokens.
-
#oauth_apps ⇒ Array<Kong::OAuthApp>
List OAuth applications.
-
#plugins ⇒ Array<Kong::Plugin>
List plugins.
Methods included from Base
#client, #create, #create_or_update, #get, included, #initialize, #method_missing, #new?, #respond_to?, #save, #update
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Kong::Base
Instance Method Details
#acls ⇒ Array<Kong::Acl>
List Acls
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/kong/consumer.rb', line 78 def acls acls = [] response = client.get("#{@api_end_point}#{self.id}/acls") rescue nil if response response['data'].each do |attributes| acls << Kong::Acl.new(attributes) end end acls end |
#basic_auths ⇒ Array<Kong::KeyAuth]
List KeyAuth credentials
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/kong/consumer.rb', line 39 def basic_auths apps = [] response = client.get("#{@api_end_point}#{self.id}/basic-auth") rescue nil if response response['data'].each do |attributes| apps << Kong::BasicAuth.new(attributes) end end apps end |
#delete ⇒ Object
8 9 10 11 12 13 |
# File 'lib/kong/consumer.rb', line 8 def delete self.oauth2_tokens.each do |token| token.delete end super end |
#jwts ⇒ Array<Kong::JWT>
List JWTs
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/kong/consumer.rb', line 92 def jwts apps = [] response = client.get("#{@api_end_point}#{self.id}/jwt") rescue nil if response response['data'].each do |attributes| apps << Kong::JWT.new(attributes) end end apps end |
#key_auths ⇒ Array<Kong::KeyAuth]
List KeyAuth credentials
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/kong/consumer.rb', line 53 def key_auths apps = [] response = client.get("#{@api_end_point}#{self.id}/key-auth") rescue nil if response response['data'].each do |attributes| apps << Kong::KeyAuth.new(attributes) end end apps end |
#oauth2_tokens ⇒ Array<Kong::OAuth2Token>
List OAuth2Tokens
67 68 69 70 71 72 73 |
# File 'lib/kong/consumer.rb', line 67 def oauth2_tokens if self.custom_id OAuth2Token.list({ authenticated_userid: self.custom_id }) else [] end end |
#oauth_apps ⇒ Array<Kong::OAuthApp>
List OAuth applications
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kong/consumer.rb', line 25 def oauth_apps apps = [] response = client.get("#{@api_end_point}#{self.id}/oauth2") rescue nil if response response['data'].each do |attributes| apps << Kong::OAuthApp.new(attributes) end end apps end |
#plugins ⇒ Array<Kong::Plugin>
List plugins
18 19 20 |
# File 'lib/kong/consumer.rb', line 18 def plugins Plugin.list({ consumer_id: self.id }) end |