Class: Dimelo::CCP::Answer

Inherits:
Dimelo::CCP::API::Model show all
Includes:
Dimelo::CCP::API::Common::Publishable
Defined in:
lib/dimelo/ccp/api/model/answer.rb

Constant Summary

Constants inherited from Dimelo::CCP::API::Model

Dimelo::CCP::API::Model::INTERPOLATION_PATTERN

Instance Attribute Summary

Attributes inherited from Dimelo::CCP::API::Model

#client, #errors, #tracked_attributes

Instance Method Summary collapse

Methods included from Dimelo::CCP::API::Common::Publishable

#publish, #unpublish

Methods inherited from Dimelo::CCP::API::Model

#==, attribute, attributes, #attributes, #attributes=, belongs_to, compute_path, #create, #destroy, find, has_many, #initialize, #merge!, #new_record?, parse, path, #reload, #save, #submit_attributes, submit_attributes, #to_json, #tracked_submit_attributes, #update, #valid?, #warn

Constructor Details

This class inherits a constructor from Dimelo::CCP::API::Model

Instance Method Details

#admin_stampObject



18
19
20
21
22
23
# File 'lib/dimelo/ccp/api/model/answer.rb', line 18

def admin_stamp
  path = "#{compute_path(attributes)}/admin_stamp"
  response = client.transport(:post, path)
  self.attributes = Dimelo::CCP::API.decode_json(response)
  errors.empty?
end

#author_stampObject



25
26
27
28
29
30
# File 'lib/dimelo/ccp/api/model/answer.rb', line 25

def author_stamp
  path = "#{compute_path(attributes)}/author_stamp"
  response = client.transport(:post, path)
  self.attributes = Dimelo::CCP::API.decode_json(response)
  errors.empty?
end

#unstampObject



32
33
34
35
36
37
# File 'lib/dimelo/ccp/api/model/answer.rb', line 32

def unstamp
  path = "#{compute_path(attributes)}/stamp"
  response = client.transport(:delete, path)
  self.attributes = Dimelo::CCP::API.decode_json(response)
  errors.empty?
end