Class: Stellar::Homework::Submission::Comment

Inherits:
Object
  • Object
show all
Defined in:
lib/stellar/homework.rb

Overview

A comment on a Stellar submission.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attachment_urlObject (readonly)

URL to the file attached to the comment. Can be nil.



194
195
196
# File 'lib/stellar/homework.rb', line 194

def attachment_url
  @attachment_url
end

#authorObject (readonly)

Person who posted the comment.



190
191
192
# File 'lib/stellar/homework.rb', line 190

def author
  @author
end

#clientObject (readonly)

Generic Stellar client used to make requests.



203
204
205
# File 'lib/stellar/homework.rb', line 203

def client
  @client
end

#deletedObject (readonly) Also known as: deleted?

True if the comment was deleted.



196
197
198
# File 'lib/stellar/homework.rb', line 196

def deleted
  @deleted
end

#submissionObject (readonly)

The submission that the comment was posted on.



201
202
203
# File 'lib/stellar/homework.rb', line 201

def submission
  @submission
end

#textObject (readonly)

Comment text.



192
193
194
# File 'lib/stellar/homework.rb', line 192

def text
  @text
end

Instance Method Details

#attachment_dataString

The contents of the file attached to this Stellar submission comment.

Returns:

  • (String)

    raw file data



256
257
258
# File 'lib/stellar/homework.rb', line 256

def attachment_data
  @attachment_url && @client.get_file(@attachment_url)
end

#delete!Object

Deletes this comment from Stellar.



244
245
246
247
248
249
250
251
# File 'lib/stellar/homework.rb', line 244

def delete!
  return if @deleted
  delete_page = @client.get @delete_url
  delete_form = delete_page.form_with(:action => /delete/i)
  delete_button = delete_form.button_with(:name => /delete/i)
  delete_form.submit delete_button
  @deleted = true
end