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/".freeze
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)


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

def access_token
  ENV['DNSIMPLE_ACCESS_TOKEN']
end

.base_urlString

Default API endpoint from ENV or BASE_URL

Returns:

  • (String)


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

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)


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

def domain_api_token
  ENV['DNSIMPLE_API_DOMAIN_TOKEN']
end

.keysArray

List of configurable keys for Client

Returns:

  • (Array)

    of option keys



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

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

.optionsHash

Configuration options

Returns:

  • (Hash)


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

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

.passwordString

Default DNSimple password for Basic Auth from ENV

Returns:

  • (String)


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

def password
  ENV['DNSIMPLE_PASSWORD']
end

.proxyString

Default Proxy address:port from ENV

Returns:

  • (String)


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

def proxy
  ENV['DNSIMPLE_PROXY']
end

.user_agentString

Default User-Agent header string from ENV

Returns:

  • (String)


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

def user_agent
  ENV['DNSIMPLE_USER_AGENT']
end

.usernameString

Default DNSimple username for Basic Auth from ENV

Returns:

  • (String)


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

def username
  ENV['DNSIMPLE_USERNAME']
end