Sha256: 4948366d6c0d0f0fb4aca08de50c70efd18b86ba19fbe365646b271da1a9ee58
Contents?: true
Size: 1.21 KB
Versions: 7
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require_relative "terminalwire/version" require 'forwardable' require 'uri' require 'zeitwerk' require 'async' require 'async/http/endpoint' require 'async/websocket/client' require 'async/websocket/adapters/rack' require 'uri-builder' module Terminalwire class Error < StandardError; end # Zeitwerk loader for the Terminalwire gem. Loader = Zeitwerk::Loader.for_gem.tap do |loader| loader.ignore("#{__dir__}/generators") loader.setup end # Used by Terminalwire client to connect to Terminalire.com for license # validations, etc. TERMINALWIRE_URL = "https://terminalwire.com".freeze def self.url = URI.build(TERMINALWIRE_URL) module Resource class Base attr_reader :name, :adapter def initialize(name, adapter) @name = name.to_s @adapter = adapter end def connect; end def disconnect; end def fail(response, **data) respond(status: "failure", response:, **data) end def succeed(response, **data) respond(status: "success", response:, **data) end private def respond(**response) adapter.write(event: "resource", name: @name, **response) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems