/libraries/fabrik/vendor/twilio/sdk/src/Twilio/Rest/Preview/Wireless/CommandInstance.php

https://github.com/trob/fabrik · PHP · 120 lines · 52 code · 13 blank · 55 comment · 3 complexity · 9fd8704450ce1bafe10e294ad549d678 MD5 · raw file

  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Preview\Wireless;
  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 preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
  16. *
  17. * @property string $sid
  18. * @property string $accountSid
  19. * @property string $deviceSid
  20. * @property string $simSid
  21. * @property string $command
  22. * @property string $commandMode
  23. * @property string $status
  24. * @property string $direction
  25. * @property \DateTime $dateCreated
  26. * @property \DateTime $dateUpdated
  27. * @property string $url
  28. */
  29. class CommandInstance extends InstanceResource {
  30. /**
  31. * Initialize the CommandInstance
  32. *
  33. * @param \Twilio\Version $version Version that contains the resource
  34. * @param mixed[] $payload The response payload
  35. * @param string $sid The sid
  36. * @return \Twilio\Rest\Preview\Wireless\CommandInstance
  37. */
  38. public function __construct(Version $version, array $payload, $sid = null) {
  39. parent::__construct($version);
  40. // Marshaled Properties
  41. $this->properties = array(
  42. 'sid' => Values::array_get($payload, 'sid'),
  43. 'accountSid' => Values::array_get($payload, 'account_sid'),
  44. 'deviceSid' => Values::array_get($payload, 'device_sid'),
  45. 'simSid' => Values::array_get($payload, 'sim_sid'),
  46. 'command' => Values::array_get($payload, 'command'),
  47. 'commandMode' => Values::array_get($payload, 'command_mode'),
  48. 'status' => Values::array_get($payload, 'status'),
  49. 'direction' => Values::array_get($payload, 'direction'),
  50. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  51. 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
  52. 'url' => Values::array_get($payload, 'url'),
  53. );
  54. $this->solution = array('sid' => $sid ?: $this->properties['sid'], );
  55. }
  56. /**
  57. * Generate an instance context for the instance, the context is capable of
  58. * performing various actions. All instance actions are proxied to the context
  59. *
  60. * @return \Twilio\Rest\Preview\Wireless\CommandContext Context for this
  61. * CommandInstance
  62. */
  63. protected function proxy() {
  64. if (!$this->context) {
  65. $this->context = new CommandContext($this->version, $this->solution['sid']);
  66. }
  67. return $this->context;
  68. }
  69. /**
  70. * Fetch a CommandInstance
  71. *
  72. * @return CommandInstance Fetched CommandInstance
  73. * @throws TwilioException When an HTTP error occurs.
  74. */
  75. public function fetch() {
  76. return $this->proxy()->fetch();
  77. }
  78. /**
  79. * Magic getter to access properties
  80. *
  81. * @param string $name Property to access
  82. * @return mixed The requested property
  83. * @throws TwilioException For unknown properties
  84. */
  85. public function __get($name) {
  86. if (\array_key_exists($name, $this->properties)) {
  87. return $this->properties[$name];
  88. }
  89. if (\property_exists($this, '_' . $name)) {
  90. $method = 'get' . \ucfirst($name);
  91. return $this->$method();
  92. }
  93. throw new TwilioException('Unknown property: ' . $name);
  94. }
  95. /**
  96. * Provide a friendly representation
  97. *
  98. * @return string Machine friendly representation
  99. */
  100. public function __toString() {
  101. $context = array();
  102. foreach ($this->solution as $key => $value) {
  103. $context[] = "$key=$value";
  104. }
  105. return '[Twilio.Preview.Wireless.CommandInstance ' . \implode(' ', $context) . ']';
  106. }
  107. }