Module: Invoiced::Operations::Update
- Included in:
- Contact, Coupon, CreditBalanceAdjustment, CreditNote, Customer, Estimate, Invoice, Item, LineItem, Note, Payment, Plan, Subscription, Task, TaxRate
- Defined in:
- lib/invoiced/operations/update.rb
Instance Method Summary collapse
Instance Method Details
#save(params = {}, opts = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/invoiced/operations/update.rb', line 4 def save(params={}, opts={}) update = {} @unsaved.each do |k| update[k] = @values[k] end update = update.merge(params) # perform the update if there are any changes if update.length > 0 response = @client.request(:patch, self.endpoint(), update, opts) # update the local values with the response refresh_from(response[:body].dup.merge({:id => self.id})) return response[:code] == 200 end false end |