PageRenderTime 39ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/library/twillio/sdk/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemInstance.php

https://bitbucket.org/zacbelldev/admin-portal-under-construction
PHP | 150 lines | 68 code | 15 blank | 67 comment | 3 complexity | e311394597b00435718684867f6793ec MD5 | raw file
Possible License(s): LGPL-2.1, MIT
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Sync\V1\Service\SyncMap;
  9. use Twilio\Deserialize;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceResource;
  12. use Twilio\Values;
  13. use Twilio\Version;
  14. /**
  15. * PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
  16. *
  17. * @property string key
  18. * @property string accountSid
  19. * @property string serviceSid
  20. * @property string mapSid
  21. * @property string url
  22. * @property string revision
  23. * @property array data
  24. * @property \DateTime dateCreated
  25. * @property \DateTime dateUpdated
  26. * @property string createdBy
  27. */
  28. class SyncMapItemInstance extends InstanceResource {
  29. /**
  30. * Initialize the SyncMapItemInstance
  31. *
  32. * @param \Twilio\Version $version Version that contains the resource
  33. * @param mixed[] $payload The response payload
  34. * @param string $serviceSid The service_sid
  35. * @param string $mapSid The map_sid
  36. * @param string $key The key
  37. * @return \Twilio\Rest\Sync\V1\Service\SyncMap\SyncMapItemInstance
  38. */
  39. public function __construct(Version $version, array $payload, $serviceSid, $mapSid, $key = null) {
  40. parent::__construct($version);
  41. // Marshaled Properties
  42. $this->properties = array(
  43. 'key' => Values::array_get($payload, 'key'),
  44. 'accountSid' => Values::array_get($payload, 'account_sid'),
  45. 'serviceSid' => Values::array_get($payload, 'service_sid'),
  46. 'mapSid' => Values::array_get($payload, 'map_sid'),
  47. 'url' => Values::array_get($payload, 'url'),
  48. 'revision' => Values::array_get($payload, 'revision'),
  49. 'data' => Values::array_get($payload, 'data'),
  50. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  51. 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
  52. 'createdBy' => Values::array_get($payload, 'created_by'),
  53. );
  54. $this->solution = array(
  55. 'serviceSid' => $serviceSid,
  56. 'mapSid' => $mapSid,
  57. 'key' => $key ?: $this->properties['key'],
  58. );
  59. }
  60. /**
  61. * Generate an instance context for the instance, the context is capable of
  62. * performing various actions. All instance actions are proxied to the context
  63. *
  64. * @return \Twilio\Rest\Sync\V1\Service\SyncMap\SyncMapItemContext Context for
  65. * this
  66. * SyncMapItemInstance
  67. */
  68. protected function proxy() {
  69. if (!$this->context) {
  70. $this->context = new SyncMapItemContext(
  71. $this->version,
  72. $this->solution['serviceSid'],
  73. $this->solution['mapSid'],
  74. $this->solution['key']
  75. );
  76. }
  77. return $this->context;
  78. }
  79. /**
  80. * Fetch a SyncMapItemInstance
  81. *
  82. * @return SyncMapItemInstance Fetched SyncMapItemInstance
  83. */
  84. public function fetch() {
  85. return $this->proxy()->fetch();
  86. }
  87. /**
  88. * Deletes the SyncMapItemInstance
  89. *
  90. * @return boolean True if delete succeeds, false otherwise
  91. */
  92. public function delete() {
  93. return $this->proxy()->delete();
  94. }
  95. /**
  96. * Update the SyncMapItemInstance
  97. *
  98. * @param array $data The data
  99. * @return SyncMapItemInstance Updated SyncMapItemInstance
  100. */
  101. public function update($data) {
  102. return $this->proxy()->update(
  103. $data
  104. );
  105. }
  106. /**
  107. * Magic getter to access properties
  108. *
  109. * @param string $name Property to access
  110. * @return mixed The requested property
  111. * @throws TwilioException For unknown properties
  112. */
  113. public function __get($name) {
  114. if (array_key_exists($name, $this->properties)) {
  115. return $this->properties[$name];
  116. }
  117. if (property_exists($this, '_' . $name)) {
  118. $method = 'get' . ucfirst($name);
  119. return $this->$method();
  120. }
  121. throw new TwilioException('Unknown property: ' . $name);
  122. }
  123. /**
  124. * Provide a friendly representation
  125. *
  126. * @return string Machine friendly representation
  127. */
  128. public function __toString() {
  129. $context = array();
  130. foreach ($this->solution as $key => $value) {
  131. $context[] = "$key=$value";
  132. }
  133. return '[Twilio.Sync.V1.SyncMapItemInstance ' . implode(' ', $context) . ']';
  134. }
  135. }