lib/ahub/answer.rb in ahub-0.1.12 vs lib/ahub/answer.rb in ahub-0.1.13

- old
+ new

@@ -1,19 +1,17 @@ module Ahub class Answer extend Ahub::APIHelpers include Ahub::ClassHelpers - attr_accessor :body, :author + attr_reader :body, :body_as_html, :author def initialize(attrs) @id = attrs[:id] - @error = attrs[:error] - @body = attrs[:body] - @body = attrs[:bodyAsHTML] - # @author = Ahub::User.new(attrs[:author]) # this is an incomplete user object. + @body_as_html = attrs[:bodyAsHTML] + @author = Ahub::User.new(attrs[:author]) end def user @author end @@ -24,11 +22,8 @@ url = "#{Ahub::DOMAIN}/services/v2/question/#{question_id}/answer.json" auth_headers = headers(username: username, password: password) new JSON.parse(RestClient.post(url, data.to_json, auth_headers), symbolize_names: true) - rescue => e - new({error: e.message}) end - end end