adobe_connect_api 0.0.70.alpha → 0.1

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.
@@ -50,9 +50,21 @@ class AdobeConnectAPI
50
50
  @sessionid
51
51
  end
52
52
 
53
+ def pointconfig=(pointconfig)
54
+ if pointconfig == nil
55
+ pointconfig = YAML::load_file("#{root_directory}/config/config.breeze.yml")[environment]
56
+ else
57
+ @pointconfig = pointconfig
58
+ end
59
+ end
60
+
53
61
  #The URL is the base URL of the Connect-Server, without the trailing slash
54
62
  def initialize (url = nil, environment, root_directory)
55
- @pointconfig = YAML::load_file("#{root_directory}/config/config.breeze.yml")[environment]
63
+ begin
64
+ @pointconfig = YAML::load_file("#{root_directory}/config/config.breeze.yml")[environment]
65
+ rescue
66
+ # should not occur except when running tests
67
+ end
56
68
  if (url == nil)
57
69
  @url = @pointconfig["url"]
58
70
  else
@@ -166,10 +178,7 @@ class AdobeConnectAPI
166
178
 
167
179
  def get_my_meetings_folder(email)
168
180
  # NOTE: this id does not change unless we set up AC new
169
- # tree_id = 14
170
- # since we migrated to the new hardware, the tree_id changed
171
- # i.e. sco-id of the user content folder, see: https://collab-test.switch.ch/api/xml?action=sco-shortcuts
172
- tree_id = 11
181
+ tree_id = 14
173
182
 
174
183
  filter = AdobeConnectApi::FilterDefinition.new
175
184
  filter["name"] == email
@@ -211,9 +220,18 @@ class AdobeConnectAPI
211
220
  return res.body
212
221
  end
213
222
 
214
- # TODO KG: test
223
+ #action=group-membership-update&group-id=integer&principal-id=integer&is-member=boolean
224
+ def group_membership_update(group_id, principal_id, is_member)
225
+ res = query("group-membership-update",
226
+ "group-id" => group_id,
227
+ "principal-id" => principal_id,
228
+ "is-member" => is_member)
229
+
230
+ return res.body
231
+ end
232
+
215
233
  def update_meeting(sco_id, description, language)
216
- "action = sco-update&sco-id=&description=&lang="
234
+ # "action = sco-update&sco-id=&description=&lang="
217
235
  res = query("sco-update",
218
236
  "sco-id" => sco_id,
219
237
  "description" => description,
@@ -223,17 +241,9 @@ class AdobeConnectAPI
223
241
  end
224
242
 
225
243
 
226
- # TODO KG: test statistic functions
227
244
 
228
- #action=group-membership-update&group-id=integer&principal-id=integer&is-member=boolean
229
- def group_membership_update(group_id, principal_id, is_member)
230
- res = query("group-membership-update",
231
- "group-id" => group_id,
232
- "principal-id" => principal_id,
233
- "is-member" => is_member)
234
245
 
235
- return res.body
236
- end
246
+ ### STATISTIC FUNCTIONS (NOTE: NOT YET TESTED) ###
237
247
 
238
248
  # e.g. acl-field-update&acl-id=13117741&field-id=meeting-passcode&value=12345
239
249
  def set_passcode(acl_id, passcode)
@@ -4,7 +4,6 @@
4
4
  # filter["sco-id"].greater_than 25
5
5
  # filter["date-created"] <= Time.now
6
6
 
7
- # TODO KG: rename to AdobeConnectAPI since the class is also named API
8
7
  class AdobeConnectApi::FilterDefinition
9
8
  attr_accessor :rows
10
9
  attr_accessor :start
@@ -1,3 +1,3 @@
1
1
  module AdobeConnectApi
2
- VERSION = "0.0.70.alpha"
2
+ VERSION = "0.1"
3
3
  end
@@ -11,6 +11,8 @@ E_MAIL = 'testuser@switch.ch'
11
11
  FIRST_NAME = 'Test'
12
12
  LAST_NAME = 'User'
13
13
 
14
+ E_MAIL_2 = 'testuser2@switch.ch'
15
+
14
16
  # API return values
15
17
  STATUS_OK = 'ok'
16
18
  NO_DATA = 'no-data'
@@ -21,7 +23,7 @@ CODE_DUPLICATE = 'duplicate'
21
23
  describe AdobeConnectAPI do
22
24
 
23
25
  before(:each) do
24
- @interactconfig = YAML::load_file("./config/config.breeze.yml")[ENV["RAILS_ENV"]]
26
+ @interactconfig = YAML::load_file('./config/config.breeze.yml')[ENV["RAILS_ENV"]]
25
27
  url = @interactconfig['url']
26
28
 
27
29
  # open AdobeConnectAPI (use URL from config file)
@@ -70,6 +72,7 @@ describe AdobeConnectAPI do
70
72
 
71
73
  it 'should return the id of my-meetings folder' do
72
74
  folder = @acs.get_my_meetings_folder(@interactconfig['test_user'])
75
+ puts folder
73
76
  @acs.get_folder_id(folder).to_i.should_not be 0
74
77
  end
75
78
 
@@ -99,12 +102,18 @@ describe AdobeConnectAPI do
99
102
  password = @interactconfig['password']
100
103
  @acs.login(login, password)
101
104
 
102
- # delete the user if it already exists
105
+ # delete the users if they already exist
103
106
  filter = AdobeConnectApi::FilterDefinition.new
104
107
  filter["email"] == E_MAIL
105
108
  principal = @acs.get_principal(filter)
106
109
  sco_id = @acs.get_principal_id(principal)
107
110
  @acs.delete_user(sco_id) unless sco_id.nil?
111
+
112
+ filter2 = AdobeConnectApi::FilterDefinition.new
113
+ filter2["email"] == E_MAIL_2
114
+ principal2 = @acs.get_principal(filter2)
115
+ sco_id2 = @acs.get_principal_id(principal2)
116
+ @acs.delete_user(sco_id2) unless sco_id2.nil?
108
117
  end
109
118
 
110
119
  it 'should be able to create a user' do
@@ -117,6 +126,23 @@ describe AdobeConnectAPI do
117
126
  # should return the sco-id of the new user
118
127
  @acs.get_principal_id(res).to_i.should_not be 0
119
128
  end
129
+
130
+ it 'should be able to update the group membership' do
131
+ # get id of the authors group
132
+ filter_authors = AdobeConnectApi::FilterDefinition.new
133
+ filter_authors["type"] == "authors"
134
+ res = @acs.get_principal(filter_authors)
135
+ authors_group_id = @acs.get_principal_id(res)
136
+ authors_group_id.to_i.should_not be 0
137
+
138
+ # create user
139
+ password = @interactconfig['generic_user_password']
140
+ res = @acs.create_user(E_MAIL_2, E_MAIL_2, password, FIRST_NAME, LAST_NAME)
141
+ sco_id = @acs.get_principal_id(res)
142
+
143
+ @acs.group_membership_update(authors_group_id, sco_id, true).should include(STATUS_OK)
144
+ end
145
+
120
146
  end
121
147
 
122
148
 
@@ -176,6 +202,11 @@ describe AdobeConnectAPI do
176
202
  @acs.get_sco_id(res).should eq @sco_id
177
203
  end
178
204
 
205
+ it 'should update the meeting attributes' do
206
+ res = @acs.update_meeting(@sco_id, 'description', 'en')
207
+ @acs.get_status_code(res).should match STATUS_OK
208
+ end
209
+
179
210
  end
180
211
 
181
212
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adobe_connect_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.70.alpha
5
- prerelease: 7
4
+ version: '0.1'
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Rohrer
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-29 00:00:00.000000000 Z
12
+ date: 2013-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -81,9 +81,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
- - - ! '>'
84
+ - - ! '>='
85
85
  - !ruby/object:Gem::Version
86
- version: 1.3.1
86
+ version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
89
  rubygems_version: 1.8.25