Class: Dolibarr::Api::Emailtemplates::Label

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

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Label

Returns a new instance of Label.



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

def initialize(connection)
  @connection = connection
end

Instance Method Details

#delete(label:) ⇒ Object

Raises:

  • (ArgumentError)


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

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

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

#get(label:) ⇒ Object

Raises:

  • (ArgumentError)


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

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

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

#update(label:, emailtemplates_updateby_label_model: nil) ⇒ Object

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dolibarr-api/api/emailtemplates/label.rb', line 33

def update(label:, emailtemplates_updateby_label_model: nil)
  raise ArgumentError, 'label is required' if label.nil?

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