Class: Favor::Api::Client::Response
- Inherits:
-
Object
- Object
- Favor::Api::Client::Response
- Defined in:
- lib/favor/api/client.rb
Instance Method Summary collapse
- #article ⇒ Object
- #body ⇒ Object
- #code ⇒ Object
- #error ⇒ Object
- #image ⇒ Object
- #images ⇒ Object
-
#initialize(res) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(res) ⇒ Response
Returns a new instance of Response.
63 64 65 66 67 |
# File 'lib/favor/api/client.rb', line 63 def initialize(res) @code = res.code @message = (res.kind_of? Net::HTTPSuccess) ? nil : res. @body = JSON.parse(res.body) end |
Instance Method Details
#article ⇒ Object
81 82 83 |
# File 'lib/favor/api/client.rb', line 81 def article @body['article'] end |
#body ⇒ Object
69 70 71 |
# File 'lib/favor/api/client.rb', line 69 def body @body end |
#code ⇒ Object
77 78 79 |
# File 'lib/favor/api/client.rb', line 77 def code @code.to_i end |
#error ⇒ Object
73 74 75 |
# File 'lib/favor/api/client.rb', line 73 def error @message end |
#image ⇒ Object
85 86 87 |
# File 'lib/favor/api/client.rb', line 85 def image @body['photo'] end |
#images ⇒ Object
89 90 91 |
# File 'lib/favor/api/client.rb', line 89 def images @body['photos'] end |