Class: Twilio::REST::Memory::V1::ProfileContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Memory::V1::ProfileContext
- Defined in:
- lib/twilio-ruby/rest/memory/v1/profile.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ProfileInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ProfileInstanceMetadata.
-
#fetch(trait_groups: :unset) ⇒ ProfileInstance
Fetch the ProfileInstance.
-
#fetch_with_metadata(trait_groups: :unset) ⇒ ProfileInstance
Fetch the ProfileInstanceMetadata.
-
#initialize(version, store_id, profile_id) ⇒ ProfileContext
constructor
Initialize the ProfileContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#patch(profile_patch: nil) ⇒ ProfileInstance
Patch the ProfileInstance.
-
#patch_with_metadata(profile_patch: nil) ⇒ ProfileInstance
Patch the ProfileInstanceMetadata.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, store_id, profile_id) ⇒ ProfileContext
Initialize the ProfileContext
283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 283 def initialize(version, store_id, profile_id) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { store_id: store_id, profile_id: profile_id, } @uri = "/Stores/#{@solution[:store_id]}/Profiles/#{@solution[:profile_id]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ProfileInstance
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 297 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) ProfileInstance.new( @version, response.body, store_id: @solution[:store_id], profile_id: @solution[:profile_id], ) end |
#delete_with_metadata ⇒ Boolean
Delete the ProfileInstanceMetadata
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 316 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) profile_instance = ProfileInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ProfileInstanceMetadata.new(@version, profile_instance, response.headers, response.status_code) end |
#fetch(trait_groups: :unset) ⇒ ProfileInstance
Fetch the ProfileInstance
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 336 def fetch( trait_groups: :unset ) params = Twilio::Values.of({ 'traitGroups' => trait_groups, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, params: params, headers: headers) ProfileInstance.new( @version, payload, store_id: @solution[:store_id], profile_id: @solution[:profile_id], ) end |
#fetch_with_metadata(trait_groups: :unset) ⇒ ProfileInstance
Fetch the ProfileInstanceMetadata
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 362 def ( trait_groups: :unset ) params = Twilio::Values.of({ 'traitGroups' => trait_groups, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, params: params, headers: headers) profile_instance = ProfileInstance.new( @version, response.body, store_id: @solution[:store_id], profile_id: @solution[:profile_id], ) ProfileInstanceMetadata.new( @version, profile_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
450 451 452 453 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 450 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Memory.V1.ProfileContext #{context}>" end |
#patch(profile_patch: nil) ⇒ ProfileInstance
Patch the ProfileInstance
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 394 def patch(profile_patch: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' payload = @version.patch('PATCH', @uri, headers: headers, data: profile_patch.to_json) ProfileInstance.new( @version, payload, store_id: @solution[:store_id], profile_id: @solution[:profile_id], ) end |
#patch_with_metadata(profile_patch: nil) ⇒ ProfileInstance
Patch the ProfileInstanceMetadata
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 416 def (profile_patch: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('PATCH', @uri, headers: headers, data: profile_patch.to_json) profile_instance = ProfileInstance.new( @version, response.body, store_id: @solution[:store_id], profile_id: @solution[:profile_id], ) ProfileInstanceMetadata.new( @version, profile_instance, response.headers, response.status_code ) end |
#to_s ⇒ Object
Provide a user friendly representation
443 444 445 446 |
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 443 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Memory.V1.ProfileContext #{context}>" end |