Module: Sequencescape::Api::Resource::Modifications

Included in:
Sequencescape::Api::Resource
Defined in:
lib/sequencescape-api/resource/modifications.rb

Instance Method Summary (collapse)

Instance Method Details

- (Modifications) initialize(api, json = nil, wrapped = false)

Returns a new instance of Modifications

Returns:



35
36
37
38
39
# File 'lib/sequencescape-api/resource/modifications.rb', line 35

def initialize(api, json = nil, wrapped = false)
  super
  update_from_json(json, wrapped)
  changed_attributes.clear
end

- (Object) save!(options = nil)



47
48
49
50
# File 'lib/sequencescape-api/resource/modifications.rb', line 47

def save!(options = nil)
  action = persisted? ? :update : :create
  modify!({ :action => action }.reverse_merge(options || {}))
end

- (Object) update_attributes!(attributes)



41
42
43
44
45
# File 'lib/sequencescape-api/resource/modifications.rb', line 41

def update_attributes!(attributes)
  changed_attributes.clear
  update_from_json(attributes, false)
  modify!(:action => :update)
end