/** * Return an array of store information */ public static function get_store_info() { $rest = new Mijireh_RestJSON(self::$url); $rest->setupAuth(self::$access_key, ''); try { $result = $rest->get('store'); return $result; } catch (Mijireh_Rest_BadRequest $e) { throw new Mijireh_BadRequest($e->getMessage()); } catch (Mijireh_Rest_Unauthorized $e) { throw new Mijireh_Unauthorized("Unauthorized. Please check your api access key"); } catch (Mijireh_Rest_NotFound $e) { throw new Mijireh_NotFound("Mijireh resource not found: " . $rest->last_request['url']); } catch (Mijireh_Rest_ClientError $e) { throw new Mijireh_ClientError($e->getMessage()); } catch (Mijireh_Rest_ServerError $e) { throw new Mijireh_ServerError($e->getMessage()); } }
public function load($order_number) { if (strlen(Mijireh::$access_key) < 5) { throw new Mijireh_Exception('missing mijireh access key'); } $rest = new Mijireh_RestJSON(Mijireh::$url); $rest->setupAuth(Mijireh::$access_key, ''); try { $order_data = $rest->get("orders/{$order_number}"); $this->copy_from($order_data); return $this; } catch (Mijireh_Rest_BadRequest $e) { throw new Mijireh_BadRequest($e->getMessage()); } catch (Mijireh_Rest_Unauthorized $e) { throw new Mijireh_Unauthorized("Unauthorized. Please check your api access key"); } catch (Mijireh_Rest_NotFound $e) { throw new Mijireh_NotFound("Mijireh resource not found: " . $rest->last_request['url']); } catch (Mijireh_Rest_ClientError $e) { throw new Mijireh_ClientError($e->getMessage()); } catch (Mijireh_Rest_ServerError $e) { throw new Mijireh_ServerError($e->getMessage()); } }