예제 #1
0
 /**
  * testPostValues method
  *
  * @return void
  */
 public function testPostValues()
 {
     $data = array(array('timestamp' => '2013-12-10T07:48:20+00:00', 'value' => 5002), array('timestamp' => '2013-12-12T07:48:20+00:00', 'value' => 5059));
     $expectedParam = array('values' => $data);
     $m2x = $this->generateMockM2X();
     $m2x->request->expects($this->once())->method('request')->with($this->equalTo('POST'), $this->equalTo('https://api-m2x.att.com/v2/devices/c2b83dcb796230906c70854a57b66b0a/streams/stream_foo/values'))->willReturn(new Att\M2X\HttpResponse($this->_raw('streams_post_values_success')));
     $device = new Device($m2x, array('id' => 'c2b83dcb796230906c70854a57b66b0a'));
     $stream = new Stream($m2x, $device, array('name' => 'stream_foo'));
     $stream->postValues($data);
 }
예제 #2
0
파일: Device.php 프로젝트: attm2x/m2x-php
 /**
  * Update a data stream associated with the Device, if a
  * stream with this name does not exist it gets created.
  *
  * @link https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream
  *
  * @param string $name
  * @param array $data
  * @return Stream
  */
 public function updateStream($name, $data = array())
 {
     return Stream::createStream($this->client, $this, $name, $data);
 }