Module: Async::REST::Representation::Mutable

Defined in:
lib/async/rest/representation.rb

Overview

Provides a way to mutate the value of the representation.

Instance Method Summary collapse

Instance Method Details

#assign(value) ⇒ Object



118
119
120
121
122
123
124
# File 'lib/async/rest/representation.rb', line 118

def assign(value)
  if value
    self.post(value)
  else
    self.delete
  end
end

#deleteObject



114
115
116
# File 'lib/async/rest/representation.rb', line 114

def delete
  self.class.delete(@resource)
end

#post(value) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/async/rest/representation.rb', line 106

def post(value)
  self.class.post(@resource, value) do |resource, response|
    @value = response.read
    
    self
  end
end