Module: IronResponse::Common
- Defined in:
- lib/iron_response/common.rb
Constant Summary collapse
- S3_PATH =
"tasks"- DEFAULT_S3_BUCKET =
"iron_response"- DEFAULT_IRON_CACHE_CACHE_NAME =
"iron_response"
Class Method Summary collapse
- .handle_response(response, task_id, client) ⇒ Object
- .iron_cache_cache_name(config) ⇒ Object
- .iron_cache_key(task_id) ⇒ Object
- .response_provider(config) ⇒ Object
- .s3_bucket_name(config) ⇒ Object
- .s3_path(task_id) ⇒ Object
Class Method Details
.handle_response(response, task_id, client) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/iron_response/common.rb', line 28 def Common.handle_response(response, task_id, client) if response.nil? msg = client.tasks_log(task_id) IronResponse::Error.new("IronWorker error: #{msg}") else JSON.parse(response.value) end end |
.iron_cache_cache_name(config) ⇒ Object
20 21 22 |
# File 'lib/iron_response/common.rb', line 20 def Common.iron_cache_cache_name(config) config[:iron_io][:cache].nil? ? DEFAULT_IRON_CACHE_CACHE_NAME : @config[:iron_io][:cache] end |
.iron_cache_key(task_id) ⇒ Object
16 17 18 |
# File 'lib/iron_response/common.rb', line 16 def Common.iron_cache_key(task_id) task_id end |
.response_provider(config) ⇒ Object
24 25 26 |
# File 'lib/iron_response/common.rb', line 24 def Common.response_provider(config) config[:aws_s3].nil? ? :iron_cache : :aws_s3 end |
.s3_bucket_name(config) ⇒ Object
12 13 14 |
# File 'lib/iron_response/common.rb', line 12 def Common.s3_bucket_name(config) config[:aws_s3][:bucket].nil? ? DEFAULT_S3_BUCKET : @config[:aws_s3][:bucket] end |