Class: Twilio::REST::Knowledge::V1::KnowledgeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Knowledge::V1::KnowledgeContext
- Defined in:
- lib/twilio-ruby/rest/knowledge/v1/knowledge.rb
Instance Method Summary collapse
-
#chunks ⇒ ChunkList, ChunkContext
Access the chunks.
-
#delete ⇒ Boolean
Delete the KnowledgeInstance.
-
#fetch ⇒ KnowledgeInstance
Fetch the KnowledgeInstance.
-
#initialize(version, id) ⇒ KnowledgeContext
constructor
Initialize the KnowledgeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#knowledge_status ⇒ KnowledgeStatusList, KnowledgeStatusContext
Access the knowledge_status.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(knowledge_v1_service_update_knowledge_request: :unset) ⇒ KnowledgeInstance
Update the KnowledgeInstance.
Constructor Details
#initialize(version, id) ⇒ KnowledgeContext
Initialize the KnowledgeContext
326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 326 def initialize(version, id) super(version) # Path Solution @solution = { id: id, } @uri = "/Knowledge/#{@solution[:id]}" # Dependents @chunks = nil @knowledge_status = nil end |
Instance Method Details
#chunks ⇒ ChunkList, ChunkContext
Access the chunks
393 394 395 396 397 398 399 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 393 def chunks unless @chunks @chunks = ChunkList.new( @version, ) end @chunks end |
#delete ⇒ Boolean
Delete the KnowledgeInstance
340 341 342 343 344 345 346 347 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 340 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ KnowledgeInstance
Fetch the KnowledgeInstance
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 352 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) KnowledgeInstance.new( @version, payload, id: @solution[:id], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
420 421 422 423 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 420 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Knowledge.V1.KnowledgeContext #{context}>" end |
#knowledge_status ⇒ KnowledgeStatusList, KnowledgeStatusContext
Access the knowledge_status
404 405 406 407 408 409 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 404 def knowledge_status KnowledgeStatusContext.new( @version, @solution[:id] ) end |
#to_s ⇒ Object
Provide a user friendly representation
413 414 415 416 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 413 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Knowledge.V1.KnowledgeContext #{context}>" end |
#update(knowledge_v1_service_update_knowledge_request: :unset) ⇒ KnowledgeInstance
Update the KnowledgeInstance
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/twilio-ruby/rest/knowledge/v1/knowledge.rb', line 372 def update(knowledge_v1_service_update_knowledge_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' payload = @version.update('PUT', @uri, headers: headers, data: knowledge_v1_service_update_knowledge_request.to_json) KnowledgeInstance.new( @version, payload, id: @solution[:id], ) end |