Class: Moloni::Customer

Inherits:
BaseModel show all
Defined in:
lib/moloni/models/customer.rb

Constant Summary

Constants inherited from BaseModel

BaseModel::COMMON_ACRONYMS, BaseModel::ERROR_MESSAGES

Class Method Summary collapse

Methods inherited from BaseModel

all, composed_params, count, delete, find, format_url, #format_url, method_missing, post, respond_to_missing?

Class Method Details

.create(args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/moloni/models/customer.rb', line 21

def self.create(args)
  default_empty_required_params = {
    salesman_id: '',
    payment_day: '',
    discount: '',
    credit_limit: '',
    payment_method_id: '',
    delivery_method_id: ''
  }

  post('insert/', args.merge(default_empty_required_params))
end

.find_by_email(args) ⇒ Object



13
14
15
# File 'lib/moloni/models/customer.rb', line 13

def self.find_by_email(args)
  post('getByEmail/', args)
end

.find_by_number(args) ⇒ Object



17
18
19
# File 'lib/moloni/models/customer.rb', line 17

def self.find_by_number(args)
  post('getByNumber/', args)
end

.find_by_vat(args) ⇒ Object



9
10
11
# File 'lib/moloni/models/customer.rb', line 9

def self.find_by_vat(args)
  post('getByVat/', args)
end

.update(args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/moloni/models/customer.rb', line 34

def self.update(args)
  default_empty_required_params = {
    salesman_id: '',
    payment_day: '',
    discount: '',
    credit_limit: '',
    payment_method_id: '',
    delivery_method_id: ''
  }

  post('update/', args.merge(default_empty_required_params))
end