Class: Ahub::Answer
Instance Attribute Summary
Attributes included from APIResource
#attributes
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Deletable
#delete, #undelete
#json_url, #update, #update_attribute
Constructor Details
#initialize(attrs) ⇒ Answer
Returns a new instance of Answer.
12
13
14
15
|
# File 'lib/ahub/answer.rb', line 12
def initialize(attrs)
super
@author = Ahub::User.new(attrs[:author])
end
|
Class Method Details
.create(question_id:, body:, username:, password:) ⇒ Object
6
7
8
9
10
|
# File 'lib/ahub/answer.rb', line 6
def self.create(question_id:, body:, username:, password:)
url = "#{Ahub::DOMAIN}/services/v2/question/#{question_id}/answer.json"
create_resource(url: url, payload: {body: body}, headers: (username: username, password: password))
end
|
Instance Method Details
#html_url ⇒ Object
21
22
23
|
# File 'lib/ahub/answer.rb', line 21
def html_url
"#{Ahub::DOMAIN}/answers/#{id}/view.html" if id
end
|
#user ⇒ Object
17
18
19
|
# File 'lib/ahub/answer.rb', line 17
def user
@author
end
|