Sha256: 61f8f90e82130e19eaf04005e2b555fc7028daa4707727217db8e7fb5f011af7

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

module ApiAuth
  module Client
    class Base
      def self.inherited(child_class)
        child_class.class_eval do
          extend ClassMethods
        end
      end

      module ClassMethods
        attr_reader :attr_url, :attr_app_id, :attr_secret_key

        def connect(url:, app_id: nil, secret_key: nil)
          @attr_url = url
          @attr_app_id = app_id
          @attr_secret_key = secret_key
        end
      end

    private

      def connection
        @connection ||= Connection.new(
          url: self.class.attr_url,
          app_id: self.class.attr_app_id,
          secret_key: self.class.attr_secret_key,
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api_auth-client-0.0.1 lib/api_auth/client/base.rb