Module: OpConnect::Default

Defined in:
lib/op_connect/default.rb

Overview

Default configuration options for Client

Constant Summary collapse

API_ENDPOINT =
"http://localhost:8080/v1"
USER_AGENT =
"1Password Connect Ruby SDK #{OpConnect::VERSION}"

Class Method Summary collapse

Class Method Details

.access_tokenString

Default access token from ENV

Returns:

  • (String)


25
26
27
# File 'lib/op_connect/default.rb', line 25

def access_token
  ENV["OP_CONNECT_ACCESS_TOKEN"]
end

.adapterSymbol

Default network adapter for Faraday (defaults to :net_http)

Returns:

  • (Symbol)


33
34
35
# File 'lib/op_connect/default.rb', line 33

def adapter
  Faraday.default_adapter
end

.api_endpoint<Type>

Default API endpoint from ENV or API_ENDPOINT

Returns:

  • (<Type>)

    <description>



41
42
43
# File 'lib/op_connect/default.rb', line 41

def api_endpoint
  ENV["OP_CONNECT_API_ENDPOINT"] || API_ENDPOINT
end

.optionsHash

Configuration options

Returns:

  • (Hash)


17
18
19
# File 'lib/op_connect/default.rb', line 17

def options
  OpConnect::Configurable.keys.map { |key| [key, send(key)] }.to_h
end

.stubsObject



45
46
# File 'lib/op_connect/default.rb', line 45

def stubs
end

.user_agent<Type>

Default user agent from ENV or USER_AGENT

Returns:

  • (<Type>)

    <description>



52
53
54
# File 'lib/op_connect/default.rb', line 52

def user_agent
  ENV["OP_CONNECT_USER_AGENT"] || USER_AGENT
end