2015-03-31 11:58:56 -05:00
|
|
|
require_dependency 'has_errors'
|
|
|
|
|
|
|
|
class NewPostResult
|
|
|
|
include HasErrors
|
|
|
|
|
|
|
|
attr_reader :action
|
2015-04-28 14:06:27 -05:00
|
|
|
|
|
|
|
attr_accessor :reason
|
2015-03-31 11:58:56 -05:00
|
|
|
attr_accessor :post
|
2015-04-10 16:00:50 -05:00
|
|
|
attr_accessor :queued_post
|
2015-04-24 14:44:59 -05:00
|
|
|
attr_accessor :pending_count
|
2015-03-31 11:58:56 -05:00
|
|
|
|
|
|
|
def initialize(action, success=false)
|
|
|
|
@action = action
|
|
|
|
@success = success
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_errors_from(obj)
|
|
|
|
if obj.errors.empty?
|
|
|
|
@success = true
|
|
|
|
else
|
|
|
|
add_errors_from(obj)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def success?
|
|
|
|
@success
|
|
|
|
end
|
|
|
|
|
|
|
|
def failed?
|
|
|
|
!@success
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|