Class: Gtool::Provision::OrgUnit
- Inherits:
-
Thor
- Object
- Thor
- Gtool::Provision::OrgUnit
- Defined in:
- lib/gtool/provision/orgunit.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
45 46 47 |
# File 'lib/gtool/provision/orgunit.rb', line 45 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#get(orgunit_name) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gtool/provision/orgunit.rb', line 31 def get(orgunit_name) connection = Gtool::Auth.connection() orgunit = GProv::Provision::OrgUnit.get(connection, orgunit_name) fields = GProv::Provision::OrgUnit.attribute_names field_names = GProv::Provision::OrgUnit.attribute_titles if orgunit.nil? say "Organizational unit '#{orgunit_name}' not found!", :red else properties = fields.map {|f| orgunit.send f} print_table field_names.zip(properties) end end |
#list ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gtool/provision/orgunit.rb', line 15 def list connection = Gtool::Auth.connection() orgunits = GProv::Provision::OrgUnit.all(connection) fields = GProv::Provision::OrgUnit.attribute_names field_names = GProv::Provision::OrgUnit.attribute_titles rows = orgunits.map do |orgunit| fields.map {|f| orgunit.send f} end rows.unshift field_names print_table rows say "#{rows.length - 1} entries.", :cyan end |