Class: Googlecalendar::Calendar

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



3
4
5
# File 'lib/googlecalendar/calendar.rb', line 3

def events
  @events
end

#methodObject

Returns the value of attribute method.



3
4
5
# File 'lib/googlecalendar/calendar.rb', line 3

def method
  @method
end

#product_idObject

Returns the value of attribute product_id.



3
4
5
# File 'lib/googlecalendar/calendar.rb', line 3

def product_id
  @product_id
end

#scaleObject

Returns the value of attribute scale.



3
4
5
# File 'lib/googlecalendar/calendar.rb', line 3

def scale
  @scale
end

#versionObject

Returns the value of attribute version.



3
4
5
# File 'lib/googlecalendar/calendar.rb', line 3

def version
  @version
end

Instance Method Details

#add(event) ⇒ Object



5
6
7
8
9
# File 'lib/googlecalendar/calendar.rb', line 5

def add(event)
  # create events if it doesn't exist
  @events ||= []
  @events.push event
end

#to_sObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/googlecalendar/calendar.rb', line 11

def to_s
  data = "########## calendar ##########\n"
  data << 'version: ' + @version.to_s + "\n"
  data << 'scale: ' + @scale.to_s + "\n"
  data << 'method: ' + @method.to_s + "\n"
  data << 'number of events: ' + @events.size.to_s + "\n"
  @events.each do |event|
    data << event.to_s
  end
  return data
end