class RegressyCommon::SnapStorage
Public Instance Methods
store_file(file, tag)
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 5 def store_file(file, tag) # if not define api_base, skip post and unlink for development if api_base post_file(file, tag) if api_base File.unlink(file.path) end end
Private Instance Methods
api_base()
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 32 def api_base ENV['API_BASE'] end
api_token()
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 44 def api_token ENV['API_TOKEN'] end
inner_api_url()
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 28 def inner_api_url %(#{api_base}#{path}) end
path()
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 36 def path %(/test_tasks/#{test_task_id}/snap_shots) end
post_file(file, tag)
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 15 def post_file(file, tag) res = File.open(file.path) do |file| HTTPClient.new.post( inner_api_url, { upload: file, api_token: api_token, snap_tag: tag, } ) end end
test_task_id()
click to toggle source
# File lib/regressy_common/snap_storage.rb, line 40 def test_task_id ENV['TEST_TASK_ID'] end