Sha256: 08029245d5290c88892ddc098399747cb39a7243123bfc3e1c40765ee1cfb5a1

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# typed: true
# frozen_string_literal: true

require 'securerandom'
require 'active_support/core_ext/class/attribute'

module Workato
  module Connector
    module Sdk
      module Dsl
        module ExecutionContext
          extend T::Sig
          extend T::Helpers
          extend ActiveSupport::Concern

          included do
            T.bind(self, Class)

            # encrypted safe recipe_id
            class_attribute :recipe_id, instance_predicate: false, default: SecureRandom.hex(32)
          end

          sig { returns(T::Hash[Symbol, T.untyped]) }
          def execution_context
            @execution_context ||= {
              recipe_id: recipe_id
            }.compact
          end

          # mock unencrypted recipe_id for testing only
          def recipe_id!
            recipe_id.reverse
          end

          module ClassMethods
            # mock unencrypted recipe_id for testing only
            def recipe_id!
              T.unsafe(self).recipe_id.reverse
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workato-connector-sdk-1.3.0 lib/workato/connector/sdk/dsl/execution_context.rb