Class: Mindee::Parsing::Common::ApiRequest
- Inherits:
-
Object
- Object
- Mindee::Parsing::Common::ApiRequest
- Defined in:
- lib/mindee/parsing/common/api_response.rb
Overview
HTTP request response.
Instance Attribute Summary collapse
- #error ⇒ Hash readonly
- #ressources ⇒ Array<String> readonly
- #status ⇒ RequestStatus, Symbol readonly
- #status_code ⇒ Integer readonly
- #url ⇒ String readonly
Instance Method Summary collapse
-
#initialize(server_response) ⇒ ApiRequest
constructor
A new instance of ApiRequest.
Constructor Details
#initialize(server_response) ⇒ ApiRequest
Returns a new instance of ApiRequest.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/mindee/parsing/common/api_response.rb', line 79 def initialize(server_response) @error = server_response['error'] @ressources = server_response['ressources'] @status = if server_response['status'] == 'failure' RequestStatus::FAILURE elsif server_response['status'] == 'success' RequestStatus::SUCCESS else server_response['status']&.to_sym end @status_code = server_response['status_code'] @url = server_response['url'] end |
Instance Attribute Details
#error ⇒ Hash (readonly)
69 70 71 |
# File 'lib/mindee/parsing/common/api_response.rb', line 69 def error @error end |
#ressources ⇒ Array<String> (readonly)
71 72 73 |
# File 'lib/mindee/parsing/common/api_response.rb', line 71 def ressources @ressources end |
#status ⇒ RequestStatus, Symbol (readonly)
73 74 75 |
# File 'lib/mindee/parsing/common/api_response.rb', line 73 def status @status end |
#status_code ⇒ Integer (readonly)
75 76 77 |
# File 'lib/mindee/parsing/common/api_response.rb', line 75 def status_code @status_code end |
#url ⇒ String (readonly)
77 78 79 |
# File 'lib/mindee/parsing/common/api_response.rb', line 77 def url @url end |