Class: CiscoWebex::MessagingPeople

Inherits:
Messaging
  • Object
show all
Defined in:
lib/Messaging/People.rb

Instance Method Summary collapse

Methods inherited from Messaging

#audit_events, #classifications, #head, #memberships, #messages, #people, #post, #put, #rooms, #teams, #webhooks

Constructor Details

#initialize(token = nil) ⇒ MessagingPeople

initialize object with stored token



6
7
8
9
10
11
12
13
# File 'lib/Messaging/People.rb', line 6

def initialize(token=nil)
	if token == nil
		STDERR.puts "Must provide API key for CiscoWebex::Messaging::MessagingPeople"
		return false
	else
		@auth_token = token if token
	end
end

Instance Method Details

#create(params) ⇒ Object



63
64
65
# File 'lib/Messaging/People.rb', line 63

def create(params)
	return CiscoWebex::Rest.post(@auth_token, "/v1/people", params) rescue false
end

#delete(id) ⇒ Object



67
68
69
# File 'lib/Messaging/People.rb', line 67

def delete(id)
	return CiscoWebex::Rest.delete(@auth_token, "/v1/people/#{id}") rescue false
end

#get(id, limit = 5000) ⇒ Object



40
41
42
# File 'lib/Messaging/People.rb', line 40

def get(id, limit=5000)
	return CiscoWebex::Rest.get(@auth_token, "/v1/people/#{id}", {}, limit) rescue false
end

#list(params = {}, limit = 5000) ⇒ Object



44
45
46
# File 'lib/Messaging/People.rb', line 44

def list(params={}, limit=5000)
	return CiscoWebex::Rest.get(@auth_token, "/v1/people", params, limit) rescue false
end

#me(id, limit = 5000) ⇒ Object



36
37
38
# File 'lib/Messaging/People.rb', line 36

def me(id, limit=5000)
	return CiscoWebex::Rest.get(@auth_token, "/v1/people/me", {}, limit) rescue false
end

#patch(id, params) ⇒ Object



75
76
77
78
# File 'lib/Messaging/People.rb', line 75

def patch(id, params)
	STDERR.puts "CiscoWebex::Messaging::MessagingPeople.patch() - Metod not implemented"
	return false
end

#search(params = {}, limit = 5000) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/Messaging/People.rb', line 48

def search(params={}, limit=5000)
	if params.is_a?(String)
		if params.include?("@")
			params = { "email"=> params }
		else
			params = { "displayName"=> params }
		end
	elsif params.is_a?(Hash)
		STDERR.puts "CiscoWebex::Messaging::MessagingPeople.search - require email or displayname for search or custom Hash"
		return false
	else
		return CiscoWebex::Rest.get(@auth_token, "/v1/people", params, limit) rescue false				
	end
end

#templateObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/Messaging/People.rb', line 19

def template()
	return {
			"emails"=>[], 
			"phoneNumbers"=>[], 
			"extension"=>"", 
			"locationId"=>"", 
			"displayName"=>"", 
			"firstName"=>"", 
			"lastName"=>"", 
			"avatar"=>"", 
			"orgId"=>"", 
			"roles"=>[], 
			"licenses"=>[], 
			"siteUrls"=>[]
			}
end

#thisObject



15
16
17
# File 'lib/Messaging/People.rb', line 15

def this()
	puts "CiscoWebex::Messaging::MessagingPeople"
end

#update(id, params) ⇒ Object



71
72
73
# File 'lib/Messaging/People.rb', line 71

def update(id, params)
	return CiscoWebex::Rest.put(@auth_token, "/v1/people/#{id}", params) rescue false
end