# Undefined method(s) in a gcalapi class

**URL:** <https://www.ruby-forum.com/t/undefined-method-s-in-a-gcalapi-class/108060>\
**Category:** Ruby\
**Created:** [June 28, 2007, 8:14pm UTC](https://www.ruby-forum.com/t/undefined-method-s-in-a-gcalapi-class/108060 "2007-06-28T20:14:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![codecarpenter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/db5fbb/32.png) [@codecarpenter](https://www.ruby-forum.com/u/codecarpenter)\
**Post date:** [June 28, 2007, 8:14pm UTC](https://www.ruby-forum.com/t/undefined-method-s-in-a-gcalapi-class/108060/1 "2007-06-28T20:14:51Z")

</div>

Hi, I am using the gcalapi v 0.1.0 library and ran into a error when I  
called the add action. It generated “NoMethodError in  
EventController#Add undefined method `insert’ for  
GoogleCalendar::ServiceBase:Class” error message.  
I tried other methods in the googlecalendar/service\_base class but got  
the same error. The class file is correctly installed and using methods  
of other classes do not cause this problem. I am dumbfounded. Is this  
a configuration problem?  
My rails version is 1.2.3 and ruby version is 1.8.6. Please help!  
Below is code to illustrate my problem:

require “…”  
require “googlecalendar/service\_auth\_sub”  
require “googlecalendar/auth\_sub\_util”  
require “googlecalendar/calendar”  
require “googlecalendar/service”  
require “googlecalendar/service\_base”

REQUEST\_URL = “[Control API access with domain-wide delegation - Google Workspace Admin Help](https://www.google.com/accounts/AuthSubRequest)”  
SESSION\_URL = “[https://www.google.com/accounts/AuthSubSessionToken](https://www.google.com/accounts/AuthSubSessionToken)”  
REVOKE\_URL = “[https://www.google.com/accounts/AuthSubRevokeToken](https://www.google.com/accounts/AuthSubRevokeToken)”  
INFO\_URL = “[https://www.google.com/accounts/AuthSubTokenInfo](https://www.google.com/accounts/AuthSubTokenInfo)”  
CALENDAR\_SCOPE = “[http://www.google.com/calendar/feeds/](http://www.google.com/calendar/feeds/)”  
DEFAULT\_CALENDAR\_FEED =  
“[http://www.google.com/calendar/feeds/default/private/full](http://www.google.com/calendar/feeds/default/private/full)”  
MAIL = “my\_email\_address”  
PASS = “my\_password”  
FEED =  
“[http://www.google.com/calendar/feeds/my\_email\_address/private/full](http://www.google.com/calendar/feeds/my_email_address/private/full)”

class EventController \< ApplicationController

def Add

```
...

request_url =

```

GoogleCalendar::AuthSubUtil.build\_request\_url(“[http://127.0.0.1:3000/event/index](http://127.0.0.1:3000/event/index)”,  
“[http://www.google.com/calendar/feeds/](http://www.google.com/calendar/feeds/)”, 0, 1)

```
...

one_time_token =

```

GoogleCalendar::AuthSubUtil.get\_one\_time\_token(page.links.first.href)

```
...

srv = GoogleCalendar::ServiceAuthSub.new(one_time_token)

ret = srv.query(FEED, {})

cal = GoogleCalendar::Calendar.new(GoogleCalendar::Service.new(MAIL,

```

PASS), DEFAULT\_CALENDAR\_FEED)

```
...

GoogleCalendar::ServiceBase.insert(FEED, event)

```

end

end

Thanks in advance!
