| @@ 46-61 (lines=16) @@ | ||
| 43 | * |
|
| 44 | * @throws \InvalidArgumentException if $dateTime is not a \DateTime |
|
| 45 | */ |
|
| 46 | public function updateValue ($dateTime) |
|
| 47 | { |
|
| 48 | if (!($dateTime instanceof \DateTime)) |
|
| 49 | { |
|
| 50 | throw new \InvalidArgumentException('$dateTime is expected to be of type \\DateTime'); |
|
| 51 | } |
|
| 52 | ||
| 53 | $url = sprintf("%s/%d/columns/%s/date.json", self::apiEndpoint(), $this->board_id, $this->column_id); |
|
| 54 | $postParams = [ |
|
| 55 | "pulse_id" => $this->pulse_id, |
|
| 56 | "date_str" => date_format($dateTime, "Y-m-d") |
|
| 57 | ]; |
|
| 58 | ||
| 59 | $result = self::sendPut($url, $postParams); |
|
| 60 | $this->setValue($result); |
|
| 61 | } |
|
| 62 | ||
| 63 | protected function setValue ($response) |
|
| 64 | { |
|
| @@ 45-60 (lines=16) @@ | ||
| 42 | * |
|
| 43 | * @throws \InvalidArgumentException if $number is not a numeric value |
|
| 44 | */ |
|
| 45 | public function updateValue ($number) |
|
| 46 | { |
|
| 47 | if (!is_numeric($number)) |
|
| 48 | { |
|
| 49 | throw new \InvalidArgumentException('$number is expected to be a numeric type'); |
|
| 50 | } |
|
| 51 | ||
| 52 | $url = sprintf("%s/%d/columns/%s/numeric.json", self::apiEndpoint(), $this->board_id, $this->column_id); |
|
| 53 | $postParams = [ |
|
| 54 | "pulse_id" => $this->pulse_id, |
|
| 55 | "value" => $number |
|
| 56 | ]; |
|
| 57 | ||
| 58 | $result = self::sendPut($url, $postParams); |
|
| 59 | $this->setValue($result); |
|
| 60 | } |
|
| 61 | ||
| 62 | protected function setValue ($response) |
|
| 63 | { |
|