Class: GProv::Provision::Owner
- Defined in:
- lib/gprov/provision/owner.rb
Instance Attribute Summary collapse
-
#group_id ⇒ Object
Returns the value of attribute group_id.
Attributes inherited from EntryBase
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from EntryBase
#attributes_from_hash, #initialize, #xml_to_hash
Methods included from EntryBase::ClassMethods
#attribute_names, #attribute_titles, #attributes, #xmlattr
Constructor Details
This class inherits a constructor from GProv::Provision::EntryBase
Instance Attribute Details
#group_id ⇒ Object
Returns the value of attribute group_id.
10 11 12 |
# File 'lib/gprov/provision/owner.rb', line 10 def group_id @group_id end |
Class Method Details
.all(connection, group_id) ⇒ Object
12 13 14 15 16 |
# File 'lib/gprov/provision/owner.rb', line 12 def self.all(connection, group_id) feed = GProv::Provision::Feed.new(connection, "/group/2.0/:domain/#{group_id}/owner", "/xmlns:feed/xmlns:entry") entries = feed.fetch entries.map { |xml| new(:status => :clean, :connection => connection, :source => xml) } end |
Instance Method Details
#create! ⇒ Object
35 36 37 38 |
# File 'lib/gprov/provision/owner.rb', line 35 def create! response = connection.post("/group/2.0/:domain/#{@group_id}/owner", {:body => to_nokogiri.to_xml}) status = :clean end |
#delete! ⇒ Object
40 41 42 43 |
# File 'lib/gprov/provision/owner.rb', line 40 def delete! response = connection.delete("/group/2.0/:domain/#{@group_id}/owner/#{@email}") status = :clean end |
#to_nokogiri ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gprov/provision/owner.rb', line 18 def to_nokogiri base_document = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| xml.entry('xmlns:atom' => 'http://www.w3.org/2005/Atom', 'xmlns:apps' => 'http://schemas.google.com/apps/2006', 'xmlns:gd' => "http://schemas.google.com/g/2005" ) { # Namespaces cannot be used until they are declared, so we need to # retroactively declare the namespace of the parent xml.parent.namespace = xml.parent.namespace_definitions.select {|ns| ns.prefix == "atom"}.first xml['apps'].property("name" => "email", "value" => @email) } end base_document end |