Sha256: 467efb986c58461e2ac5d9d96193cea68ee98258fe765889059b0d0ddc9af53f

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

require "gitlab"

module CiToolkit
  # Utility class that provides an instance of a Gitlab Client
  class SeeTestBot
    attr_reader :faraday_conn

    # Provides a base url, an endpoint and an access token that can be used to
    # interact with the SeeTest web service
    class Credentials
      attr_reader :base_url, :access_token

      def initialize(
        base_url = ENV["SEETEST_BASE_URL"],
        access_token = ENV["SEETEST_ACCESS_TOKEN"]
      )
        @base_url = base_url
        @access_token = access_token
      end
    end

    def initialize(
      credentials = CiToolkit::SeeTestBot::Credentials.new,
      faraday_conn = Faraday.new(url: credentials.base_url) do |f|
        f.request :authorization, "Bearer", credentials.access_token
        f.request :multipart
        f.request :url_encoded
        f.adapter :net_http # A MUST for file upload to work with Faraday::Multipart::FilePart
      end
    )
      @faraday_conn = faraday_conn
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ci_toolkit-1.5.17 lib/ci_toolkit/seetest_bot.rb