Example #1
0
 /**
  * Update a deal
  *
  * put '/deals/{id}'
  * 
  * Updates deal information
  * If the specified deal does not exist, the request will return an error
  * <figure class="notice">
  * In order to modify tags used on a record, you need to supply the entire set
  * `tags` are replaced every time they are used in a request
  * </figure>
  *
  * @param integer $id Unique identifier of a Deal
  * @param array $deal This array's attributes describe the object to be updated.
  * 
  * @return array The resulting object representing updated resource.
  */
 public function update($id, array $deal)
 {
     $attributes = array_intersect_key($deal, array_flip(self::$keysToPersist));
     if (isset($attributes['custom_fields']) && empty($attributes['custom_fields'])) {
         unset($attributes['custom_fields']);
     }
     $attributes["value"] = Coercion::toStringValue($attributes['value']);
     list($code, $updatedDeal) = $this->httpClient->put("/deals/{$id}", $attributes);
     $updatedDeal = $this->coerceDealData($updatedDeal);
     return $updatedDeal;
 }
Example #2
0
 public function testToStingValue()
 {
     $this->assertEquals(Coercion::toStringValue(10), "10");
     $this->assertEquals(Coercion::toStringValue(10.1), "10.1");
     $this->assertEquals(Coercion::toStringValue("10.10"), "10.10");
 }