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}"

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['DNSIMPLE_ACCESS_TOKEN']
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['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['DNSIMPLE_API_DOMAIN_TOKEN']
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.map { |key| [key, send(key)] }.to_h
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['DNSIMPLE_PASSWORD']
end

.proxyString

Default Proxy address:port from ENV

Returns:

  • (String)


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

def proxy
  ENV['DNSIMPLE_PROXY']
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['DNSIMPLE_USER_AGENT']
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['DNSIMPLE_USERNAME']
end