Class: Dolibarr::Api::Contacts
- Inherits:
-
Object
- Object
- Dolibarr::Api::Contacts
- Defined in:
- lib/dolibarr-api/api/contacts.rb
Defined Under Namespace
Classes: Categories, Email
Instance Method Summary collapse
- #create(create_contacts_model: nil) ⇒ Object
- #create_user(id:, contacts_create_user_model: nil) ⇒ Object
- #delete(id:) ⇒ Object
- #get(id:, includecount: nil, includeroles: nil) ⇒ Object
-
#initialize(connection) ⇒ Contacts
constructor
A new instance of Contacts.
- #list(sortfield: nil, sortorder: nil, limit: nil, page: nil, thirdparty_ids: nil, category: nil, sqlfilters: nil, includecount: nil, includeroles: nil, properties: nil, pagination_data: nil) ⇒ Object
- #update(id:, update_contacts_model: nil) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Contacts
Returns a new instance of Contacts.
5 6 7 |
# File 'lib/dolibarr-api/api/contacts.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(create_contacts_model: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/dolibarr-api/api/contacts.rb', line 9 def create(create_contacts_model: nil) @connection.call( :POST, '/contacts', type: nil, auth: ['api_key'], body: create_contacts_model ) end |
#create_user(id:, contacts_create_user_model: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dolibarr-api/api/contacts.rb', line 19 def create_user(id:, contacts_create_user_model: nil) raise ArgumentError, 'id is required' if id.nil? @connection.call( :POST, '/contacts/{id}/createUser' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: nil, auth: ['api_key'], body: contacts_create_user_model ) end |
#delete(id:) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dolibarr-api/api/contacts.rb', line 32 def delete(id:) raise ArgumentError, 'id is required' if id.nil? @connection.call( :DELETE, '/contacts/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: nil, auth: ['api_key'] ) end |
#get(id:, includecount: nil, includeroles: nil) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dolibarr-api/api/contacts.rb', line 44 def get(id:, includecount: nil, includeroles: nil) raise ArgumentError, 'id is required' if id.nil? @connection.call( :GET, '/contacts/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: nil, auth: ['api_key'], query: { 'includecount' => includecount, 'includeroles' => includeroles } ) end |
#list(sortfield: nil, sortorder: nil, limit: nil, page: nil, thirdparty_ids: nil, category: nil, sqlfilters: nil, includecount: nil, includeroles: nil, properties: nil, pagination_data: nil) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/dolibarr-api/api/contacts.rb', line 57 def list(sortfield: nil, sortorder: nil, limit: nil, page: nil, thirdparty_ids: nil, category: nil, sqlfilters: nil, includecount: nil, includeroles: nil, properties: nil, pagination_data: nil) @connection.call( :GET, '/contacts', type: nil, auth: ['api_key'], query: { 'sortfield' => sortfield, 'sortorder' => sortorder, 'limit' => limit, 'page' => page, 'thirdparty_ids' => thirdparty_ids, 'category' => category, 'sqlfilters' => sqlfilters, 'includecount' => includecount, 'includeroles' => includeroles, 'properties' => properties, 'pagination_data' => pagination_data } ) end |
#update(id:, update_contacts_model: nil) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/dolibarr-api/api/contacts.rb', line 67 def update(id:, update_contacts_model: nil) raise ArgumentError, 'id is required' if id.nil? @connection.call( :PUT, '/contacts/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: nil, auth: ['api_key'], body: update_contacts_model ) end |