ACL (access control list) of a spreadsheet.
Use GoogleSpreadsheet::Spreadsheet#acl to get GoogleSpreadsheet::Acl object. See GoogleSpreadsheet::Spreadsheet#acl for usage example.
This code is based on github.com/guyboertje/gdata-spreadsheet-ruby .
Returns GoogleSpreadsheet::AclEntry object at
index
.
# File doc_src/google_spreadsheet/acl.rb, line 10 def [](index) end
Deletes an ACL entry.
e.g.
spreadsheet.acl.delete(spreadsheet.acl[1])
# File lib/google_spreadsheet/acl.rb, line 72 def delete(entry) header = {"GData-Version" => "3.0"} @session.request(:delete, entry.edit_url, :header => header, :auth => :writely) @acls.delete(entry) end
Iterates over GoogleSpreadsheet::AclEntry objects.
# File doc_src/google_spreadsheet/acl.rb, line 14 def each(&block) yield(entry) end
# File lib/google_spreadsheet/acl.rb, line 103 def inspect return "\#<%p %p>" % [self.class, @acls] end
Adds a new entry. entry
is either a GoogleSpreadsheet::AclEntry or a Hash with keys
:scope_type, :scope and :role. See GoogleSpreadsheet::AclEntry#scope_type
and GoogleSpreadsheet::AclEntry#role
for the document of the fields.
NOTE: This sends email to the new people.
e.g.
spreadsheet.acl.push( {:scope_type => "user", :scope => "example2@gmail.com", :role => "reader"}) spreadsheet.acl.push( {:scope_type => "user", :scope => "example3@gmail.com", :role => "writer"})
# File lib/google_spreadsheet/acl.rb, line 43 def push(entry) entry = AclEntry.new(entry) if entry.is_a?(Hash) header = {"GData-Version" => "3.0", "Content-Type" => "application/atom+xml"} value_attr = entry.scope ? "value='#{h(entry.scope)}'" : "" xml = " <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gAcl='http://schemas.google.com/acl/2007'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/> <gAcl:role value='#{h(entry.role)}'/> <gAcl:scope type='#{h(entry.scope_type)}' #{value_attr}/> </entry> " doc = @session.request( :post, @acls_feed_url, :data => xml, :header => header, :auth => :writely) entry.params = entry_to_params(doc.root) @acls.push(entry) return entry end
Returns the number of entries.
# File doc_src/google_spreadsheet/acl.rb, line 6 def size end