Class: CodewarsApi::DeferredResponse

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ DeferredResponse


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

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


17
18
19
# File 'lib/codewars_api/deferred_response.rb', line 17

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

#errorsObject


37
38
39
# File 'lib/codewars_api/deferred_response.rb', line 37

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

#failedObject


41
42
43
# File 'lib/codewars_api/deferred_response.rb', line 41

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

#outputObject


65
66
67
# File 'lib/codewars_api/deferred_response.rb', line 65

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

#passedObject


33
34
35
# File 'lib/codewars_api/deferred_response.rb', line 33

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

#reasonObject


61
62
63
# File 'lib/codewars_api/deferred_response.rb', line 61

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

#server_errorObject


29
30
31
# File 'lib/codewars_api/deferred_response.rb', line 29

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

#solution_idObject


21
22
23
# File 'lib/codewars_api/deferred_response.rb', line 21

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

#status_codeObject


73
74
75
# File 'lib/codewars_api/deferred_response.rb', line 73

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

#successObject


13
14
15
# File 'lib/codewars_api/deferred_response.rb', line 13

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

#summary_errorsObject


57
58
59
# File 'lib/codewars_api/deferred_response.rb', line 57

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

#summary_failedObject


53
54
55
# File 'lib/codewars_api/deferred_response.rb', line 53

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

#summary_passedObject


49
50
51
# File 'lib/codewars_api/deferred_response.rb', line 49

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

#timed_outObject


45
46
47
# File 'lib/codewars_api/deferred_response.rb', line 45

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

#to_hObject


77
78
79
# File 'lib/codewars_api/deferred_response.rb', line 77

def to_h
  @response.to_h
end

#validObject


25
26
27
# File 'lib/codewars_api/deferred_response.rb', line 25

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

#wall_timeObject


69
70
71
# File 'lib/codewars_api/deferred_response.rb', line 69

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