Sha256: 93cc7689e312cd09688ec26b59268682a5838231af4b675714a21f573acc1f54
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require "gitlab" module CiToolkit # Utility class that provides a faraday connection class SeeTestBot attr_reader :faraday_conn TIMEOUT = 60 # 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.fetch("SEETEST_BASE_URL", nil), access_token = ENV.fetch("SEETEST_ACCESS_TOKEN", nil) ) @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.options.timeout = TIMEOUT f.options.open_timeout = TIMEOUT f.request :authorization, "Bearer", credentials.access_token f.request :multipart f.request :url_encoded f.response :json 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ci_toolkit-1.6.4 | lib/ci_toolkit/seetest_bot.rb |
ci_toolkit-1.6.3 | lib/ci_toolkit/seetest_bot.rb |