granicus-platform-api 0.1.9 → 0.9.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.
- data/.gitignore +3 -0
- data/README.rdoc +2 -2
- data/lib/granicus-platform-api/client.rb +503 -466
- data/lib/granicus-platform-api/entities.rb +235 -207
- data/lib/granicus-platform-api/granicus-platform-api.xml +2073 -1824
- data/lib/granicus-platform-api/version.rb +1 -1
- data/spec/fixtures/About Stacks.pdf +0 -0
- data/spec/fixtures/fixtures.yml +64 -0
- data/spec/fixtures/requests.xml +52 -52
- data/spec/granicus-platform-api_spec.rb +392 -234
- metadata +18 -15
- data/Gemfile.lock +0 -53
Binary file
|
@@ -0,0 +1,64 @@
|
|
1
|
+
streaming.granicus.com:
|
2
|
+
name: Dev Daily Build
|
3
|
+
camera_id: 3
|
4
|
+
folder_id: 7
|
5
|
+
event_id: 30
|
6
|
+
event_uid: 5fa327b8-906b-102b-b291-2f582cd39e9e
|
7
|
+
import_event_id: 26
|
8
|
+
update_event_id: 35
|
9
|
+
event_meta_id: 1775
|
10
|
+
clip_id: 246
|
11
|
+
import_clip_id: 375
|
12
|
+
clip_uid: fe2a4b4b-0a69-1029-bc86-1bdd06848612
|
13
|
+
clip_meta_id: 574
|
14
|
+
clip_foreign_id: 1
|
15
|
+
event_foreign_id: 1
|
16
|
+
server_id: 2
|
17
|
+
|
18
|
+
dev.dev.granicus.com:
|
19
|
+
name: Dev Daily Build
|
20
|
+
camera_id: 1
|
21
|
+
folder_id: 1
|
22
|
+
update_event_id: 760
|
23
|
+
event_meta_id: 8883
|
24
|
+
clip_id: 719
|
25
|
+
clip_uid: 0f5e350b-7546-102e-bb2d-9326039e1073
|
26
|
+
import_clip_id: 2230
|
27
|
+
clip_meta_id: 608
|
28
|
+
clip_foreign_id: 1
|
29
|
+
event_foreign_id: 1
|
30
|
+
server_id: 1
|
31
|
+
|
32
|
+
localhost:
|
33
|
+
name: Local Build
|
34
|
+
camera_id: 1
|
35
|
+
folder_id: 1
|
36
|
+
event_id: 813
|
37
|
+
event_uid: 42a8238d-7638-102e-bb2d-9326039e1073
|
38
|
+
update_event_id: 760
|
39
|
+
event_meta_id: 8883
|
40
|
+
clip_id: 719
|
41
|
+
clip_uid: 0f5e350b-7546-102e-bb2d-9326039e1073
|
42
|
+
import_clip_id: 2230
|
43
|
+
clip_meta_id: 608
|
44
|
+
clip_foreign_id: 1
|
45
|
+
event_foreign_id: 1
|
46
|
+
server_id: 1
|
47
|
+
|
48
|
+
camera:
|
49
|
+
BroadcastPort: 8080
|
50
|
+
Type: "Meeting"
|
51
|
+
ControlPort: 80
|
52
|
+
ExternalIP: 207.7.154.140
|
53
|
+
Identifier: testcamera01
|
54
|
+
InternalIP: localhost
|
55
|
+
Name: ".gem Test Camera"
|
56
|
+
|
57
|
+
event:
|
58
|
+
Name: "platform-api-rb unit test event"
|
59
|
+
Duration: 3600
|
60
|
+
FolderID: 7
|
61
|
+
CameraID: 100
|
62
|
+
ECommentEnabled: 1
|
63
|
+
AgendaPostedDate: "2011-09-01 00:00:00"
|
64
|
+
ECommentCloseOffset: 60
|
data/spec/fixtures/requests.xml
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
<Attendees xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="granicus:Attendee[4]">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
2
|
+
<item xsi:type="granicus:Attendee">
|
3
|
+
<ID xsi:type="xsd:int">346</ID>
|
4
|
+
<Name xsi:type="xsd:string">my test</Name>
|
5
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
6
|
+
<Chair xsi:type="xsd:boolean">false</Chair>
|
7
|
+
<OrderID xsi:type="xsd:int">1</OrderID>
|
8
|
+
</item>
|
9
|
+
<item xsi:type="granicus:Attendee">
|
10
|
+
<ID xsi:type="xsd:int">347</ID>
|
11
|
+
<Name xsi:type="xsd:string">Foo Fighters</Name>
|
12
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
13
|
+
<Chair xsi:type="xsd:boolean">false</Chair>
|
14
|
+
<OrderID xsi:type="xsd:int">2</OrderID>
|
15
|
+
</item>
|
16
|
+
<item xsi:type="granicus:Attendee">
|
17
|
+
<ID xsi:type="xsd:int">348</ID>
|
18
|
+
<Name xsi:type="xsd:string">another test</Name>
|
19
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
20
|
+
<Chair xsi:type="xsd:boolean">false</Chair>
|
21
|
+
<OrderID xsi:type="xsd:int">3</OrderID>
|
22
|
+
</item>
|
23
|
+
<item xsi:type="granicus:Attendee">
|
24
|
+
<Name xsi:type="xsd:string">Foo Fighters</Name>
|
25
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
26
|
+
<Chair xsi:type="xsd:boolean">true</Chair>
|
27
|
+
</item>
|
28
|
+
</Attendees>
|
29
|
+
|
30
|
+
|
31
|
+
<Attendees xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="ns4:Attendee[3]" SOAP-ENC:offset="[0]">
|
32
|
+
<item xsi:type="ns4:Attendee">
|
33
|
+
<ID xsi:type="xsd:int">349</ID>
|
34
|
+
<Name xsi:type="xsd:string">my test</Name>
|
35
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
36
|
+
<Chair xsi:type="xsd:boolean">false</Chair>
|
37
|
+
<OrderID xsi:type="xsd:int">1</OrderID>
|
38
|
+
</item>
|
39
|
+
<item xsi:type="ns4:Attendee">
|
40
|
+
<ID xsi:type="xsd:int">352</ID>
|
41
|
+
<Name xsi:type="xsd:string">Foo Fighters</Name>
|
42
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
43
|
+
<Chair xsi:type="xsd:boolean">false</Chair>
|
44
|
+
<OrderID xsi:type="xsd:int">2</OrderID>
|
45
|
+
</item>
|
46
|
+
<item xsi:type="ns4:Attendee">
|
47
|
+
<ID xsi:type="xsd:int">351</ID>
|
48
|
+
<Name xsi:type="xsd:string">another test</Name>
|
49
|
+
<Voting xsi:type="xsd:boolean">true</Voting>
|
50
|
+
<Chair xsi:type="xsd:boolean">false</Chair>
|
51
|
+
<OrderID xsi:type="xsd:int">3</OrderID>
|
52
|
+
</item>
|
53
|
+
</Attendees>
|
@@ -1,234 +1,392 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
GRANICUS_SITE
|
4
|
-
GRANICUS_LOGIN
|
5
|
-
GRANICUS_PASSWORD = ENV['
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
it "should
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
event
|
106
|
-
event.
|
107
|
-
event.
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
event
|
113
|
-
event.ID
|
114
|
-
event.
|
115
|
-
client.
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
it "
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
GRANICUS_SITE = ENV['GRANICUS_SITE']
|
4
|
+
GRANICUS_LOGIN = ENV['GRANICUS_LOGIN']
|
5
|
+
GRANICUS_PASSWORD = ENV['GRANICUS_PASSWORD']
|
6
|
+
|
7
|
+
unless GRANICUS_SITE && GRANICUS_LOGIN && GRANICUS_PASSWORD
|
8
|
+
raise "The environment variables GRANICUS_SITE, GRANICUS_LOGIN, GRANICUS_PASSWORD are required to be set on the system"
|
9
|
+
end
|
10
|
+
|
11
|
+
# load fixtures based on the GRANICUS_SITE environment variable
|
12
|
+
fixtures = YAML.load(ERB.new(File.new(File.dirname(__FILE__) + '/fixtures/fixtures.yml').read).result)
|
13
|
+
site_settings = fixtures[GRANICUS_SITE]
|
14
|
+
CAMERA = fixtures["camera"]
|
15
|
+
EVENT = fixtures["event"]
|
16
|
+
|
17
|
+
CAMERA_ID = site_settings["camera_id"]
|
18
|
+
FOLDER_ID = site_settings["folder_id"]
|
19
|
+
IMPORT_EVENT_ID = site_settings["import_event_id"]
|
20
|
+
UPDATE_EVENT_ID = site_settings["update_event_id"]
|
21
|
+
EVENT_META_ID = site_settings["event_meta_id"]
|
22
|
+
CLIP_ID = site_settings["clip_id"]
|
23
|
+
IMPORT_CLIP_ID = site_settings["import_clip_id"]
|
24
|
+
CLIP_UID = site_settings["clip_uid"]
|
25
|
+
CLIP_META_ID = site_settings["clip_meta_id"]
|
26
|
+
CLIP_FOREIGN_ID = site_settings["clip_foreign_id"]
|
27
|
+
EVENT_FOREIGN_ID = site_settings["event_foreign_id"]
|
28
|
+
SERVER_ID = site_settings["server_id"]
|
29
|
+
SITE_NAME = site_settings["name"]
|
30
|
+
|
31
|
+
client = GranicusPlatformAPI::Client.new GRANICUS_SITE, GRANICUS_LOGIN, GRANICUS_PASSWORD
|
32
|
+
|
33
|
+
# The projects method
|
34
|
+
describe GranicusPlatformAPI, "::Client.new" do
|
35
|
+
it "should log me in" do
|
36
|
+
logon = client.get_current_user_logon
|
37
|
+
logon.should == GRANICUS_LOGIN
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should support impersonation" do
|
41
|
+
client2 = GranicusPlatformAPI::Client.new GRANICUS_SITE, nil, nil
|
42
|
+
client2.impersonate client.impersonation_token
|
43
|
+
client2.get_current_user_logon.should == client.get_current_user_logon
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should support initialize without arguments" do
|
47
|
+
client2 = GranicusPlatformAPI::Client.new
|
48
|
+
client2.connect(GRANICUS_SITE, GRANICUS_LOGIN, GRANICUS_PASSWORD)
|
49
|
+
client2.get_current_user_logon
|
50
|
+
client2.logout
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe GranicusPlatformAPI, "::Client Camera Methods" do
|
55
|
+
before do
|
56
|
+
camera = GranicusPlatformAPI::CameraData.new
|
57
|
+
camera.BroadcastPort = CAMERA["BroadcastPort"]
|
58
|
+
camera.Type = CAMERA["Type"]
|
59
|
+
camera.ControlPort = CAMERA["ControlPort"]
|
60
|
+
camera.ExternalIP = CAMERA["ExternalIP"]
|
61
|
+
camera.Identifier = CAMERA["Identifier"]
|
62
|
+
camera.InternalIP = CAMERA["InternalIP"]
|
63
|
+
camera.Name = CAMERA["Name"]
|
64
|
+
@new_camera_id = client.create_camera camera
|
65
|
+
@camera = client.get_camera(@new_camera_id)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should create a camera" do
|
69
|
+
@new_camera_id.should_not == nil
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should get a camera" do
|
73
|
+
@camera.should_not == nil
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should get all cameras" do
|
77
|
+
cameras = client.get_cameras
|
78
|
+
found = cameras.find { |c| c.ID == @camera.ID }
|
79
|
+
found.should_not == nil
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should retrieve and update a camera" do
|
83
|
+
camera2 = client.get_camera @camera.ID
|
84
|
+
camera2.Name = 'test my new camera'
|
85
|
+
client.update_camera camera2
|
86
|
+
|
87
|
+
camera3 = client.get_camera @camera.ID
|
88
|
+
camera3.Name.should == 'test my new camera'
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should delete a camera" do
|
92
|
+
client.delete_camera @camera.ID
|
93
|
+
end
|
94
|
+
|
95
|
+
after do
|
96
|
+
client.delete_camera @camera.ID
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
describe GranicusPlatformAPI, "::Client Event Methods" do
|
102
|
+
before do
|
103
|
+
event = GranicusPlatformAPI::EventData.new
|
104
|
+
event.Name = EVENT["Name"]
|
105
|
+
event.Duration = EVENT["Duration"]
|
106
|
+
event.FolderID = EVENT["FolderID"]
|
107
|
+
event.CameraID = EVENT["CameraID"]
|
108
|
+
event.ECommentEnabled = EVENT["ECommentEnabled"]
|
109
|
+
event.AgendaPostedDate = EVENT["AgendaPostedDate"]
|
110
|
+
event.Attendees = []
|
111
|
+
event.ECommentCloseOffset = EVENT["ECommentCloseOffset"]
|
112
|
+
event.StartTime = Time.now() - 300
|
113
|
+
event.FolderID = client.get_folders()[0].ID
|
114
|
+
event.CameraID = client.get_cameras()[0].ID
|
115
|
+
@new_event_id = client.create_event event
|
116
|
+
@event = client.get_event @new_event_id
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should create an event" do
|
120
|
+
@new_event_id.should_not == nil
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should get an event by ID" do
|
124
|
+
# retrieve one
|
125
|
+
@event.should_not == nil
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should get an event by UID" do
|
129
|
+
# retrieve one by UID
|
130
|
+
event = client.get_event_by_uid @event.UID
|
131
|
+
event.ID.should == @event.ID
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should get all events" do
|
135
|
+
# retrieve many
|
136
|
+
events = client.get_events
|
137
|
+
found = events.find { |e| e.ID == @event.ID }
|
138
|
+
found.should_not == nil
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should be updatedable" do
|
142
|
+
# update
|
143
|
+
event = client.get_event @event.ID
|
144
|
+
event.Name = 'platform-api-rb unit test event updated'
|
145
|
+
client.update_event(event)
|
146
|
+
|
147
|
+
event2 = client.get_event @event.ID
|
148
|
+
event2.Name.should == 'platform-api-rb unit test event updated'
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should support metadata operations" do
|
152
|
+
event = client.get_event @event.ID
|
153
|
+
event.UID = ''
|
154
|
+
new_event_id = client.create_event event
|
155
|
+
new_event = client.get_event new_event_id
|
156
|
+
meta_arr = []
|
157
|
+
meta1 = GranicusPlatformAPI::MetaDataData.new
|
158
|
+
meta1.Name = 'test'
|
159
|
+
meta1.ForeignID = 1
|
160
|
+
meta2 = GranicusPlatformAPI::MetaDataData.new
|
161
|
+
meta2.Name = 'test 2'
|
162
|
+
meta2.ForeignID = 2
|
163
|
+
meta_arr << meta1
|
164
|
+
meta_arr << meta2
|
165
|
+
keytable = client.import_event_meta_data new_event_id, meta_arr
|
166
|
+
keytable[0].ForeignID.should == 1
|
167
|
+
keytable[1].ForeignID.should == 2
|
168
|
+
|
169
|
+
# fetch out the metadata and make sure it matches
|
170
|
+
meta_tree = client.get_event_meta_data new_event_id
|
171
|
+
meta_tree[0].ID.should == keytable[0].GranicusID
|
172
|
+
meta_tree[1].ID.should == keytable[1].GranicusID
|
173
|
+
|
174
|
+
# fetch out the metadata by UID and make sure it matches
|
175
|
+
meta_tree = client.get_event_meta_data_by_uid new_event.UID
|
176
|
+
meta_tree[0].ID.should == keytable[0].GranicusID
|
177
|
+
meta_tree[1].ID.should == keytable[1].GranicusID
|
178
|
+
|
179
|
+
client.delete_event new_event_id
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should have the EComment-specific fields" do
|
183
|
+
event = client.get_event @event.ID
|
184
|
+
event.NextStartDate.should_not == nil
|
185
|
+
event.ECommentEnabled.should_not == nil
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should get all events with matching foreign id" do
|
189
|
+
events = client.get_events_by_foreign_id EVENT_FOREIGN_ID
|
190
|
+
events.each do |event|
|
191
|
+
event.ForeignID.should == EVENT_FOREIGN_ID
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should update a simple property on requested event" do
|
196
|
+
event = client.get_event @event.ID
|
197
|
+
event.ID.should == @event.ID
|
198
|
+
event.Name = 'my test'
|
199
|
+
client.update_event event
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should add a complex property on requested event" do
|
203
|
+
event = client.get_event @event.ID
|
204
|
+
event.ID.should == @event.ID
|
205
|
+
att1 = GranicusPlatformAPI::Attendee.new
|
206
|
+
att1.Name = 'Foo Fighters'
|
207
|
+
att1.Voting = true
|
208
|
+
att1.Chair = true
|
209
|
+
event.Attendees << att1
|
210
|
+
client.update_event event
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should update a complex property on requested event" do
|
214
|
+
# create
|
215
|
+
event = client.get_event @event.ID
|
216
|
+
event.ID.should == @event.ID
|
217
|
+
att1 = GranicusPlatformAPI::Attendee.new
|
218
|
+
att1.Name = 'Foo Fighters'
|
219
|
+
att1.Voting = true
|
220
|
+
att1.Chair = true
|
221
|
+
event.Attendees << att1
|
222
|
+
client.update_event event
|
223
|
+
|
224
|
+
# update
|
225
|
+
event = client.get_event @event.ID
|
226
|
+
event.Attendees[0].Name = 'Nirvana'
|
227
|
+
client.update_event event
|
228
|
+
|
229
|
+
event = client.get_event @event.ID
|
230
|
+
event.ID.should == @event.ID
|
231
|
+
event.Attendees[0].Name.should == 'Nirvana'
|
232
|
+
end
|
233
|
+
|
234
|
+
it "set the event agenda url" do
|
235
|
+
client.set_event_agenda_url @event.ID, "http://github.com/gov20cto/granicus-platform-api"
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should delete event" do
|
239
|
+
client.delete_event @event.ID
|
240
|
+
end
|
241
|
+
|
242
|
+
after do
|
243
|
+
client.delete_event @event.ID
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
247
|
+
|
248
|
+
describe GranicusPlatformAPI, "::EComment Methods" do
|
249
|
+
it "should get ecomments by event id" do
|
250
|
+
comments = client.get_ecomments_by_event_id(811)
|
251
|
+
comments.should be_kind_of(Array)
|
252
|
+
end
|
253
|
+
|
254
|
+
it "should get ecomments by agenda item uid" do
|
255
|
+
comments = client.get_ecomments_by_agenda_item_uid("42a8238d-7638-102e-bb2d-9326039e1073")
|
256
|
+
comments.should be_kind_of(Array)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
describe GranicusPlatformAPI, "::Client Folder Methods" do
|
261
|
+
it "should get my folders" do
|
262
|
+
folders = client.get_folders
|
263
|
+
found = folders.find { |f| f.ID == FOLDER_ID }
|
264
|
+
found.should_not == nil
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
describe GranicusPlatformAPI, "::Client Clip Methods" do
|
269
|
+
it "should get clips from the given folder" do
|
270
|
+
clips = client.get_clips FOLDER_ID
|
271
|
+
clips.each do |clip|
|
272
|
+
clip.FolderID.should == FOLDER_ID
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
it "should get all clips with matching foreign id" do
|
277
|
+
clips = client.get_clips_by_foreign_id CLIP_FOREIGN_ID
|
278
|
+
clips.each do |clip|
|
279
|
+
clip.ForeignID.should == CLIP_FOREIGN_ID
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should get the requested clip" do
|
284
|
+
clip = client.get_clip CLIP_ID
|
285
|
+
clip.ID.should == CLIP_ID
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should update the given clip" do
|
289
|
+
clip = client.get_clip CLIP_ID
|
290
|
+
name = clip.Name
|
291
|
+
clip.Name = 'this is my test name'
|
292
|
+
client.update_clip clip
|
293
|
+
clip2 = client.get_clip CLIP_ID
|
294
|
+
clip2.Name.should == 'this is my test name'
|
295
|
+
clip2.Name = name
|
296
|
+
client.update_clip clip2
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should get the requested clip by UID" do
|
300
|
+
clip = client.get_clip_by_uid CLIP_UID
|
301
|
+
clip.UID.should == CLIP_UID
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should import metadata" do
|
305
|
+
meta_arr = []
|
306
|
+
meta1 = GranicusPlatformAPI::MetaDataData.new
|
307
|
+
meta1.Name = 'test'
|
308
|
+
meta1.TimeStamp = 0
|
309
|
+
meta1.ForeignID = 1
|
310
|
+
meta2 = GranicusPlatformAPI::MetaDataData.new
|
311
|
+
meta2.Name = 'test 2'
|
312
|
+
meta2.TimeStamp = 30
|
313
|
+
meta2.ForeignID = 2
|
314
|
+
meta_arr << meta1
|
315
|
+
meta_arr << meta2
|
316
|
+
keytable = client.import_clip_meta_data IMPORT_CLIP_ID, meta_arr
|
317
|
+
keytable[0].ForeignID.should == 1
|
318
|
+
keytable[1].ForeignID.should == 2
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
describe GranicusPlatformAPI, "::Client MetaData Methods" do
|
323
|
+
|
324
|
+
it "should get a clip's meta data" do
|
325
|
+
metadata = client.get_clip_meta_data CLIP_ID
|
326
|
+
found = metadata.find { |m| m.ID == CLIP_META_ID }
|
327
|
+
found.should_not == nil
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should get the requested meta data" do
|
331
|
+
metadata = client.get_meta_data CLIP_META_ID
|
332
|
+
metadata.ID = CLIP_META_ID
|
333
|
+
end
|
334
|
+
|
335
|
+
it "should support uploading and downloading documents" do
|
336
|
+
document = GranicusPlatformAPI::Document.new
|
337
|
+
document.Description = "My test document"
|
338
|
+
document.FileContents = fixture('About Stacks.pdf')
|
339
|
+
document.FileExtension = document.FileContents.path.split('.').last
|
340
|
+
document_meta = GranicusPlatformAPI::MetaDataData.new
|
341
|
+
document_meta.Name = 'test doc'
|
342
|
+
document_meta.ForeignID = 2
|
343
|
+
document_meta.Payload = document
|
344
|
+
document_meta.ParentID = CLIP_META_ID
|
345
|
+
keymap = client.add_clip_meta_data CLIP_ID, document_meta
|
346
|
+
attachment = client.fetch_attachment keymap[0].GranicusID
|
347
|
+
attachment.FileExtension.should == document.FileExtension
|
348
|
+
attachment.FileContents.length.should == document.FileContents.size
|
349
|
+
end
|
350
|
+
|
351
|
+
it "should update the metadata" do
|
352
|
+
metadata = client.get_meta_data CLIP_META_ID
|
353
|
+
old_name = metadata.Name
|
354
|
+
metadata.Name = 'test'
|
355
|
+
client.update_meta_data metadata
|
356
|
+
client.get_meta_data(CLIP_META_ID).Name.should == 'test'
|
357
|
+
metadata.Name = old_name
|
358
|
+
client.update_meta_data metadata
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
describe GranicusPlatformAPI, "::Client Server Methods" do
|
363
|
+
it "should get all servers" do
|
364
|
+
servers = client.get_servers
|
365
|
+
found = servers.find { |s| s.ID == SERVER_ID }
|
366
|
+
found.should_not == nil
|
367
|
+
end
|
368
|
+
|
369
|
+
it "should get the requested server" do
|
370
|
+
server = client.get_server SERVER_ID
|
371
|
+
server.ID.should == SERVER_ID
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
describe GranicusPlatformAPI, "::Settings Methods" do
|
376
|
+
it "should support getting settings" do
|
377
|
+
settings = client.get_settings
|
378
|
+
found = settings.find { |s| s.Name == "name" && s.Value == SITE_NAME }
|
379
|
+
found.should_not == nil
|
380
|
+
end
|
381
|
+
it "should not return database setting" do
|
382
|
+
settings = client.get_settings
|
383
|
+
found = settings.find { |s| s.Name == "database" }
|
384
|
+
found.should == nil
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
describe GranicusPlatformAPI, "::Client.logout" do
|
389
|
+
it "should log me out" do
|
390
|
+
value = client.logout
|
391
|
+
end
|
392
|
+
end
|