class Alegra::Payments

Public Instance Methods

create(params) click to toggle source

Creates a payment @param params [ Hash ]

- date [ String ]
- bank_account [ Integer ] or [ Hash ]
- payment_method [ String ]
- observations [ String  ]
- anotation [ String ]
- type [ String ]
- client [ Integer ] or [ Hash ]
- invoices [ Array ]
- bills [ Array ]
- categories [ Array ]
- retentions [ Array ]
- currency [ Array ]

@return [ Hash ]

# File lib/alegra/payments.rb, line 38
def create(params)
  sanitize_params = params.deep_camel_case_lower_keys
  client.post('payments', sanitize_params)
end
delete(id) click to toggle source

@param id [ Integer ] @return [ Hash ]

# File lib/alegra/payments.rb, line 66
def delete(id)
  client.delete("payments/#{id}")
end
find(id) click to toggle source

@param id [ Integer ] @return [ Hash ]

# File lib/alegra/payments.rb, line 5
def find(id)
  client.get("payments/#{id}")
end
list(params = {}) click to toggle source

Returs all payments @param params [ Hash ]

- start [ Integer ]
- limit [ Integer ]
- order_direction [ String ]
- order_field [ string ]
- type [ Integer ]
- metadata [ Boolean ]
- id [ Integer ]

@return [ Array ]

# File lib/alegra/payments.rb, line 19
def list(params = {})
  client.get('payments', params)
end
update(id, params) click to toggle source

Update a payment @param id [ Integer ] @param params [ Hash ]

- date [ String ]
- bank_account [ Integer ] or [ Hash ]
- payment_method [ String ]
- observations [ String  ]
- anotation [ String ]
- type [ String ]
- client [ Integer ] or [ Hash ]
- invoices [ Array ]
- bills [ Array ]
- categories [ Array ]
- retentions [ Array ]
- currency [ Array ]

@return [ Hash ]

# File lib/alegra/payments.rb, line 59
def update(id, params)
  sanitize_params = params.deep_camel_case_lower_keys
  client.put("payments/#{id}", sanitize_params)
end