Class: Heracles::Wrapper::RequestSuccess

Inherits:
RestClient::Response
  • Object
show all
Defined in:
lib/heracles-wrapper/request_success.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_id').to_i
  @messages = @json.fetch('messages',[]).to_a
  @location = http_response.headers.fetch(:location)
  @code = http_response.code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/heracles-wrapper/request_success.rb', line 9

def code
  @code
end

#job_idObject (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

#locationObject (readonly)

Returns the value of attribute location.



9
10
11
# File 'lib/heracles-wrapper/request_success.rb', line 9

def location
  @location
end

#messagesObject (readonly)

Returns the value of attribute messages.



9
10
11
# File 'lib/heracles-wrapper/request_success.rb', line 9

def messages
  @messages
end