1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0
7: * @author Glen Campbell <glen.campbell@rackspace.com>
8: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
9: */
10:
11: namespace OpenCloud\DNS\Resource;
12:
13: use OpenCloud\Common\PersistentObject;
14: use OpenCloud\Common\Service\AbstractService;
15: use Guzzle\Http\Url;
16:
17: /**
18: * The AsyncResponse class encapsulates the data returned by a Cloud DNS
19: * asynchronous response.
20: */
21: class AsyncResponse extends PersistentObject
22: {
23:
24: public $jobId;
25: public $callbackUrl;
26: public $status;
27: public $requestUrl;
28: public $verb;
29: public $request;
30: public $response;
31: public $error;
32: public $domains;
33:
34: protected static $json_name = false;
35:
36: /**
37: * constructs a new AsyncResponse object from a JSON
38: * string
39: *
40: * @param \OpenCloud\Service $service the calling service
41: * @param string $json the json response from the initial request
42: */
43: public function __construct(AbstractService $service, $object = null)
44: {
45: if (!$object) {
46: return;
47: }
48:
49: parent::__construct($service, $object);
50: }
51:
52: /**
53: * URL for status
54: *
55: * We always show details
56: *
57: * @return string
58: */
59: public function getUrl($path = null, array $query = array())
60: {
61: return Url::factory($this->callbackUrl)
62: ->setQuery(array('showDetails' => 'True'));
63: }
64:
65: /**
66: * returns the Name of the request (the job ID)
67: *
68: * @return string
69: */
70: public function name()
71: {
72: return $this->jobId;
73: }
74:
75: /**
76: * overrides for methods
77: */
78: public function create($params = array())
79: {
80: return $this->noCreate();
81: }
82:
83: public function update($params = array())
84: {
85: return $this->noUpdate();
86: }
87:
88: public function delete()
89: {
90: return $this->noDelete();
91: }
92:
93: public function primaryKeyField()
94: {
95: return 'jobId';
96: }
97:
98: }
99: