Class: CodewarsApi::DeferredResponse

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/codewars_api/deferred_response.rb

Instance Method Summary collapse

Methods included from Common

#reason, #success, #to_h

Constructor Details

#initialize(options) ⇒ DeferredResponse

Returns a new instance of DeferredResponse.



5
6
7
8
9
10
11
12
13
# File 'lib/codewars_api/deferred_response.rb', line 5

def initialize(options)
  api_key = options.delete!(:api_key)
  dmid = options.delete!(:dmid)

  request_options = {}
  request_options = RequestHelper.add_api_key(request_options, api_key)

  @response = RequestHelper.get("#{CodewarsApi::API_URL}/deferred/#{dmid}", request_options)
end

Instance Method Details

#dmidObject



15
16
17
# File 'lib/codewars_api/deferred_response.rb', line 15

def dmid
  @response.to_h['dmid']
end

#errorsObject



35
36
37
# File 'lib/codewars_api/deferred_response.rb', line 35

def errors
  @response.to_h['errors']
end

#failedObject



39
40
41
# File 'lib/codewars_api/deferred_response.rb', line 39

def failed
  @response.to_h['failed']
end

#outputObject



59
60
61
# File 'lib/codewars_api/deferred_response.rb', line 59

def output
  @response.to_h['output']
end

#passedObject



31
32
33
# File 'lib/codewars_api/deferred_response.rb', line 31

def passed
  @response.to_h['passed']
end

#server_errorObject



27
28
29
# File 'lib/codewars_api/deferred_response.rb', line 27

def server_error
  @response.to_h['server_error']
end

#solution_idObject



19
20
21
# File 'lib/codewars_api/deferred_response.rb', line 19

def solution_id
  @response.to_h['solution_id']
end

#status_codeObject



67
68
69
# File 'lib/codewars_api/deferred_response.rb', line 67

def status_code
  @response.to_h['status_code']
end

#summary_errorsObject



55
56
57
# File 'lib/codewars_api/deferred_response.rb', line 55

def summary_errors
  @response.to_h['summary'].andand['errors']
end

#summary_failedObject



51
52
53
# File 'lib/codewars_api/deferred_response.rb', line 51

def summary_failed
  @response.to_h['summary'].andand['failed']
end

#summary_passedObject



47
48
49
# File 'lib/codewars_api/deferred_response.rb', line 47

def summary_passed
  @response.to_h['summary'].andand['passed']
end

#timed_outObject



43
44
45
# File 'lib/codewars_api/deferred_response.rb', line 43

def timed_out
  @response.to_h['timed_out']
end

#validObject



23
24
25
# File 'lib/codewars_api/deferred_response.rb', line 23

def valid
  @response.to_h['valid']
end

#wall_timeObject



63
64
65
# File 'lib/codewars_api/deferred_response.rb', line 63

def wall_time
  @response.to_h['wall_time']
end