module Weeblycloud::Saveable

CloudResource objects may use this module if they can be modified

Public Instance Methods

[]=(prop) click to toggle source

Set a property using the [] setter

# File lib/weeblycloud/saveable.rb, line 24
def []=(prop)
  set_property(prop)
end
save() click to toggle source

Make an API call to save changes to the resource

# File lib/weeblycloud/saveable.rb, line 29
def save
  @client.patch(@endpoint, :content=>@changed)
  return nil
end
set_property(prop, value) click to toggle source

Set a property, prop, to value, val.

# 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