Class: Googletastic::AccessRule
- Defined in:
- lib/googletastic/access_rule.rb
Constant Summary
Constants included from Mixins::Namespaces
Mixins::Namespaces::NAMESPACES
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#email ⇒ Object
Returns the value of attribute email.
-
#role ⇒ Object
Returns the value of attribute role.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Base
#acl, #attachment_path, #created_at, #etag, #head, #id, #keep_raw, #raw, #response, #synced_with, #updated_at
Attributes included from Mixins::Attributes
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
client_class, #initialize, #to_xml
Methods included from Mixins::Pagination
Methods included from Mixins::Finders
Methods included from Mixins::Parsing
Methods included from Mixins::Requesting
Methods included from Mixins::Attributes
#attribute_names, #has_attribute?, #inspect
Methods included from Mixins::Namespaces
Constructor Details
This class inherits a constructor from Googletastic::Base
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
3 4 5 |
# File 'lib/googletastic/access_rule.rb', line 3 def agent @agent end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/googletastic/access_rule.rb', line 3 def email @email end |
#role ⇒ Object
Returns the value of attribute role.
3 4 5 |
# File 'lib/googletastic/access_rule.rb', line 3 def role @role end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/googletastic/access_rule.rb', line 3 def title @title end |
Class Method Details
.build_url(options) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/googletastic/access_rule.rb', line 7 def build_url() base = nil if .has_key?(:document_id) [:client] = Googletastic::Document.client base = "http://docs.google.com/feeds/acl/private/full/#{[:document_id]}" end [:url] = base super() end |
.marshall(record) ⇒ Object
35 36 37 |
# File 'lib/googletastic/access_rule.rb', line 35 def marshall(record) end |
.unmarshall(xml) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/googletastic/access_rule.rb', line 17 def unmarshall(xml) records = xml.xpath("//atom:entry", ns_tag("atom")).collect do |record| title = id = value = nil # reset id = record.xpath("atom:id", ns_tag("atom")).text title = record.xpath("atom:title", ns_tag("atom")).text scope = record.xpath("gAcl:scope", ns_tag("gAcl")).first role = record.xpath("gAcl:role", ns_tag("gAcl")).first["value"].to_s Googletastic::AccessRule.new( :id => id, :title => title, :email => scope["value"].to_s, :agent => scope["type"].to_s, :role => role ) end records end |
Instance Method Details
#has_access?(email) ⇒ Boolean
41 42 43 |
# File 'lib/googletastic/access_rule.rb', line 41 def has_access?(email) self.email == email end |