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)


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

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

.base_urlString

Default API endpoint from ENV or BASE_URL

Returns:

  • (String)


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

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)


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

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

.keysArray

List of configurable keys for Client

Returns:

  • (Array)

    of option keys



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

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

.optionsHash

Configuration options

Returns:

  • (Hash)


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

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

.passwordString

Default DNSimple password for Basic Auth from ENV

Returns:

  • (String)


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

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

.proxyString

Default Proxy address:port from ENV

Returns:

  • (String)


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

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

.user_agentString

Default User-Agent header string from ENV

Returns:

  • (String)


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

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

.usernameString

Default DNSimple username for Basic Auth from ENV

Returns:

  • (String)


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

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