Class: EcalClient::Response
- Inherits:
-
Object
- Object
- EcalClient::Response
- Defined in:
- lib/ecal_client/api/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
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.
6 7 8 |
# File 'lib/ecal_client/api/response.rb', line 6 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/ecal_client/api/response.rb', line 4 def response @response end |
Instance Method Details
#errors ⇒ Object
22 23 24 |
# File 'lib/ecal_client/api/response.rb', line 22 def errors @error ||= params['errors'] end |
#params ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/ecal_client/api/response.rb', line 26 def params @params ||= begin JSON.parse(@response.body) rescue => e puts e.to_s if EcalClient.configuration.[:verbose] end @params ||= {} end |
#status ⇒ Object
14 15 16 |
# File 'lib/ecal_client/api/response.rb', line 14 def status @response.status.to_i end |
#status_long ⇒ Object
18 19 20 |
# File 'lib/ecal_client/api/response.rb', line 18 def status_long @status_log ||= params['statusLong'] end |
#success? ⇒ Boolean
10 11 12 |
# File 'lib/ecal_client/api/response.rb', line 10 def success? [ 200 ].include? status end |