Module: Weeblycloud::Saveable
- Defined in:
- lib/weeblycloud/saveable.rb
Overview
CloudResource objects may use this module if they can be modified
Instance Method Summary collapse
-
#[]=(prop) ⇒ Object
Set a property using the [] setter.
-
#save ⇒ Object
Make an API call to save changes to the resource.
-
#set_property(prop, value) ⇒ Object
Set a property, prop, to value, val.
Instance Method Details
#[]=(prop) ⇒ Object
Set a property using the [] setter
24 25 26 |
# File 'lib/weeblycloud/saveable.rb', line 24 def []=(prop) set_property(prop) end |
#save ⇒ Object
Make an API call to save changes to the resource
29 30 31 32 |
# File 'lib/weeblycloud/saveable.rb', line 29 def save @client.patch(@endpoint, :content=>@changed) return nil end |
#set_property(prop, value) ⇒ Object
Set a property, prop, to value, val.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/weeblycloud/saveable.rb', line 7 def set_property(prop, value) if @properties.include?(prop) @properties[prop] = value @changed[prop] = value return true else if @got return nil else @got = true get() return set_property(prop, value) end end end |