Module: Unit::ResourceOperations::Replace
- Included in:
- WhiteLabelLanguage, WhiteLabelTheme
- Defined in:
- lib/unit-ruby/util/resource_operations.rb
Overview
Replace the entire resource, instead of only patching dirty attributes
Instance Method Summary collapse
Instance Method Details
#replace(attributes) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/unit-ruby/util/resource_operations.rb', line 83 def replace(attributes) updated_resource = self.class.connection.put( self.class.resource_path(id), { data: { type: resource_type, attributes: attributes } } ) update_resource_from_json_api(updated_resource) end |
#replace_json(json_attributes) ⇒ Object
96 97 98 |
# File 'lib/unit-ruby/util/resource_operations.rb', line 96 def replace_json(json_attributes) replace(JSON.parse(json_attributes)) end |