Created
June 7, 2010 15:54
-
-
Save pristinenoise/428834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_add_contact(mode, options) | |
co_api = @connector.contacts_api | |
ce_hash = {:id => "_new_", :name => @details[:name], :emails => {:work => @details[:work]}, :primary_email => :work} | |
ce_hash[:emails][:home] = @details[:home] unless @details[:home].to_s.empty? | |
ce = GoogleAppsApi::ContactEntity.new(ce_hash) | |
if mode == "Run" | |
co_api.create_contact(ce) | |
@result = :success | |
else | |
@result = :would_have_run | |
end | |
end | |
def run_set_calendar_permission(mode, options) | |
c_api = @connector.calendar_api | |
user = GoogleAppsApi::UserEntity.new(:id => @details[:user]) | |
cal = GoogleAppsApi::CalendarEntity.new(@details[:calendar]) | |
if mode == "Run" | |
c_api.set_calendar_for_user(cal, user, :accesslevel => @details[:acl], :acl_comparison => @details[:acl_comparison], :color => @details[:color], :do_not_subscribe => @details[:do_not_subscribe]) | |
@result = :success | |
else | |
@result = :would_have_run | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment