Method: BaseCRM::SourcesService#update

Defined in:
lib/basecrm/services/sources_service.rb

#update(source) ⇒ Source

Update a source

put ‘/sources/BaseCRM#id

Updates source information If the specified source does not exist, the request will return an error <figure class=“notice”> If you want to update a source, you must make sure source’s name is unique </figure>

Parameters:

  • source (Source, Hash)

    Either object of the Source type or Hash. This object’s attributes describe the object to be updated.

Returns:

  • (Source)

    The resulting object represting updated resource.



90
91
92
93
94
95
96
97
98
99
# File 'lib/basecrm/services/sources_service.rb', line 90

def update(source)
  validate_type!(source)
  params = extract_params!(source, :id)
  id = params[:id]

  attributes = sanitize(source)
  _, _, root = @client.put("/sources/#{id}", attributes)

  Source.new(root[:data])
end