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