Class: Smtp2go::Smtp2goResponse
- Inherits:
-
Object
- Object
- Smtp2go::Smtp2goResponse
- Defined in:
- lib/smtp2go/core.rb
Overview
Wraps response object with smtp2go specific data
Instance Attribute Summary collapse
-
#rate_limit ⇒ Object
readonly
Returns the value of attribute rate_limit.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response) ⇒ Smtp2goResponse
constructor
A new instance of Smtp2goResponse.
- #json ⇒ Object
- #request_id ⇒ Object
- #status_code ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Smtp2goResponse
Returns a new instance of Smtp2goResponse.
46 47 48 49 |
# File 'lib/smtp2go/core.rb', line 46 def initialize(response) @response = response @rate_limit = RateLimit.new @response.headers end |
Instance Attribute Details
#rate_limit ⇒ Object (readonly)
Returns the value of attribute rate_limit.
45 46 47 |
# File 'lib/smtp2go/core.rb', line 45 def rate_limit @rate_limit end |
Instance Method Details
#errors ⇒ Object
59 60 61 |
# File 'lib/smtp2go/core.rb', line 59 def errors json['data']['error'] end |
#json ⇒ Object
51 52 53 |
# File 'lib/smtp2go/core.rb', line 51 def json JSON.parse @response.body end |
#request_id ⇒ Object
63 64 65 |
# File 'lib/smtp2go/core.rb', line 63 def request_id json['request_id'] end |
#status_code ⇒ Object
67 68 69 |
# File 'lib/smtp2go/core.rb', line 67 def status_code @response.code end |
#success? ⇒ Boolean
55 56 57 |
# File 'lib/smtp2go/core.rb', line 55 def success? json['data']['succeeded'] ? true : false end |