Class: NCal2GCal::GoogleCalendar
- Inherits:
-
Object
- Object
- NCal2GCal::GoogleCalendar
- Defined in:
- lib/ncal2gcal/google_calendar.rb
Instance Attribute Summary collapse
-
#calendar ⇒ Object
Returns the value of attribute calendar.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#password ⇒ Object
Returns the value of attribute password.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #del_event(id) ⇒ Object
- #find_event(id) ⇒ Object
-
#initialize(params) ⇒ GoogleCalendar
constructor
A new instance of GoogleCalendar.
- #new_event ⇒ Object
Constructor Details
#initialize(params) ⇒ GoogleCalendar
Returns a new instance of GoogleCalendar.
9 10 11 12 13 14 15 16 17 |
# File 'lib/ncal2gcal/google_calendar.rb', line 9 def initialize(params) @user = params[:gmail_user] @password = params[:gmail_password] @calendar = params[:gmail_calendar] || "LotusNotes" service = GCal4Ruby::Service.new service.authenticate(@user, @password ) @cal = GCal4Ruby::Calendar.find(service, @calendar, {:scope => :first}) end |
Instance Attribute Details
#calendar ⇒ Object
Returns the value of attribute calendar.
7 8 9 |
# File 'lib/ncal2gcal/google_calendar.rb', line 7 def calendar @calendar end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
8 9 10 |
# File 'lib/ncal2gcal/google_calendar.rb', line 8 def events @events end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/ncal2gcal/google_calendar.rb', line 7 def password @password end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/ncal2gcal/google_calendar.rb', line 7 def user @user end |
Instance Method Details
#del_event(id) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/ncal2gcal/google_calendar.rb', line 24 def del_event(id) event = find_event(id) if event return event.delete unless event == [] end return false end |
#find_event(id) ⇒ Object
18 19 20 |
# File 'lib/ncal2gcal/google_calendar.rb', line 18 def find_event(id) return GCal4Ruby::Event.find(@cal, id) end |
#new_event ⇒ Object
21 22 23 |
# File 'lib/ncal2gcal/google_calendar.rb', line 21 def new_event return GCal4Ruby::Event.new(@cal) end |