Sha256: 457e163f40158497066acd0721507bbdc79780354fa1d2e988d4c51d3c7daed5

Contents?: true

Size: 1.82 KB

Versions: 3

Compression:

Stored size: 1.82 KB

Contents

# frozen_string_literal: true

require_relative "request"
require_relative "parse_options"
require_relative "routes/routes"

module Seam
  module Http
    class SingleWorkspace
      include Seam::Routes

      attr_reader :client, :defaults

      def initialize(client: nil, api_key: nil, personal_access_token: nil, workspace_id: nil, endpoint: nil,
        wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
        options = Http::Options.parse_options(api_key: api_key, personal_access_token: personal_access_token,
          workspace_id: workspace_id, endpoint: endpoint)
        @endpoint = options[:endpoint]
        @auth_headers = options[:auth_headers]
        @defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt})
        @client = client || Seam::Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
          faraday_retry_options)

        initialize_routes(client: @client, defaults: @defaults)
      end

      def lts_version
        Seam::LTS_VERSION
      end

      def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: false, faraday_options: {}, faraday_retry_options: {})
        new(api_key: api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt,
          faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

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