class Nova::API::Resource::Receivable
Constants
- ALLOWED_ATTRIBUTES
Public Class Methods
create(parameters)
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 17 def self.create(parameters) model = new parameters model.attributes.delete(:id) model.save end
destroy(id)
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 31 def self.destroy(id) model = initialize_empty_model_with_id(self, id, date: Date.today.iso8601, first_due_date: Date.today.iso8601) model.destroy end
endpoint()
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 9 def self.endpoint '/api/receivables' end
list(parameters = {})
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 13 def self.list(parameters = {}) do_get_search(endpoint, parameters.to_h) end
update(id, parameters)
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 25 def self.update(id, parameters) model = new parameters.merge(id: id) model.update end
Public Instance Methods
destroy()
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 57 def destroy protect_operation_from_missing_value do_delete("#{endpoint}") end
endpoint()
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 37 def endpoint protect_operation_from_missing_value "/api/receivables/#{id}" end
save()
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 43 def save if id.nil? do_post(self.class.endpoint, allowed_attributes) else do_patch("#{endpoint}", allowed_attributes) end end
update()
click to toggle source
# File lib/nova/api/resource/receivable.rb, line 51 def update protect_operation_from_missing_value do_patch("#{endpoint}", allowed_attributes) end