Class: EcalClient::Response
- Inherits:
-
Object
- Object
- EcalClient::Response
- Defined in:
- lib/ecal_client/api/response.rb
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #params ⇒ Object
- #status ⇒ Object
- #status_long ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/ecal_client/api/response.rb', line 4 def initialize(response) @response = response end |
Instance Method Details
#errors ⇒ Object
20 21 22 |
# File 'lib/ecal_client/api/response.rb', line 20 def errors @error ||= params['errors'] end |
#params ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/ecal_client/api/response.rb', line 24 def params @params ||= begin JSON.parse(@response.body) rescue => e puts e.to_s if EcalClient.configuration.[:verbose] end @params ||= {} end |
#status ⇒ Object
12 13 14 |
# File 'lib/ecal_client/api/response.rb', line 12 def status @response.status.to_i end |
#status_long ⇒ Object
16 17 18 |
# File 'lib/ecal_client/api/response.rb', line 16 def status_long @status_log ||= params['statusLong'] end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/ecal_client/api/response.rb', line 8 def success? [ 200 ].include? status end |