Class: FrederickAPI::V2::BackgroundJob
- Inherits:
-
Resource
- Object
- JsonApiClient::Resource
- Resource
- FrederickAPI::V2::BackgroundJob
show all
- Defined in:
- lib/frederick_api/v2/background_job.rb
Overview
V2 Frederick API async background job class for parsing background job responses coming from API.
Instance Attribute Summary collapse
Attributes inherited from Resource
#custom_headers
Instance Method Summary
collapse
Methods inherited from Resource
_header_store, all_records, custom_headers, #initialize, site, top_level_namespace, with_access_token, with_access_token_and_headers
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
8
9
10
|
# File 'lib/frederick_api/v2/background_job.rb', line 8
def response
@response
end
|
Instance Method Details
#errors ⇒ Object
27
28
29
|
# File 'lib/frederick_api/v2/background_job.rb', line 27
def errors
@attributes['messages']
end
|
#has_errors? ⇒ Boolean
10
11
12
|
# File 'lib/frederick_api/v2/background_job.rb', line 10
def has_errors?
@attributes['status'] == 'error'
end
|
#id ⇒ Object
31
32
33
|
# File 'lib/frederick_api/v2/background_job.rb', line 31
def id
@attributes['id']
end
|
#response_code ⇒ Object
19
20
21
|
# File 'lib/frederick_api/v2/background_job.rb', line 19
def response_code
@response_code ||= @response[:status]
end
|
#retry_after ⇒ Object
14
15
16
17
|
# File 'lib/frederick_api/v2/background_job.rb', line 14
def retry_after
try_time = @response[:headers]['retry-after'].to_i
@retry_after ||= try_time > 1 ? try_time : 1
end
|
#status ⇒ Object
23
24
25
|
# File 'lib/frederick_api/v2/background_job.rb', line 23
def status
@attributes['status']
end
|