Sha256: c0cffdc05da62f6441ac529b7077a04ebaac87e433f13928b1c2706a3f399e76
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 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 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
5 entries across 5 versions & 1 rubygems