Class: EasyType::Classifier
- Inherits:
-
PuppetService
- Object
- PuppetService
- EasyType::Classifier
- Defined in:
- lib/easy_type/classifier.rb
Instance Method Summary collapse
- #em_groups ⇒ Object
- #find_by_id(id) ⇒ Object
- #find_by_name(name) ⇒ Object
-
#initialize ⇒ Classifier
constructor
A new instance of Classifier.
- #node_groups ⇒ Object
- #rule_to_pdb_query(rules) ⇒ Object
Methods inherited from PuppetService
Constructor Details
#initialize ⇒ Classifier
Returns a new instance of Classifier.
7 8 9 10 11 12 |
# File 'lib/easy_type/classifier.rb', line 7 def initialize super port = 4433 prefix = '/classifier-api' @base_url = "https://#{@server}:#{port}#{prefix}" end |
Instance Method Details
#em_groups ⇒ Object
27 28 29 |
# File 'lib/easy_type/classifier.rb', line 27 def em_groups node_groups.select {|g| g.em_group? } end |
#find_by_id(id) ⇒ Object
18 19 20 |
# File 'lib/easy_type/classifier.rb', line 18 def find_by_id(id) node_groups.find {|g| g.id == id } end |
#find_by_name(name) ⇒ Object
14 15 16 |
# File 'lib/easy_type/classifier.rb', line 14 def find_by_name(name) node_groups.find {|g| g.name == name } end |
#node_groups ⇒ Object
22 23 24 25 |
# File 'lib/easy_type/classifier.rb', line 22 def node_groups return @node_groups if @node_groups @node_groups = get('/v1/groups').collect {|g| NodeGroup.new(self, g) } end |
#rule_to_pdb_query(rules) ⇒ Object
31 32 33 |
# File 'lib/easy_type/classifier.rb', line 31 def rule_to_pdb_query(rules) post('/v1/rules/translate', rules) end |