Module: Dnsimple::Default

Defined in:
lib/dnsimple/default.rb

Overview

Default configuration options for Client

Constant Summary collapse

BASE_URL =

Default API endpoint

"https://api.dnsimple.com/"
USER_AGENT =

Default User Agent header

"dnsimple-ruby/#{VERSION}".freeze

Class Method Summary collapse

Class Method Details

.access_tokenString

Default DNSimple access token for OAuth authentication from ENV

Returns:

  • (String)


55
56
57
# File 'lib/dnsimple/default.rb', line 55

def access_token
  ENV.fetch('DNSIMPLE_ACCESS_TOKEN', nil)
end

.base_urlString

Default API endpoint from ENV or BASE_URL

Returns:

  • (String)


37
38
39
# File 'lib/dnsimple/default.rb', line 37

def base_url
  ENV.fetch('DNSIMPLE_BASE_URL', BASE_URL)
end

.domain_api_tokenString

Default DNSimple Domain API Token for Token Auth from ENV

Returns:

  • (String)


61
62
63
# File 'lib/dnsimple/default.rb', line 61

def domain_api_token
  ENV.fetch('DNSIMPLE_API_DOMAIN_TOKEN', nil)
end

.keysArray

List of configurable keys for Client

Returns:

  • (Array)

    of option keys



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dnsimple/default.rb', line 17

def keys
  @keys ||= [
    :base_url,
    :username,
    :password,
    :access_token,
    :domain_api_token,
    :user_agent,
    :proxy,
  ]
end

.optionsHash

Configuration options

Returns:

  • (Hash)


31
32
33
# File 'lib/dnsimple/default.rb', line 31

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

.passwordString

Default DNSimple password for Basic Auth from ENV

Returns:

  • (String)


49
50
51
# File 'lib/dnsimple/default.rb', line 49

def password
  ENV.fetch('DNSIMPLE_PASSWORD', nil)
end

.proxyString

Default Proxy address:port from ENV

Returns:

  • (String)


73
74
75
# File 'lib/dnsimple/default.rb', line 73

def proxy
  ENV.fetch('DNSIMPLE_PROXY', nil)
end

.user_agentString

Default User-Agent header string from ENV

Returns:

  • (String)


67
68
69
# File 'lib/dnsimple/default.rb', line 67

def user_agent
  ENV.fetch('DNSIMPLE_USER_AGENT', nil)
end

.usernameString

Default DNSimple username for Basic Auth from ENV

Returns:

  • (String)


43
44
45
# File 'lib/dnsimple/default.rb', line 43

def username
  ENV.fetch('DNSIMPLE_USERNAME', nil)
end