Class: CiToolkit::SeeTestBot

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_toolkit/seetest_bot.rb

Overview

Utility class that provides a faraday connection

Defined Under Namespace

Classes: Credentials

Constant Summary collapse

TIMEOUT =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#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) ⇒ SeeTestBot

Returns a new instance of SeeTestBot.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ci_toolkit/seetest_bot.rb', line 26

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

Instance Attribute Details

#faraday_connObject (readonly)

Returns the value of attribute faraday_conn.



8
9
10
# File 'lib/ci_toolkit/seetest_bot.rb', line 8

def faraday_conn
  @faraday_conn
end