module BlockScore::Actions::Update
Public: Contains the :save instance method, which updates the object with the BlockScore
API to persist the changes.
Examples
class Foo include BlockScore::Actions::Update end foo = Foo.new foo.name_first = 'John' foo.save # => true
Constants
- PERSISTENT_ATTRIBUTES
Attributes which will not change once the object is created.
Public Instance Methods
filter_params()
click to toggle source
Filters out the non-updateable params.
# File lib/blockscore/actions/update.rb, line 40 def filter_params # Cannot %i syntax, not introduced until Ruby 2.0.0 attributes.reject { |key, _| PERSISTENT_ATTRIBUTES.include?(key) } end
save!()
click to toggle source
Calls superclass method
# File lib/blockscore/actions/update.rb, line 30 def save! if persisted? patch("#{endpoint}/#{id}", filter_params) true else super end end