sakai-info 0.3.1 → 0.3.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.
@@ -1,5 +1,14 @@
1
1
  # sakai-info Change History #
2
2
 
3
+ ## 0.3.2 ##
4
+
5
+ *Released 2012-03-08*
6
+
7
+ * Site supports dbrow and ModProps, added published? method
8
+ * Page supports dbrow, improved serialization methods
9
+ * Tool supports dbrow, improved serialization methods
10
+ * CLI now supports page and tool objects
11
+
3
12
  ## 0.3.1 ##
4
13
 
5
14
  *Released 2012-02-29*
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # sakai-info #
2
2
 
3
+ last updated: 2012-03-08
4
+ author: David Adams (daveadams@gmail.com)
5
+ github url: https://github.com/daveadams/sakai-info
6
+
3
7
  *sakai-info* is a command line tool and a suite of Ruby libraries which enable
4
8
  the exploration of a Sakai database without the intermediation of a Java VM or
5
9
  any official Sakai code.
@@ -8,12 +12,6 @@ Because the primary goal of this tool is to assist in information gathering
8
12
  and troubleshooting, no capability to change the database is included in the
9
13
  tool or the libraries.
10
14
 
11
- ## Meta ##
12
-
13
- last updated: 2012-02-29
14
- author: David Adams (daveadams@gmail.com)
15
- github url: https://github.com/daveadams/sakai-info
16
-
17
15
  ## Testing ##
18
16
 
19
17
  Tests are defined in ./test using Test::Unit. The default `rake` action is to
@@ -26,7 +24,7 @@ Use `rake` to test and build the gem:
26
24
  $ rake gem:build
27
25
 
28
26
  The resulting gem will be saved to the working directory as
29
- `sakai-info-0.3.1.gem`.
27
+ `sakai-info-0.3.2.gem`.
30
28
 
31
29
  Cleanup built gems using:
32
30
 
data/ROADMAP.md CHANGED
@@ -1,14 +1,11 @@
1
1
  # sakai-info Roadmap #
2
2
 
3
- *Last updated 2012-02-29*
4
-
5
- ### 0.3.2 ###
6
-
7
- * CLI access to groups
3
+ *Last updated 2012-03-08*
8
4
 
9
5
  ### 0.3.3 ###
10
6
 
11
- * CLI access to pages and tools
7
+ * CLI access to groups
8
+ * User support for --mod and --dbrow
12
9
 
13
10
  ### 0.3.4 ###
14
11
 
@@ -32,8 +29,8 @@
32
29
 
33
30
  ### 0.4 ###
34
31
 
35
- * Standardized abstraction for user and site to support --mod and --dbrow
36
32
  * Sqlite test infrastructure for a few basic objects
33
+ * Command line tool name change to "sin"
37
34
 
38
35
  ### 0.5 ###
39
36
 
@@ -80,6 +80,8 @@ require 'sakai-info/sakai_xml_entity'
80
80
  # sakai object classes
81
81
  require 'sakai-info/user'
82
82
  require 'sakai-info/site'
83
+ require 'sakai-info/page'
84
+ require 'sakai-info/tool'
83
85
  require 'sakai-info/announcement'
84
86
  require 'sakai-info/assignment'
85
87
  require 'sakai-info/authz'
@@ -2,7 +2,7 @@
2
2
  # - sakai-info command line tool support
3
3
  #
4
4
  # Created 2012-02-19 daveadams@gmail.com
5
- # Last updated 2012-02-29 daveadams@gmail.com
5
+ # Last updated 2012-03-08 daveadams@gmail.com
6
6
  #
7
7
  # https://github.com/daveadams/sakai-info
8
8
  #
@@ -15,6 +15,8 @@ module SakaiInfo
15
15
  class CLI
16
16
  ObjectModes = {
17
17
  "site" => Site,
18
+ "page" => Page,
19
+ "tool" => Tool,
18
20
  "user" => User,
19
21
  "quiz" => Quiz,
20
22
  "quiz-section" => QuizSection,
@@ -2,7 +2,7 @@
2
2
  # - sakai-info command line help
3
3
  #
4
4
  # Created 2012-02-19 daveadams@gmail.com
5
- # Last updated 2012-02-29 daveadams@gmail.com
5
+ # Last updated 2012-03-08 daveadams@gmail.com
6
6
  #
7
7
  # https://github.com/daveadams/sakai-info
8
8
  #
@@ -20,7 +20,10 @@ sakai-info #{VERSION}
20
20
 
21
21
  Object commands:
22
22
  user User information
23
+
23
24
  site Site information
25
+ page Site page information
26
+ tool Page tool information
24
27
 
25
28
  quiz Quiz aka Assessment information, pending or published
26
29
  quiz-section Quiz section information, pending or published
@@ -130,9 +133,26 @@ sakai-info site
130
133
  --gradebook Print gradebook item info
131
134
  --realm Print site realm details
132
135
  --forums Print forum details
136
+ --mod Print creation/modification info
133
137
  --all Print all possible details
134
138
  EOF
135
139
 
140
+ "page" => <<EOF,
141
+ sakai-info page
142
+
143
+ Usage: sakai-info page <id> [<options>]
144
+
145
+ Prints information about the page ID specified, including tools.
146
+ EOF
147
+
148
+ "tool" => <<EOF,
149
+ sakai-info tool
150
+
151
+ Usage: sakai-info tool <id> [<options>]
152
+
153
+ Prints information about the tool ID specified.
154
+ EOF
155
+
136
156
  "quiz" => <<EOF,
137
157
  sakai-info quiz
138
158
 
@@ -0,0 +1,111 @@
1
+ # sakai-info/page.rb
2
+ # SakaiInfo::Page library
3
+ #
4
+ # Created 2012-03-08 daveadams@gmail.com
5
+ # Last updated 2012-03-08 daveadams@gmail.com
6
+ #
7
+ # https://github.com/daveadams/sakai-info
8
+ #
9
+ # This software is public domain.
10
+ #
11
+
12
+ module SakaiInfo
13
+ class Page < SakaiObject
14
+ attr_reader :title, :order, :layout, :site_id, :dbrow
15
+
16
+ @@cache = {}
17
+ def self.find(id)
18
+ if @@cache[id].nil?
19
+ row = DB.connect[:sakai_site_page].where(:page_id => id).first
20
+ if row.nil?
21
+ raise ObjectNotFoundException.new(Page, id)
22
+ end
23
+
24
+ @@cache[id] = Page.new(row)
25
+ end
26
+ @@cache[id]
27
+ end
28
+
29
+ def self.query_by_site_id(site_id)
30
+ DB.connect[:sakai_site_page].where(:site_id => site_id)
31
+ end
32
+
33
+ def self.count_by_site_id(site_id)
34
+ Page.query_by_site_id(site_id).count
35
+ end
36
+
37
+ def self.find_by_site_id(site_id)
38
+ Page.query_by_site_id(site_id).order(:site_order).all.
39
+ collect { |row| @@cache[row[:page_id]] = Page.new(row) }
40
+ end
41
+
42
+ def initialize(dbrow)
43
+ @dbrow = dbrow
44
+
45
+ @id = dbrow[:page_id]
46
+ @title = dbrow[:title]
47
+ @order = dbrow[:site_order].to_i
48
+ @layout = dbrow[:layout]
49
+ @site_id = dbrow[:site_id]
50
+ end
51
+
52
+ def site
53
+ @site ||= Site.find(@site_id)
54
+ end
55
+
56
+ def properties
57
+ @properties ||= PageProperty.find_by_page_id(@id)
58
+ end
59
+
60
+ def tools
61
+ @tools ||= Tool.find_by_page_id(@id)
62
+ end
63
+
64
+ # serialization
65
+ def summary_serialization
66
+ {
67
+ "id" => self.id,
68
+ "title" => self.title,
69
+ "site_id" => self.site_id
70
+ }
71
+ end
72
+
73
+ def site_summary_serialization
74
+ result = summary_serialization
75
+ result.delete("site_id")
76
+ result["order"] = self.order
77
+ result["tools"] = self.tools.collect { |tool| tool.serialize(:summary) }
78
+ if not self.properties.nil? and self.properties != {}
79
+ result["properties"] = self.properties
80
+ end
81
+ result
82
+ end
83
+
84
+ def default_serialization
85
+ result = site_summary_serialization
86
+ result["site"] = self.site.serialize(:summary)
87
+ result
88
+ end
89
+ end
90
+
91
+ class PageProperty
92
+ def self.get(page_id, property_name)
93
+ row = DB.connect[:sakai_site_page_property].
94
+ filter(:page_id => page_id, :name => property_name).first
95
+ if row.nil?
96
+ nil
97
+ else
98
+ row[:value].read
99
+ end
100
+ end
101
+
102
+ def self.find_by_page_id(page_id)
103
+ properties = {}
104
+ DB.connect[:sakai_site_page_property].where(:page_id => page_id).all.each do |row|
105
+ properties[row[:name]] = row[:value].read
106
+ end
107
+ return properties
108
+ end
109
+ end
110
+ end
111
+
@@ -2,7 +2,7 @@
2
2
  # SakaiInfo::Site library
3
3
  #
4
4
  # Created 2012-02-17 daveadams@gmail.com
5
- # Last updated 2012-02-28 daveadams@gmail.com
5
+ # Last updated 2012-03-08 daveadams@gmail.com
6
6
  #
7
7
  # https://github.com/daveadams/sakai-info
8
8
  #
@@ -11,49 +11,44 @@
11
11
 
12
12
  module SakaiInfo
13
13
  class Site < SakaiObject
14
- attr_reader :title, :type
15
- attr_reader :created_at, :modified_at
14
+ attr_reader :title, :type, :dbrow
15
+
16
+ include ModProps
17
+ created_by_key :createdby
18
+ created_at_key :createdon
19
+ modified_by_key :modifiedby
20
+ modified_at_key :modifiedon
16
21
 
17
22
  @@cache = {}
18
23
  def self.find(id)
19
24
  if @@cache[id].nil?
20
- db = DB.connect
21
- row = db.fetch("select site_id, title, type, " +
22
- "createdby, modifiedby, " +
23
- "to_char(createdon,'YYYY-MM-DD HH24:MI:SS') as created_at, " +
24
- "to_char(modifiedon,'YYYY-MM-DD HH24:MI:SS') as modified_at, " +
25
- "joinable, join_role " +
26
- "from sakai_site where site_id=?", id).first
25
+ row = DB.connect[:sakai_site].where(:site_id => id).first
27
26
  if row.nil?
28
27
  raise ObjectNotFoundException.new(Site, id)
29
28
  end
30
29
 
31
- joinable = false
32
- if row[:joinable].to_i == 1
33
- joinable = true
34
- end
35
-
36
- @@cache[id] = Site.new(id, row[:title], row[:type], row[:createdby],
37
- row[:created_at], row[:modifiedby], row[:modified_at],
38
- joinable, row[:join_role])
30
+ @@cache[id] = Site.new(row)
39
31
  end
40
32
  @@cache[id]
41
33
  end
42
34
 
43
- def initialize(id, title, type, created_by_user_id, created_at, modified_by_user_id, modified_at, joinable, join_role)
44
- @id = id
45
- @title = title
46
- @type = type
47
- @created_by_user_id = created_by_user_id
48
- @created_at = created_at
49
- @modified_by_user_id = modified_by_user_id
50
- @modified_at = modified_at
51
- @joinable = joinable
52
- @join_role_string = join_role.to_s
35
+ def initialize(dbrow)
36
+ @dbrow = dbrow
37
+
38
+ @id = dbrow[:site_id]
39
+ @title = dbrow[:title]
40
+ @type = dbrow[:type]
41
+ @is_joinable = (dbrow[:joinable].to_i == 1)
42
+ @is_published = (dbrow[:published].to_i == 1)
43
+ @join_role_string = dbrow[:join_role].to_s
53
44
  end
54
45
 
55
46
  def joinable?
56
- @joinable
47
+ @is_joinable
48
+ end
49
+
50
+ def published?
51
+ @is_published
57
52
  end
58
53
 
59
54
  def join_role
@@ -76,14 +71,6 @@ module SakaiInfo
76
71
  @assignments ||= Assignment.find_by_site_id(@id)
77
72
  end
78
73
 
79
- def created_by
80
- @created_by ||= User.find(@created_by_user_id)
81
- end
82
-
83
- def modified_by
84
- @modified_by ||= User.find(@modified_by_user_id)
85
- end
86
-
87
74
  def user_count
88
75
  @user_count ||=
89
76
  DB.connect[:sakai_site_user].filter(:site_id => @id).count
@@ -201,10 +188,6 @@ module SakaiInfo
201
188
  DB.connect[:sakai_site_user].where(:user_id => user_id).count
202
189
  end
203
190
 
204
- def self.count_by_type(type)
205
- DB.connect[:sakai_site].where(:type => type).count
206
- end
207
-
208
191
  def self.count_by_property(name, value)
209
192
  DB.connect[:sakai_site_property].
210
193
  where(:name => name, :to_char.sql_function(:value) => value).count
@@ -237,35 +220,30 @@ module SakaiInfo
237
220
  where(:type => type).all.collect{|r| r[:site_id]}
238
221
  end
239
222
 
223
+ # by_type queries
224
+ def self.query_by_type(type)
225
+ DB.connect[:sakai_site].where(:type => type)
226
+ end
227
+
228
+ def self.count_by_type(type)
229
+ Site.query_by_type(type).count
230
+ end
231
+
240
232
  def self.find_by_type(type)
241
- sites = []
242
- DB.connect.fetch("select site_id, title, type, " +
243
- "createdby, modifiedby, " +
244
- "to_char(createdon,'YYYY-MM-DD HH24:MI:SS') as created_at, " +
245
- "to_char(modifiedon,'YYYY-MM-DD HH24:MI:SS') as modified_at, " +
246
- "joinable, join_role " +
247
- "from sakai_site where type = ?", type) do |row|
248
- joinable = false
249
- if joinable_n.to_i == 1
250
- joinable = true
251
- end
252
- @@cache[row[:site_id]] = Site.new(row[:site_id], row[:title], row[:type], row[:createdby], row[:created_at], row[:modifiedby], row[:modified_at], joinable, row[:join_role])
253
- sites << @@cache[row[:site_id]]
254
- end
255
- sites
233
+ Site.query_by_type(type).all.collect{|row| @@cache[row[:site_id]] = Site.new(row)}
256
234
  end
257
235
 
236
+ ############################################################
258
237
  # serialization methods
259
238
  def default_serialization
260
239
  result = {
261
240
  "id" => self.id,
262
241
  "title" => self.title,
263
242
  "type" => self.type,
264
- "created_at" => self.created_at,
265
- "created_by" => self.created_by.serialize(:summary),
243
+ "is_published" => self.published?,
266
244
  "site_properties" => self.properties,
267
245
  "providers" => self.realm.providers,
268
- "joinable" => self.joinable?,
246
+ "is_joinable" => self.joinable?,
269
247
  "join_role" => (self.joinable? ? self.join_role : nil),
270
248
  "user_count" => self.user_count,
271
249
  "group_count" => self.group_count,
@@ -280,7 +258,7 @@ module SakaiInfo
280
258
  if result["providers"].nil? or result["providers"] == ""
281
259
  result.delete("providers")
282
260
  end
283
- if result["joinable"] == false
261
+ if result["is_joinable"] == false
284
262
  result.delete("join_role")
285
263
  end
286
264
  if self.gradebook.nil?
@@ -294,7 +272,7 @@ module SakaiInfo
294
272
  "id" => self.id,
295
273
  "title" => self.title,
296
274
  "type" => self.type,
297
- "created_by" => self.created_by.eid
275
+ "created_by" => self.created_by_id
298
276
  }
299
277
  end
300
278
 
@@ -306,7 +284,7 @@ module SakaiInfo
306
284
 
307
285
  def pages_serialization
308
286
  {
309
- "pages" => self.pages.collect { |pg| pg.serialize(:summary) }
287
+ "pages" => self.pages.collect { |pg| pg.serialize(:site_summary) }
310
288
  }
311
289
  end
312
290
 
@@ -437,189 +415,6 @@ module SakaiInfo
437
415
  end
438
416
  end
439
417
 
440
- class Page < SakaiObject
441
- attr_reader :title, :order, :layout, :site
442
-
443
- @@cache = {}
444
- def self.find(id)
445
- if @@cache[id].nil?
446
- row = DB.connect[:sakai_site_page].where(:page_id => id).first
447
- if row.nil?
448
- raise ObjectNotFoundException.new(Page, id)
449
- end
450
-
451
- site = Site.find(row[:site_id])
452
- @@cache[id] = Page.new(id, row[:title], row[:order].to_i, row[:layout], site)
453
- end
454
- @@cache[id]
455
- end
456
-
457
- def self.find_by_site_id(site_id)
458
- results = []
459
- site = Site.find(site_id)
460
- DB.connect[:sakai_site_page].
461
- where(:site_id => site_id).order(:site_order).all.each do |row|
462
- @@cache[row[:page_id]] =
463
- Page.new(row[:page_id], row[:title], row[:site_order].to_i,
464
- row[:layout], site)
465
- results << @@cache[row[:page_id]]
466
- end
467
- results
468
- end
469
-
470
- def initialize(id, title, order, layout, site)
471
- @id = id
472
- @title = title
473
- @order = order
474
- @layout = layout
475
- @site = site
476
- end
477
-
478
- def properties
479
- @properties ||= PageProperty.find_by_page_id(@id)
480
- end
481
-
482
- def tools
483
- @tools ||= Tool.find_by_page_id(@id)
484
- end
485
-
486
- # serialization
487
- def default_serialization
488
- {
489
- "id" => self.id,
490
- "title" => self.title,
491
- "order" => self.order,
492
- "tools" => self.tools.collect { |tool| tool.serialize(:summary) },
493
- "properties" => self.properties,
494
- "site_id" => self.site.id
495
- }.delete_if do |k,v|
496
- k == "properties" && v == {}
497
- end
498
- end
499
-
500
- def summary_serialization
501
- default_serialization.delete_if do |k,v|
502
- k == "site_id"
503
- end
504
- end
505
- end
506
-
507
- class PageProperty
508
- def self.get(page_id, property_name)
509
- row = DB.connect[:sakai_site_page_property].
510
- filter(:page_id => page_id, :name => property_name).first
511
- if row.nil?
512
- nil
513
- else
514
- row[:value].read
515
- end
516
- end
517
-
518
- def self.find_by_page_id(page_id)
519
- properties = {}
520
- DB.connect[:sakai_site_page_property].where(:page_id => page_id).all.each do |row|
521
- properties[row[:name]] = row[:value].read
522
- end
523
- return properties
524
- end
525
- end
526
-
527
- class Tool < SakaiObject
528
- attr_reader :title, :registration, :order, :layout, :page, :site
529
-
530
- @@cache = {}
531
- def self.find(id)
532
- if @@cache[id].nil?
533
- row = DB.connect[:sakai_site_tool].where(:tool_id => id).first
534
- if row.nil?
535
- raise ObjectNotFoundException.new(Tool, id)
536
- end
537
-
538
- page = Page.find(row[:page_id])
539
- @@cache[id] =
540
- Tool.new(id, row[:title], row[:registration], row[:page_order].to_i,
541
- row[:layout_hints], page)
542
- end
543
- @@cache[id]
544
- end
545
-
546
- def self.find_by_page_id(page_id)
547
- results = []
548
- page = Page.find(page_id)
549
- DB.connect[:sakai_site_tool].
550
- where(:page_id => page_id).order(:page_order).all.each do |row|
551
- @@cache[row[:tool_id]] =
552
- Tool.new(row[:tool_id], row[:title], row[:registration], row[:page_order].to_i,
553
- row[:layout_hints], page)
554
- results << @@cache[row[:tool_id]]
555
- end
556
- results
557
- end
558
-
559
- def initialize(id, title, registration, order, layout, page)
560
- @id = id
561
- @title = title
562
- @registration = registration
563
- @order = order
564
- @layout = layout
565
- @page = page
566
- @site = page.site
567
- end
568
-
569
- def properties
570
- @properties ||= ToolProperty.find_by_tool_id(@id)
571
- end
572
-
573
- # serialization
574
- def default_serialization
575
- result = {
576
- "id" => self.id,
577
- "registration" => self.registration,
578
- "title" => self.title,
579
- "site" => self.site.serialize(:summary),
580
- "page_id" => self.page.id,
581
- "order" => self.order,
582
- "layout" => self.layout,
583
- "properties" => self.properties
584
- }
585
- if result["properties"] == {}
586
- result.delete("properties")
587
- end
588
- if result["layout"].nil?
589
- result.delete("layout")
590
- end
591
- result
592
- end
593
-
594
- def summary_serialization
595
- {
596
- "id" => self.id,
597
- "registration" => self.registration,
598
- "title" => self.title
599
- }
600
- end
601
- end
602
-
603
- class ToolProperty
604
- def self.get(tool_id, property_name)
605
- row = DB.connect[:sakai_site_tool_property].
606
- filter(:tool_id => tool_id, :name => property_name).first
607
- if row.nil?
608
- nil
609
- else
610
- row[:value].read
611
- end
612
- end
613
-
614
- def self.find_by_tool_id(tool_id)
615
- properties = {}
616
- DB.connect[:sakai_site_tool_property].where(:tool_id => tool_id).all.each do |row|
617
- properties[row[:name]] = row[:value].read
618
- end
619
- return properties
620
- end
621
- end
622
-
623
418
  class SiteMembership < SakaiObject
624
419
  attr_reader :site, :user, :role
625
420
 
@@ -0,0 +1,116 @@
1
+ # sakai-info/tool.rb
2
+ # SakaiInfo::Tool library
3
+ #
4
+ # Created 2012-03-08 daveadams@gmail.com
5
+ # Last updated 2012-03-08 daveadams@gmail.com
6
+ #
7
+ # https://github.com/daveadams/sakai-info
8
+ #
9
+ # This software is public domain.
10
+ #
11
+
12
+ module SakaiInfo
13
+ class Tool < SakaiObject
14
+ attr_reader :title, :registration, :order, :layout, :page_id, :site_id, :dbrow
15
+
16
+ @@cache = {}
17
+ def self.find(id)
18
+ if @@cache[id].nil?
19
+ row = DB.connect[:sakai_site_tool].where(:tool_id => id).first
20
+ if row.nil?
21
+ raise ObjectNotFoundException.new(Tool, id)
22
+ end
23
+
24
+ @@cache[id] = Tool.new(row)
25
+ end
26
+ @@cache[id]
27
+ end
28
+
29
+ def self.query_by_page_id(page_id)
30
+ DB.connect[:sakai_site_tool].where(:page_id => page_id)
31
+ end
32
+
33
+ def self.count_by_page_id(page_id)
34
+ Tool.query_by_page_id(page_id).count
35
+ end
36
+
37
+ def self.find_by_page_id(page_id)
38
+ Tool.query_by_page_id(page_id).order(:page_order).all.
39
+ collect { |row| @@cache[row[:tool_id]] = Tool.new(row) }
40
+ end
41
+
42
+ def initialize(dbrow)
43
+ @dbrow = dbrow
44
+
45
+ @id = dbrow[:tool_id]
46
+ @title = dbrow[:title]
47
+ @registration = dbrow[:registration]
48
+ @order = dbrow[:page_order].to_i
49
+ @layout = dbrow[:layout_hints]
50
+ @page_id = dbrow[:page_id]
51
+ @site_id = dbrow[:site_id]
52
+ end
53
+
54
+ def page
55
+ @page ||= Page.find(@page_id)
56
+ end
57
+
58
+ def site
59
+ @site ||= Site.find(@site_id)
60
+ end
61
+
62
+ def properties
63
+ @properties ||= ToolProperty.find_by_tool_id(@id)
64
+ end
65
+
66
+ # serialization
67
+ def default_serialization
68
+ result = {
69
+ "id" => self.id,
70
+ "registration" => self.registration,
71
+ "title" => self.title,
72
+ "site" => self.site.serialize(:summary),
73
+ "page_id" => self.page_id,
74
+ "order" => self.order,
75
+ "layout" => self.layout,
76
+ "properties" => self.properties
77
+ }
78
+ if result["properties"] == {}
79
+ result.delete("properties")
80
+ end
81
+ if result["layout"].nil?
82
+ result.delete("layout")
83
+ end
84
+ result
85
+ end
86
+
87
+ def summary_serialization
88
+ {
89
+ "id" => self.id,
90
+ "registration" => self.registration,
91
+ "title" => self.title
92
+ }
93
+ end
94
+ end
95
+
96
+ class ToolProperty
97
+ def self.get(tool_id, property_name)
98
+ row = DB.connect[:sakai_site_tool_property].
99
+ filter(:tool_id => tool_id, :name => property_name).first
100
+ if row.nil?
101
+ nil
102
+ else
103
+ row[:value].read
104
+ end
105
+ end
106
+
107
+ def self.find_by_tool_id(tool_id)
108
+ properties = {}
109
+ DB.connect[:sakai_site_tool_property].where(:tool_id => tool_id).all.each do |row|
110
+ properties[row[:name]] = row[:value].read
111
+ end
112
+ return properties
113
+ end
114
+ end
115
+ end
116
+
@@ -1,3 +1,3 @@
1
1
  module SakaiInfo
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakai-info
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Adams
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-29 00:00:00 -06:00
18
+ date: 2012-03-08 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -57,6 +57,7 @@ extra_rdoc_files: []
57
57
  files:
58
58
  - lib/sakai-info.rb
59
59
  - lib/sakai-info/group.rb
60
+ - lib/sakai-info/tool.rb
60
61
  - lib/sakai-info/cli/help.rb
61
62
  - lib/sakai-info/site.rb
62
63
  - lib/sakai-info/assignment.rb
@@ -73,6 +74,7 @@ files:
73
74
  - lib/sakai-info/question_pool.rb
74
75
  - lib/sakai-info/message.rb
75
76
  - lib/sakai-info/content.rb
77
+ - lib/sakai-info/page.rb
76
78
  - lib/sakai-info/sakai_xml_entity.rb
77
79
  - bin/sakai-info
78
80
  - README.md