Sha256: ae172eddf1618169202bcb1894adbc22102b8ce30e3836a9aec37e7cc4300089
Contents?: true
Size: 1.27 KB
Versions: 11
Compression:
Stored size: 1.27 KB
Contents
module Nova module API module Resource class Payable < Nova::API::Resource::Bill def self.endpoint '/api/payables' end def self.list(parameters = {}) do_get_search(endpoint, parameters.to_h) end def self.create(parameters) model = new parameters model.attributes.delete(:id) model.save end def self.update(id, parameters) model = new parameters.merge(id: id) model.update end 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 def endpoint protect_operation_from_missing_value "/api/payables/#{id}" end def save if id.nil? do_post(self.class.endpoint, allowed_attributes) else do_patch("#{endpoint}", allowed_attributes) end end def update protect_operation_from_missing_value do_patch("#{endpoint}", allowed_attributes) end def destroy protect_operation_from_missing_value do_delete("#{endpoint}") end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems