Class: Dolibarr::Api::Paiements

Inherits:
Object
  • Object
show all
Defined in:
lib/dolibarr-api/api/paiements.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Paiements

Returns a new instance of Paiements.



5
6
7
# File 'lib/dolibarr-api/api/paiements.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Method Details

#delete(id:) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dolibarr-api/api/paiements.rb', line 9

def delete(id:)
  raise ArgumentError, 'id is required' if id.nil?

  @connection.call(
    :DELETE,
    '/paiements/{id}'
      .gsub('{id}', ERB::Util.url_encode(id.to_s)),
    type: nil,
    auth: ['api_key']
  )
end

#get(id:) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dolibarr-api/api/paiements.rb', line 21

def get(id:)
  raise ArgumentError, 'id is required' if id.nil?

  @connection.call(
    :GET,
    '/paiements/{id}'
      .gsub('{id}', ERB::Util.url_encode(id.to_s)),
    type: Dolibarr::Api::Models::Obj,
    auth: ['api_key']
  )
end

#list(sortfield: nil, sortorder: nil, limit: nil, page: nil, sqlfilters: nil, properties: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/dolibarr-api/api/paiements.rb', line 33

def list(sortfield: nil, sortorder: nil, limit: nil, page: nil, sqlfilters: nil, properties: nil)
  @connection.call(
    :GET,
    '/paiements',
    type: nil,
    auth: ['api_key'],
    query: { 'sortfield' => sortfield, 'sortorder' => sortorder, 'limit' => limit, 'page' => page, 'sqlfilters' => sqlfilters, 'properties' => properties }
  )
end

#update(id:, update_paiements_model: nil) ⇒ Object

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/dolibarr-api/api/paiements.rb', line 43

def update(id:, update_paiements_model: nil)
  raise ArgumentError, 'id is required' if id.nil?

  @connection.call(
    :PUT,
    '/paiements/{id}'
      .gsub('{id}', ERB::Util.url_encode(id.to_s)),
    type: Dolibarr::Api::Models::Obj,
    auth: ['api_key'],
    body: update_paiements_model
  )
end