class Ahub::Answer
Public Class Methods
create(question_id:, body:, username:, password:)
click to toggle source
# 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: headers(username: username, password: password)) end
new(attrs)
click to toggle source
Calls superclass method
Ahub::APIResource::new
# File lib/ahub/answer.rb, line 12 def initialize(attrs) super @author = Ahub::User.new(attrs[:author]) end
Public Instance Methods
html_url()
click to toggle source
# File lib/ahub/answer.rb, line 21 def html_url "#{Ahub::DOMAIN}/answers/#{id}/view.html" if id end
user()
click to toggle source
# File lib/ahub/answer.rb, line 17 def user @author end