Class: SakaiInfo::QuizAttemptItemAttachment
- Inherits:
-
SakaiObject
- Object
- SakaiObject
- SakaiInfo::QuizAttemptItemAttachment
- Includes:
- ModProps
- Defined in:
- lib/sakai-info/quiz.rb
Instance Attribute Summary collapse
-
#dbrow ⇒ Object
readonly
Returns the value of attribute dbrow.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
-
#filesize ⇒ Object
readonly
Returns the value of attribute filesize.
-
#mimetype ⇒ Object
readonly
Returns the value of attribute mimetype.
-
#quiz_attempt_item_id ⇒ Object
readonly
Returns the value of attribute quiz_attempt_item_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes inherited from SakaiObject
Class Method Summary collapse
- .clear_cache ⇒ Object
- .find(id) ⇒ Object
- .find_by_quiz_attempt_item_id(quiz_attempt_item_id) ⇒ Object
Instance Method Summary collapse
- #attempt_item_summary_serialization ⇒ Object
- #default_serialization ⇒ Object
-
#initialize(dbrow) ⇒ QuizAttemptItemAttachment
constructor
A new instance of QuizAttemptItemAttachment.
- #quiz_attempt_item ⇒ Object
- #summary_serialization ⇒ Object
Methods included from ModProps
Methods inherited from SakaiObject
all_serializations, #dbrow_only_serialization, #dbrow_serialization, descendants, #object_type_serialization, #serialize, #shell_serialization, #to_csv, #to_json, #to_yaml
Constructor Details
#initialize(dbrow) ⇒ QuizAttemptItemAttachment
Returns a new instance of QuizAttemptItemAttachment.
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 |
# File 'lib/sakai-info/quiz.rb', line 1047 def initialize(dbrow) @dbrow = dbrow @id = dbrow[:mediaid] @quiz_attempt_item_id = dbrow[:itemgradingid] @status = dbrow[:status] @filepath = dbrow[:location] @filename = dbrow[:filename] @filesize = dbrow[:filesize] @mimetype = dbrow[:mimetype] @description = dbrow[:description] end |
Instance Attribute Details
#dbrow ⇒ Object (readonly)
Returns the value of attribute dbrow.
1033 1034 1035 |
# File 'lib/sakai-info/quiz.rb', line 1033 def dbrow @dbrow end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
1034 1035 1036 |
# File 'lib/sakai-info/quiz.rb', line 1034 def description @description end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
1033 1034 1035 |
# File 'lib/sakai-info/quiz.rb', line 1033 def filename @filename end |
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
1033 1034 1035 |
# File 'lib/sakai-info/quiz.rb', line 1033 def filepath @filepath end |
#filesize ⇒ Object (readonly)
Returns the value of attribute filesize.
1033 1034 1035 |
# File 'lib/sakai-info/quiz.rb', line 1033 def filesize @filesize end |
#mimetype ⇒ Object (readonly)
Returns the value of attribute mimetype.
1033 1034 1035 |
# File 'lib/sakai-info/quiz.rb', line 1033 def mimetype @mimetype end |
#quiz_attempt_item_id ⇒ Object (readonly)
Returns the value of attribute quiz_attempt_item_id.
1034 1035 1036 |
# File 'lib/sakai-info/quiz.rb', line 1034 def quiz_attempt_item_id @quiz_attempt_item_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
1033 1034 1035 |
# File 'lib/sakai-info/quiz.rb', line 1033 def status @status end |
Class Method Details
.clear_cache ⇒ Object
1042 1043 1044 |
# File 'lib/sakai-info/quiz.rb', line 1042 def self.clear_cache @@cache = {} end |
.find(id) ⇒ Object
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 |
# File 'lib/sakai-info/quiz.rb', line 1069 def self.find(id) id = id.to_s if @@cache[id].nil? row = DB.connect[:sam_media_t].where(:mediaid => id).first if row.nil? raise ObjectNotFoundException.new(QuizAttemptItemAttachment, id) end @@cache[id] = QuizAttemptItemAttachment.new(row) end @@cache[id] end |
.find_by_quiz_attempt_item_id(quiz_attempt_item_id) ⇒ Object
1064 1065 1066 1067 |
# File 'lib/sakai-info/quiz.rb', line 1064 def self.find_by_quiz_attempt_item_id(quiz_attempt_item_id) DB.connect[:sam_media_t].where(:itemgradingid => quiz_attempt_item_id). all.collect { |row| QuizAttemptItemAttachment.new(row) } end |
Instance Method Details
#attempt_item_summary_serialization ⇒ Object
1101 1102 1103 1104 1105 1106 |
# File 'lib/sakai-info/quiz.rb', line 1101 def attempt_item_summary_serialization { "id" => self.id, "filename" => self.filename } end |
#default_serialization ⇒ Object
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File 'lib/sakai-info/quiz.rb', line 1082 def default_serialization { "id" => self.id, "filename" => self.filename, "mimetype" => self.mimetype, "filesize" => self.filesize, "status" => self.status, "quiz_attempt_item" => self.quiz_attempt_item.serialize(:summary) } end |
#quiz_attempt_item ⇒ Object
1060 1061 1062 |
# File 'lib/sakai-info/quiz.rb', line 1060 def quiz_attempt_item @quiz_attempt_item ||= QuizAttemptItem.find(@quiz_attempt_item_id) end |
#summary_serialization ⇒ Object
1093 1094 1095 1096 1097 1098 1099 |
# File 'lib/sakai-info/quiz.rb', line 1093 def summary_serialization { "id" => self.id, "filename" => self.filename, "quiz_attempt_item_id" => self.quiz_attempt_item_id } end |