コード例 #1
0
 public function testIsList()
 {
     $list = array(5, 'nstaoush', array());
     $this->assertTrue(Shippo_Util::isList($list));
     $notlist = array(5, 'nstaoush', array(), 'bar' => 'baz');
     $this->assertFalse(Shippo_Util::isList($notlist));
 }
コード例 #2
0
 public function retrieve($id, $params = null)
 {
     $requestor = new Shippo_ApiRequestor($this->_apiKey);
     $base = $this['url'];
     $id = Shippo_ApiRequestor::utf8($id);
     $extn = urlencode($id);
     list($response, $apiKey) = $requestor->request('get', "{$base}/{$extn}", $params);
     return Shippo_Util::convertToShippoObject($response, $apiKey);
 }
コード例 #3
0
 protected static function _scopedValidate($class, $id)
 {
     self::_validateCall('create', $params, $apiKey);
     $requestor = new Shippo_ApiRequestor($apiKey);
     $url = self::_scopedLsb($class, 'classUrl', $class) . "/" . $id . "/validate/";
     list($response, $apiKey) = $requestor->request('get', $url, $params);
     return Shippo_Util::convertToShippoObject($response, $apiKey);
 }
コード例 #4
0
 public function __toArray($recursive = false)
 {
     if ($recursive) {
         return Shippo_Util::convertShippoObjectToArray($this->_values);
     } else {
         return $this->_values;
     }
 }