Class: CleverReach::ResponseDecorator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- CleverReach::ResponseDecorator
- Defined in:
- lib/clever_reach/response_decorator.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ ResponseDecorator
constructor
A new instance of ResponseDecorator.
- #status_code ⇒ Object
- #to_hash ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ ResponseDecorator
Returns a new instance of ResponseDecorator.
4 5 6 7 |
# File 'lib/clever_reach/response_decorator.rb', line 4 def initialize(response) super @response = response end |
Instance Method Details
#status_code ⇒ Object
14 15 16 |
# File 'lib/clever_reach/response_decorator.rb', line 14 def status_code answer_hash[:statuscode].to_i end |
#to_hash ⇒ Object
18 19 20 21 |
# File 'lib/clever_reach/response_decorator.rb', line 18 def to_hash data = answer_hash[:data] clean! data.dup end |
#valid? ⇒ Boolean
9 10 11 12 |
# File 'lib/clever_reach/response_decorator.rb', line 9 def valid? # Let's be flexible when checking for the status. answer_hash[:status] =~ /success/i end |