lib/messenger/result.rb in messenger-0.2.0 vs lib/messenger/result.rb in messenger-0.3.0
- old
+ new
@@ -1,30 +1,26 @@
-module Messenger
+class Messenger::Result
- class Result
+ attr_reader :response
- attr_reader :response
+ def initialize(success, response)
+ @success = success
+ @response = response
+ end
- def initialize(success, response)
- @success = success
- @response = response
- end
+ def success?
+ !!@success
+ end
- def success?
- !!@success
- end
+ def code
+ response.code rescue nil
+ end
- def code
- response.code rescue nil
+ def body
+ if response.respond_to?(:body)
+ response.body
+ else
+ response.to_s
end
-
- def body
- if response.respond_to?(:body)
- response.body
- else
- response.to_s
- end
- end
-
end
end