granicus-platform-api 0.1.0

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.
@@ -0,0 +1,3 @@
1
+ module GranicusPlatformAPI
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'granicus-platform-api/client'
2
+ require 'granicus-platform-api/version'
3
+
4
+ module GranicusPlatformAPI
5
+
6
+ end
@@ -0,0 +1,154 @@
1
+ require 'helper'
2
+
3
+ GRANICUS_SITE = ENV['SITE']
4
+ GRANICUS_LOGIN = ENV['USERNAME']
5
+ GRANICUS_PASSWORD = ENV['PASSWORD']
6
+ CAMERA_ID = 3
7
+ FOLDER_ID = 7
8
+ EVENT_ID = 30
9
+ EVENT_META_ID = 1775
10
+ CLIP_ID = 246
11
+ CLIP_UID = '00000000-0000-0000-0000-000000000000'
12
+ EVENT_UID = '00000000-0000-0000-0000-000000000000'
13
+ CLIP_META_ID = 574
14
+ CLIP_FOREIGN_ID = 1
15
+ EVENT_FOREIGN_ID = 1
16
+ SERVER_ID = 2
17
+
18
+ client = GranicusPlatformAPI::Client.new GRANICUS_SITE, GRANICUS_LOGIN, GRANICUS_PASSWORD
19
+
20
+ # The projects method
21
+ describe GranicusPlatformAPI, "::Client.login" do
22
+ it "should log me in" do
23
+ logon = client.get_current_user_logon
24
+ logon.should == GRANICUS_LOGIN
25
+ end
26
+ end
27
+
28
+ describe GranicusPlatformAPI, "::Client.get_cameras" do
29
+ it "should get my cameras" do
30
+ cameras = client.get_cameras
31
+ found = cameras.find {|c| c.id == CAMERA_ID }
32
+ found.should_not == nil
33
+ end
34
+ end
35
+
36
+ describe GranicusPlatformAPI, "::Client.get_camera" do
37
+ it "should get the requested camera" do
38
+ camera = client.get_camera CAMERA_ID
39
+ camera.id.should == CAMERA_ID
40
+ end
41
+ end
42
+
43
+ describe GranicusPlatformAPI, "::Client.get_events" do
44
+ it "should get my events" do
45
+ events = client.get_events
46
+ found = events.find {|e| e.id == EVENT_ID }
47
+ found.should_not == nil
48
+ end
49
+ end
50
+
51
+ describe GranicusPlatformAPI, "::Client.get_events_by_foreign_id" do
52
+ it "should get all events with matching foreign id" do
53
+ events = client.get_events_by_foreign_id EVENT_FOREIGN_ID
54
+ events.each do |event|
55
+ event.foreign_id.should == EVENT_FOREIGN_ID
56
+ end
57
+ end
58
+ end
59
+
60
+ describe GranicusPlatformAPI, "::Client.get_event" do
61
+ it "should get the requested event" do
62
+ event = client.get_event EVENT_ID
63
+ event.id.should == EVENT_ID
64
+ end
65
+ end
66
+
67
+ describe GranicusPlatformAPI, "::Client.get_event_by_uid" do
68
+ it "should get the requested event" do
69
+ event = client.get_event_by_uid EVENT_UID
70
+ event.id.should == EVENT_UID
71
+ end
72
+ end
73
+
74
+ describe GranicusPlatformAPI, "::Client.set_event_agenda_url" do
75
+ it "not return an error" do
76
+ event = client.set_event_agenda_url EVENT_ID, "http://github.com/gov20cto/granicus-platform-api"
77
+ end
78
+ end
79
+
80
+ describe GranicusPlatformAPI, "::Client.get_folders" do
81
+ it "should get my folders" do
82
+ folders = client.get_folders
83
+ folders[0].id.should == FOLDER_ID
84
+ end
85
+ end
86
+
87
+ describe GranicusPlatformAPI, "::Client.get_clips" do
88
+ it "should get clips from the given folder" do
89
+ clips = client.get_clips FOLDER_ID
90
+ clips.each do |clip|
91
+ clip.folder_id.should == FOLDER_ID
92
+ end
93
+ end
94
+ end
95
+
96
+ describe GranicusPlatformAPI, "::Client.get_clips_by_foreign_id" do
97
+ it "should get all clips with matching foreign id" do
98
+ clips = client.get_clips_by_foreign_id CLIP_FOREIGN_ID
99
+ clips.each do |clip|
100
+ clip.foreign_id.should == CLIP_FOREIGN_ID
101
+ end
102
+ end
103
+ end
104
+
105
+ describe GranicusPlatformAPI, "::Client.get_clip" do
106
+ it "should get the requested clip" do
107
+ clip = client.get_clip CLIP_ID
108
+ clip.id.should == CLIP_ID
109
+ end
110
+ end
111
+
112
+ describe GranicusPlatformAPI, "::Client.get_clip_by_uid" do
113
+ it "should get the requested clip" do
114
+ clip = client.get_clip_by_uid CLIP_UID
115
+ clip.id.should == CLIP_UID
116
+ end
117
+ end
118
+
119
+ describe GranicusPlatformAPI, "::Client.get_event_meta_data" do
120
+ it "should get my event meta data" do
121
+ metadata = client.get_event_meta_data EVENT_ID
122
+ found = metadata.find {|m| m.id == EVENT_META_ID }
123
+ found.should_not == nil
124
+ end
125
+ end
126
+
127
+ describe GranicusPlatformAPI, "::Client.get_clip_meta_data" do
128
+ it "should get my clip meta data" do
129
+ metadata = client.get_clip_meta_data CLIP_ID
130
+ found = metadata.find {|m| m.id == CLIP_META_ID }
131
+ found.should_not == nil
132
+ end
133
+ end
134
+
135
+ describe GranicusPlatformAPI, "::Client.get_servers" do
136
+ it "should get all servers" do
137
+ servers = client.get_servers
138
+ found = servers.find {|s| s.id == SERVER_ID }
139
+ found.should_not == nil
140
+ end
141
+ end
142
+
143
+ describe GranicusPlatformAPI, "::Client.get_server" do
144
+ it "should get the requested server" do
145
+ server = client.get_server SERVER_ID
146
+ server.id.should == SERVER_D
147
+ end
148
+ end
149
+
150
+ describe GranicusPlatformAPI, "::Client.logout" do
151
+ it "should log me out" do
152
+ value = client.logout
153
+ end
154
+ end
data/spec/helper.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'granicus-platform-api'
4
+
5
+ RSpec.configure do |config|
6
+ end
7
+
8
+ def fixture_path
9
+ File.expand_path("../fixtures", __FILE__)
10
+ end
11
+
12
+ def fixture(file)
13
+ File.new(fixture_path + '/' + file)
14
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: granicus-platform-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Javier Muniz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-06-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &2161339560 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.6'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2161339560
25
+ - !ruby/object:Gem::Dependency
26
+ name: hashie
27
+ requirement: &2161339060 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2161339060
36
+ - !ruby/object:Gem::Dependency
37
+ name: savon
38
+ requirement: &2161338600 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.9.2
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2161338600
47
+ - !ruby/object:Gem::Dependency
48
+ name: multi_xml
49
+ requirement: &2161338140 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.2
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2161338140
58
+ - !ruby/object:Gem::Dependency
59
+ name: savon
60
+ requirement: &2164389960 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 0.9.2
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *2164389960
69
+ - !ruby/object:Gem::Dependency
70
+ name: hashie
71
+ requirement: &2164389500 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.0.0
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *2164389500
80
+ - !ruby/object:Gem::Dependency
81
+ name: multi_xml
82
+ requirement: &2164389040 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 0.2.2
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *2164389040
91
+ description: Wrapper for the Granicus Open Platform API v1.x
92
+ email: javier@granicus.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - .gitignore
98
+ - .rspec
99
+ - Changelog
100
+ - Gemfile
101
+ - Gemfile.lock
102
+ - LICENSE
103
+ - README.rdoc
104
+ - granicus-platform-api.gemspec
105
+ - lib/granicus-platform-api.rb
106
+ - lib/granicus-platform-api/client.rb
107
+ - lib/granicus-platform-api/granicus-platform-api.xml
108
+ - lib/granicus-platform-api/version.rb
109
+ - spec/granicus-platform-api_spec.rb
110
+ - spec/helper.rb
111
+ homepage: http://github.com/gov20cto/granicus-platform-api
112
+ licenses: []
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project: granicus-platform-api
131
+ rubygems_version: 1.8.5
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Granicus Open Platform API 1.x Wrapper
135
+ test_files:
136
+ - spec/granicus-platform-api_spec.rb
137
+ - spec/helper.rb