/libraries/fabrik/vendor/twilio/sdk/src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignmentInstance.php

https://github.com/trob/fabrik · PHP · 124 lines · 54 code · 14 blank · 56 comment · 3 complexity · 25e7207aeea692843fc59841bce97041 MD5 · raw file

  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle;
  9. use Twilio\Deserialize;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceResource;
  12. use Twilio\Values;
  13. use Twilio\Version;
  14. /**
  15. * @property string $sid
  16. * @property string $bundleSid
  17. * @property string $accountSid
  18. * @property string $objectSid
  19. * @property \DateTime $dateCreated
  20. * @property string $url
  21. */
  22. class ItemAssignmentInstance extends InstanceResource {
  23. /**
  24. * Initialize the ItemAssignmentInstance
  25. *
  26. * @param \Twilio\Version $version Version that contains the resource
  27. * @param mixed[] $payload The response payload
  28. * @param string $bundleSid The unique string that identifies the Bundle
  29. * resource.
  30. * @param string $sid The unique string that identifies the resource
  31. * @return \Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle\ItemAssignmentInstance
  32. */
  33. public function __construct(Version $version, array $payload, $bundleSid, $sid = null) {
  34. parent::__construct($version);
  35. // Marshaled Properties
  36. $this->properties = array(
  37. 'sid' => Values::array_get($payload, 'sid'),
  38. 'bundleSid' => Values::array_get($payload, 'bundle_sid'),
  39. 'accountSid' => Values::array_get($payload, 'account_sid'),
  40. 'objectSid' => Values::array_get($payload, 'object_sid'),
  41. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  42. 'url' => Values::array_get($payload, 'url'),
  43. );
  44. $this->solution = array('bundleSid' => $bundleSid, 'sid' => $sid ?: $this->properties['sid'], );
  45. }
  46. /**
  47. * Generate an instance context for the instance, the context is capable of
  48. * performing various actions. All instance actions are proxied to the context
  49. *
  50. * @return \Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle\ItemAssignmentContext Context for this
  51. * ItemAssignmentInstance
  52. */
  53. protected function proxy() {
  54. if (!$this->context) {
  55. $this->context = new ItemAssignmentContext(
  56. $this->version,
  57. $this->solution['bundleSid'],
  58. $this->solution['sid']
  59. );
  60. }
  61. return $this->context;
  62. }
  63. /**
  64. * Fetch a ItemAssignmentInstance
  65. *
  66. * @return ItemAssignmentInstance Fetched ItemAssignmentInstance
  67. * @throws TwilioException When an HTTP error occurs.
  68. */
  69. public function fetch() {
  70. return $this->proxy()->fetch();
  71. }
  72. /**
  73. * Deletes the ItemAssignmentInstance
  74. *
  75. * @return boolean True if delete succeeds, false otherwise
  76. * @throws TwilioException When an HTTP error occurs.
  77. */
  78. public function delete() {
  79. return $this->proxy()->delete();
  80. }
  81. /**
  82. * Magic getter to access properties
  83. *
  84. * @param string $name Property to access
  85. * @return mixed The requested property
  86. * @throws TwilioException For unknown properties
  87. */
  88. public function __get($name) {
  89. if (\array_key_exists($name, $this->properties)) {
  90. return $this->properties[$name];
  91. }
  92. if (\property_exists($this, '_' . $name)) {
  93. $method = 'get' . \ucfirst($name);
  94. return $this->$method();
  95. }
  96. throw new TwilioException('Unknown property: ' . $name);
  97. }
  98. /**
  99. * Provide a friendly representation
  100. *
  101. * @return string Machine friendly representation
  102. */
  103. public function __toString() {
  104. $context = array();
  105. foreach ($this->solution as $key => $value) {
  106. $context[] = "$key=$value";
  107. }
  108. return '[Twilio.Numbers.V2.ItemAssignmentInstance ' . \implode(' ', $context) . ']';
  109. }
  110. }