Sha256: 037d9f20816530e9452e02aa7c02c1f8309cd6f12e41b3f57360b7292df5ac1f
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 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 release_session(session_url) uri = "#{@base_uri}/sessionState/release" 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_session_state(session_url) uri = "#{@base_uri}/sessionState" query_params = { 'sessionUrl':session_url } response = HTTParty.get(uri, query: query_params, headers: get_default_headers) p response session_state = response return session_state 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.2.0 | lib/optimus-runner/clients/AkiraClient.rb |
optimus-runner-1.1.4 | lib/optimus-runner/clients/AkiraClient.rb |