Sha256: 8261d4782c5c49d50d28ce30a054368352472030a8d28a5d3f16208c04b62e31
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 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_default_headers headers = { 'Content-Type': "Application/json" } return headers end end
Version data entries
6 entries across 6 versions & 1 rubygems