Class: Gtool::Provision::OrgMember
- Inherits:
-
Thor
- Object
- Thor
- Gtool::Provision::OrgMember
- Defined in:
- lib/gtool/provision/orgmember.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
62 63 64 |
# File 'lib/gtool/provision/orgmember.rb', line 62 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#get(membername) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/gtool/provision/orgmember.rb', line 38 def get(membername) connection = Gtool::Auth.connection() orgmember = GProv::Provision::OrgMember.get(connection, membername) fields = GProv::Provision::OrgMember.attribute_names field_names = GProv::Provision::OrgUnit.attribute_titles if orgmember.nil? say "Organizational unit '#{orgmember}' not found!", :red else properties = fields.map {|f| orgmember.send f} print_table field_names.zip(properties) end end |
#list ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gtool/provision/orgmember.rb', line 16 def list if [:orgunit] = {:target => :orgunit, :orgunit => [:orgunit]} else = {:target => :all} end connection = Gtool::Auth.connection() orgmembers = GProv::Provision::OrgMember.all(connection, ) fields = GProv::Provision::OrgMember.attribute_names field_names = GProv::Provision::OrgMember.attribute_titles rows = orgmembers.map do |member| fields.map {|f| member.send f} end rows.unshift field_names print_table rows say "#{rows.length - 1} entries.", :cyan end |
#move(membername, orgunit) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/gtool/provision/orgmember.rb', line 53 def move(membername, orgunit) connection = Gtool::Auth.connection() orgmember = GProv::Provision::OrgMember.get(connection, membername) orgmember.org_unit_path = orgunit orgmember.update! invoke "orgmember:get", [membername] end |