Class: GoogleAppsApi::CalendarAcl

Inherits:
Object
  • Object
show all
Defined in:
lib/google_apps_api/calendar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CalendarAcl

Returns a new instance of CalendarAcl.



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/google_apps_api/calendar.rb', line 201

def initialize(*args)
  options = args.extract_options!
  if (_xml = options[:xml])
    _xml = _xml.kind_of?(Nokogiri::XML::Document) ? _xml.children.first : _xml
    scope_kind = _xml.at_css('gAcl|scope').attribute("type").content
    scope_id = _xml.at_css('gAcl|scope').attribute("value").content

    @scope = Entity.new(scope_kind  => scope_id)
    @role = _xml.at_css('title').content
    @calendar = CalendarEntity.new(_xml.at_css('id').content.gsub(/^.*feeds\//,"").gsub(/\/acl.*$/,""))

  else

    @scope = options[:scope]
    @role = options[:role]
    @calendar = options[:calendar]
  end
end

Instance Attribute Details

#calendarObject

Returns the value of attribute calendar.



199
200
201
# File 'lib/google_apps_api/calendar.rb', line 199

def calendar
  @calendar
end

#roleObject

Returns the value of attribute role.



199
200
201
# File 'lib/google_apps_api/calendar.rb', line 199

def role
  @role
end

#scopeObject

Returns the value of attribute scope.



199
200
201
# File 'lib/google_apps_api/calendar.rb', line 199

def scope
  @scope
end

Instance Method Details

#role_schemaObject



220
221
222
223
224
225
226
# File 'lib/google_apps_api/calendar.rb', line 220

def role_schema
  if @role == "none"
    "none"
  else
    "http://schemas.google.com/gCal/2005##{@role}"
  end
end