Sha256: abd585f1150b64f4e0e6857ccaf8407779ac77cb213fefa90179e86e0de19ce5
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
require 'HTTParty' class AkriaClient attr_accessor :base_uri def initialize @base_uri = ENV["AKIRA"] || "http://localhost:6889" end def save_sessions(session_info) uri = "#{@base_uri}/sessions" puts uri puts session_info.to_json HTTParty.post(uri , body: session_info.to_json, headers: get_default_headers) end def save_session(session_info) uri = "#{@base_uri}/session" puts uri HTTParty.post(uri , body: session_info.to_json, headers: get_default_headers) end def remove_session(session_url) uri = "#{@base_uri}/removeSession" query_params = { 'sessionUrl':session_url } HTTParty.put(uri, query: query_params, headers: get_default_headers) end def get_session_info(session_url) uri = "#{@base_uri}/sessionInfo" puts uri query_params = { 'sessionUrl':session_url } response = HTTParty.get(uri, query: query_params, headers: get_default_headers) session_info = JSON.parse(response.to_s) return session_info end def get_all_sessions uri = "#{@base_uri}/sessionsList" puts uri response = HTTParty.get(uri, headers: get_default_headers) sessions = JSON.parse(response.to_s) return sessions end def get_default_headers headers = { 'Content-Type': "Application/json" } return headers end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
optimus-runner-1.1.3 | lib/optimus-runner/clients/AkiraClient.rb |
optimus-runner-1.1.2 | lib/optimus-runner/clients/AkiraClient.rb |