From 0e56e5de09595f40b79bfe33463942d974cbeaf1 Mon Sep 17 00:00:00 2001 From: HAHWUL Date: Mon, 24 Jun 2024 23:47:48 +0900 Subject: [PATCH] Refactor Caido::Instance class initialization and automate session methods --- lib/caido/helpers/automate.rb | 30 ++++++++++++++++++++++++++++++ lib/caido/helpers/example.rb | 11 ----------- 2 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 lib/caido/helpers/automate.rb delete mode 100644 lib/caido/helpers/example.rb diff --git a/lib/caido/helpers/automate.rb b/lib/caido/helpers/automate.rb new file mode 100644 index 0000000..a0373af --- /dev/null +++ b/lib/caido/helpers/automate.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Caido + # Instance class + class Instance + def automate_session(id) + query("query{ + automateSession(id: \"#{id}\"){ + id + name + raw + createdAt + } + }")['automateSession'] + end + + def automate_sessions + query('query{ + automateSessions{ + nodes{ + id + name + raw + createdAt + } + } + }')['automateSessions'] + end + end +end diff --git a/lib/caido/helpers/example.rb b/lib/caido/helpers/example.rb deleted file mode 100644 index d2f7ad5..0000000 --- a/lib/caido/helpers/example.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module Caido - # Instance class - class Instance - def example_helper - # This is a example helper - 'test' - end - end -end