Method: ClientSuccess::Client#update
- Defined in:
- lib/client_success/client.rb
#update(client_id:, attributes:, connection:) ⇒ Object
NOTE: according to the api documentation, this is not a PATCH operation,
i.e. any fields not supplied will be set to null - so make sure you
supply everything :)
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/client_success/client.rb', line 77 def update(client_id:, attributes:, connection:) body = attributes .deep_transform_keys { |k| k.to_s.camelize(:lower) } .to_json response = connection.put( "/v1/clients/#{client_id}", body) payload = response.body # TODO: find a better way to deal with api weirdness here payload["customFieldValues"].compact! DomainModel::Client.new( payload.deep_transform_keys(&:underscore)) end |