Method: BaseCRM::SourcesService#create

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

#create(source) ⇒ Source

Create a source

post ‘/sources’

Creates a new source <figure class=“notice”> Source’s name must be unique </figure>

Parameters:

  • source (Source, Hash)

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

Returns:

  • (Source)

    The resulting object represting created resource.



52
53
54
55
56
57
58
59
# File 'lib/basecrm/services/sources_service.rb', line 52

def create(source)
  validate_type!(source)

  attributes = sanitize(source)
  _, _, root = @client.post("/sources", attributes)

  Source.new(root[:data])
end