echo-connector 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/echo-connector.rb +8 -8
- metadata +1 -1
data/lib/echo-connector.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Echo360
|
|
|
5
5
|
|
|
6
6
|
class Echo360
|
|
7
7
|
def initialize(site, consumer_key, consumer_secret, organisation = 0)
|
|
8
|
-
consumer=OAuth::Consumer.new consumer_key, consumer_secret,
|
|
8
|
+
consumer = OAuth::Consumer.new consumer_key, consumer_secret,
|
|
9
9
|
{ :site => site,
|
|
10
10
|
:request_token_path => "",
|
|
11
11
|
:authorize_path => "",
|
|
@@ -16,8 +16,8 @@ class Echo360
|
|
|
16
16
|
@organisation = getOrganizations[organisation][:id]
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def
|
|
20
|
-
users_xml =
|
|
19
|
+
def get_users
|
|
20
|
+
users_xml = get_users_xml
|
|
21
21
|
users = Array.new
|
|
22
22
|
users_xml.xpath("/people/person").each do |person|
|
|
23
23
|
id = person.search('id')[0].content
|
|
@@ -26,11 +26,11 @@ class Echo360
|
|
|
26
26
|
user_id = person.search('user-name')[0].content
|
|
27
27
|
users << { id: id, first_name: first_name, last_name: last_name, user_id: user_id }
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
users
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def
|
|
33
|
-
users_xml =
|
|
32
|
+
def get_user user_id
|
|
33
|
+
users_xml = get_users_xml
|
|
34
34
|
person = users_xml.xpath("/people/person[user-name/text() = \"#{user_id}\"]")[0]
|
|
35
35
|
raise "User not found: #{user_id}" if person.nil?
|
|
36
36
|
id = person.search('id')[0].content
|
|
@@ -65,7 +65,7 @@ class Echo360
|
|
|
65
65
|
|
|
66
66
|
private
|
|
67
67
|
|
|
68
|
-
def
|
|
68
|
+
def get_users_xml
|
|
69
69
|
Nokogiri.XML @access_token.get("/ess/scheduleapi/v1/people").body
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -81,7 +81,7 @@ class Echo360
|
|
|
81
81
|
orgs << { name: name, id: id }
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
orgs
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|