Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pristinenoise/428834 to your computer and use it in GitHub Desktop.
Save pristinenoise/428834 to your computer and use it in GitHub Desktop.
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