Sha256: 1c88be232ea6dd7c0c10c3a1c70f9466fbc0743d85d67e63da1dd868136fbe64

Contents?: true

Size: 1.81 KB

Versions: 3

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

require_relative "request"
require_relative "parse_options"
require_relative "lts_version"
require_relative "auth"

module Seam
  module Http
    class MultiWorkspace
      attr_reader :client, :defaults

      def initialize(personal_access_token:, endpoint: nil, wait_for_action_attempt: true, faraday_options: {},
        faraday_retry_options: {})
        @wait_for_action_attempt = wait_for_action_attempt
        @defaults = {"wait_for_action_attempt" => wait_for_action_attempt}
        @endpoint = Http::Options.get_endpoint(endpoint)
        @auth_headers = Http::Auth.get_auth_headers_for_multi_workspace_personal_access_token(personal_access_token)
        @client = Seam::Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
          faraday_retry_options)
      end

      def self.lts_version
        Seam::LTS_VERSION
      end

      def lts_version
        Seam::LTS_VERSION
      end

      def workspaces
        @workspaces ||= WorkspacesProxy.new(Seam::Clients::Workspaces.new(client: @client, defaults: @defaults))
      end

      def self.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
        new(
          personal_access_token: personal_access_token,
          endpoint: endpoint,
          wait_for_action_attempt: wait_for_action_attempt,
          faraday_options: faraday_options,
          faraday_retry_options: faraday_retry_options
        )
      end
    end

    class WorkspacesProxy
      def initialize(workspaces)
        @workspaces = workspaces
      end

      def list(**kwargs)
        @workspaces.list(**kwargs)
      end

      def create(**kwargs)
        @workspaces.create(**kwargs)
      end
    end

    private_constant :WorkspacesProxy
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
seam-2.0.0b2 lib/seam/http_multi_workspace.rb
seam-2.0.0b1 lib/seam/http_multi_workspace.rb
seam-2.0.0b0 lib/seam/http_multi_workspace.rb