Class: Heracles::Wrapper::RequestSuccess
- Inherits:
-
RestClient::Response
- Object
- RestClient::Response
- Heracles::Wrapper::RequestSuccess
- Defined in:
- lib/heracles-wrapper/request_success.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
-
#initialize(http_response) ⇒ RequestSuccess
constructor
A new instance of RequestSuccess.
Constructor Details
#initialize(http_response) ⇒ RequestSuccess
Returns a new instance of RequestSuccess.
15 16 17 18 19 20 21 22 |
# File 'lib/heracles-wrapper/request_success.rb', line 15 def initialize(http_response) super(http_response) @json = JSON.parse(http_response.body) @job_id = @json.fetch('job').fetch('id').to_i @errors = @json.fetch('errors',{}) @location = http_response.headers.fetch(:location) @code = http_response.code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/heracles-wrapper/request_success.rb', line 9 def code @code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/heracles-wrapper/request_success.rb', line 9 def errors @errors end |
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
9 10 11 |
# File 'lib/heracles-wrapper/request_success.rb', line 9 def job_id @job_id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
9 10 11 |
# File 'lib/heracles-wrapper/request_success.rb', line 9 def location @location end |