Class: OSCRuby::Answer
- Inherits:
-
Object
- Object
- OSCRuby::Answer
- Includes:
- ClassFactoryModule, QueryModule, ValidationsModule
- Defined in:
- lib/osc_ruby/answer.rb
Instance Attribute Summary collapse
-
#accessLevels ⇒ Object
Returns the value of attribute accessLevels.
-
#adminLastAccessTime ⇒ Object
Returns the value of attribute adminLastAccessTime.
-
#answerType ⇒ Object
Returns the value of attribute answerType.
-
#createdTime ⇒ Object
Returns the value of attribute createdTime.
-
#expiresDate ⇒ Object
Returns the value of attribute expiresDate.
-
#guidedAssistance ⇒ Object
Returns the value of attribute guidedAssistance.
-
#id ⇒ Object
Returns the value of attribute id.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#language ⇒ Object
Returns the value of attribute language.
-
#lastAccessTime ⇒ Object
Returns the value of attribute lastAccessTime.
-
#lastNotificationTime ⇒ Object
Returns the value of attribute lastNotificationTime.
-
#lookupName ⇒ Object
Returns the value of attribute lookupName.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nextNotificationTime ⇒ Object
Returns the value of attribute nextNotificationTime.
-
#originalReferenceNumber ⇒ Object
Returns the value of attribute originalReferenceNumber.
-
#positionInList ⇒ Object
Returns the value of attribute positionInList.
-
#publishOnDate ⇒ Object
Returns the value of attribute publishOnDate.
-
#question ⇒ Object
Returns the value of attribute question.
-
#solution ⇒ Object
Returns the value of attribute solution.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#updatedByAccount ⇒ Object
Returns the value of attribute updatedByAccount.
-
#updatedTime ⇒ Object
Returns the value of attribute updatedTime.
-
#uRL ⇒ Object
Returns the value of attribute uRL.
Class Method Summary collapse
- .all(client, return_json = false) ⇒ Object
- .check_for_language_and_type(obj_attrs) ⇒ Object
- .check_self(obj, is_update = false) ⇒ Object
- .find(client, id = nil, return_json = false) ⇒ Object
- .where(client, query = '', return_json = false) ⇒ Object
Instance Method Summary collapse
- #create(client, return_json = false) ⇒ Object
- #destroy(client, return_json = false) ⇒ Object
-
#initialize(attributes = nil) ⇒ Answer
constructor
A new instance of Answer.
-
#set_attributes(response_body) ⇒ Object
Convenience Methods for making the CRUD operations nicer to use.
- #update(client, return_json = false) ⇒ Object
Methods included from ClassFactoryModule
create, destroy, instantiate_multiple_objects, new_from_fetch, update
Methods included from ValidationsModule
attr_hash_exists_and_is_type_of, check_attributes, check_client, check_for_id, check_object_for_id, check_query, extract_attributes
Methods included from QueryModule
check_obj_for_errors, create, destroy, normalize, update
Constructor Details
#initialize(attributes = nil) ⇒ Answer
Returns a new instance of Answer.
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 |
# File 'lib/osc_ruby/answer.rb', line 19 def initialize(attributes = nil) if attributes.nil? @answerType = {} @summary = "Answer summary text" @language = {} @question = nil else @id = attributes["id"] @lookupName = attributes["lookupName"] @createdTime = attributes["createdTime"] @updatedTime = attributes["updatedTime"] @accessLevels = attributes["accessLevels"] @name = attributes["name"] @adminLastAccessTime = attributes["adminLastAccessTime"] @answerType = attributes["answerType"] @expiresDate = attributes["expiresDate"] @guidedAssistance = attributes["guidedAssistance"] @keywords = attributes["keywords"] @language = attributes["language"] @lastAccessTime = attributes["lastAccessTime"] @lastNotificationTime = attributes["lastNotificationTime"] @nextNotificationTime = attributes["nextNotificationTime"] @originalReferenceNumber = attributes["originalReferenceNumber"] @positionInList = attributes["positionInList"] @publishOnDate = attributes["publishOnDate"] @question = attributes["question"] @solution = attributes["solution"] @summary = attributes["summary"] @updatedByAccount = attributes["updatedByAccount"] @uRL = attributes["uRL"] end end |
Instance Attribute Details
#accessLevels ⇒ Object
Returns the value of attribute accessLevels.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def accessLevels @accessLevels end |
#adminLastAccessTime ⇒ Object
Returns the value of attribute adminLastAccessTime.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def adminLastAccessTime @adminLastAccessTime end |
#answerType ⇒ Object
Returns the value of attribute answerType.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def answerType @answerType end |
#createdTime ⇒ Object
Returns the value of attribute createdTime.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def createdTime @createdTime end |
#expiresDate ⇒ Object
Returns the value of attribute expiresDate.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def expiresDate @expiresDate end |
#guidedAssistance ⇒ Object
Returns the value of attribute guidedAssistance.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def guidedAssistance @guidedAssistance end |
#id ⇒ Object
Returns the value of attribute id.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def id @id end |
#keywords ⇒ Object
Returns the value of attribute keywords.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def keywords @keywords end |
#language ⇒ Object
Returns the value of attribute language.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def language @language end |
#lastAccessTime ⇒ Object
Returns the value of attribute lastAccessTime.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def lastAccessTime @lastAccessTime end |
#lastNotificationTime ⇒ Object
Returns the value of attribute lastNotificationTime.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def lastNotificationTime @lastNotificationTime end |
#lookupName ⇒ Object
Returns the value of attribute lookupName.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def lookupName @lookupName end |
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def name @name end |
#nextNotificationTime ⇒ Object
Returns the value of attribute nextNotificationTime.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def nextNotificationTime @nextNotificationTime end |
#originalReferenceNumber ⇒ Object
Returns the value of attribute originalReferenceNumber.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def originalReferenceNumber @originalReferenceNumber end |
#positionInList ⇒ Object
Returns the value of attribute positionInList.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def positionInList @positionInList end |
#publishOnDate ⇒ Object
Returns the value of attribute publishOnDate.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def publishOnDate @publishOnDate end |
#question ⇒ Object
Returns the value of attribute question.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def question @question end |
#solution ⇒ Object
Returns the value of attribute solution.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def solution @solution end |
#summary ⇒ Object
Returns the value of attribute summary.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def summary @summary end |
#updatedByAccount ⇒ Object
Returns the value of attribute updatedByAccount.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def updatedByAccount @updatedByAccount end |
#updatedTime ⇒ Object
Returns the value of attribute updatedTime.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def updatedTime @updatedTime end |
#uRL ⇒ Object
Returns the value of attribute uRL.
16 17 18 |
# File 'lib/osc_ruby/answer.rb', line 16 def uRL @uRL end |
Class Method Details
.all(client, return_json = false) ⇒ Object
72 73 74 75 76 |
# File 'lib/osc_ruby/answer.rb', line 72 def self.all(client, return_json = false) ClassFactoryModule.all(client,'answers',return_json,OSCRuby::Answer) end |
.check_for_language_and_type(obj_attrs) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/osc_ruby/answer.rb', line 148 def self.check_for_language_and_type(obj_attrs) if ValidationsModule::attr_hash_exists_and_is_type_of(obj_attrs,'language','id',Fixnum) raise ArgumentError, 'Answer should at least the language, answerType, and summary set (new_answer.language = {"id" => 1}; new_answer.answerType = {"id" => 1}}; new_answer.summary = "This is the Answer Title")' end if ValidationsModule::attr_hash_exists_and_is_type_of(obj_attrs,'answerType','id',Fixnum) && ValidationsModule::attr_hash_exists_and_is_type_of(obj_attrs,'answerType','lookupName',String) raise ArgumentError, 'Answer should at least the language, answerType, and summary set (new_answer.language = {"id" => 1}; new_answer.answerType = {"id" => 1}}; new_answer.summary = "This is the Answer Title")' end obj_attrs end |
.check_self(obj, is_update = false) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/osc_ruby/answer.rb', line 134 def self.check_self(obj,is_update = false) obj_attrs = ValidationsModule::extract_attributes(obj) if is_update == false obj_attrs = check_for_language_and_type(obj_attrs) end obj_attrs end |
.find(client, id = nil, return_json = false) ⇒ Object
65 66 67 68 69 |
# File 'lib/osc_ruby/answer.rb', line 65 def self.find(client,id = nil,return_json = false) ClassFactoryModule.find(client,id,'answers',return_json,OSCRuby::Answer) end |
.where(client, query = '', return_json = false) ⇒ Object
78 79 80 81 82 |
# File 'lib/osc_ruby/answer.rb', line 78 def self.where(client, query = '', return_json = false) ClassFactoryModule.where(client,query,'answers',return_json,OSCRuby::Answer) end |
Instance Method Details
#create(client, return_json = false) ⇒ Object
58 59 60 61 62 |
# File 'lib/osc_ruby/answer.rb', line 58 def create(client,return_json = false) ClassFactoryModule.create(client,self,"/answers",return_json) end |
#destroy(client, return_json = false) ⇒ Object
90 91 92 93 94 |
# File 'lib/osc_ruby/answer.rb', line 90 def destroy(client, return_json = false) ClassFactoryModule.destroy(client,self,'answers',return_json) end |
#set_attributes(response_body) ⇒ Object
Convenience Methods for making the CRUD operations nicer to use
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/osc_ruby/answer.rb', line 108 def set_attributes(response_body) self.id = response_body['id'].to_i self.lookupName = response_body['lookupName'].to_i self.createdTime = response_body['createdTime'] self.updatedTime = response_body['updatedTime'] self.accessLevels = response_body['accessLevels'] self.adminLastAccessTime = response_body['adminLastAccessTime'] self.answerType = response_body['answerType'] self.expiresDate = response_body['expiresDate'] self.guidedAssistance = response_body['guidedAssistance'] self.keywords = response_body['keywords'] self.language = response_body['language'] self.lastAccessTime = response_body['lastAccessTime'] self.lastNotificationTime = response_body['lastNotificationTime'] self.name = response_body['name'].to_i self.nextNotificationTime = response_body['nextNotificationTime'] self.originalReferenceNumber = response_body['originalReferenceNumber'] self.positionInList = response_body['positionInList'] self.publishOnDate = response_body['publishOnDate'] self.question = response_body['question'] self.solution = response_body['solution'] self.summary = response_body['summary'] self.updatedByAccount = response_body['updatedByAccount'] self.uRL = response_body['uRL'] end |
#update(client, return_json = false) ⇒ Object
84 85 86 87 88 |
# File 'lib/osc_ruby/answer.rb', line 84 def update(client, return_json = false) ClassFactoryModule::update(client,self,"answers",return_json) end |