| 
									
										
										
										
											2015-08-04 13:20:35 +03:00
										 |  |  | require "db/mongo/models/key" | 
					
						
							| 
									
										
										
										
											2018-04-04 22:44:39 +03:00
										 |  |  | require_relative 'base' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | module Connectors | 
					
						
							|  |  |  |   class Key < Base | 
					
						
							|  |  |  |     include Helpers::InsertCommand, | 
					
						
							|  |  |  |       Helpers::ShowCommand, | 
					
						
							|  |  |  |       Helpers::ListCommand, | 
					
						
							|  |  |  |       Helpers::DeleteCommand | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def initialize(db) | 
					
						
							| 
									
										
										
										
											2015-09-21 15:54:33 +03:00
										 |  |  |       super(db) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def collection_name | 
					
						
							|  |  |  |       'keys' | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def key(id, scope=nil) | 
					
						
							|  |  |  |       options = scope ? {'scope' => scope} : {} | 
					
						
							|  |  |  |       show(id, options) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def key_delete id | 
					
						
							| 
									
										
										
										
											2015-07-06 17:00:45 +03:00
										 |  |  |       delete(id, 'scope' => Devops::Model::Key::USER) | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def model_from_bson(bson) | 
					
						
							| 
									
										
										
										
											2015-03-06 12:20:30 +03:00
										 |  |  |       Devops::Model::Key.build_from_bson(bson) | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | end |