Module: Dnsimple::Default

Defined in:
lib/dnsimple/default.rb

Overview

Default configuration options for Client

Constant Summary collapse

API_ENDPOINT =

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

.api_endpointString

Default API endpoint from ENV or API_ENDPOINT

Returns:

  • (String)


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

def api_endpoint
  ENV['DNSIMPLE_API_ENDPOINT'] || API_ENDPOINT
end

.api_tokenString

Default DNSimple API Token for Token Auth from ENV

Returns:

  • (String)


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

def api_token
  ENV['DNSIMPLE_API_TOKEN']
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['DNSIMPLE_API_DOMAIN_TOKEN']
end

.exchange_tokenString

Default DNSimple Exchange Token for Basic Auth from ENV

Returns:

  • (String)


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

def exchange_token
  ENV['DNSIMPLE_API_EXCHANGE_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
27
# File 'lib/dnsimple/default.rb', line 16

def keys
  @keys ||= [
      :api_endpoint,
      :username,
      :password,
      :exchange_token,
      :api_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
  Hash[keys.map { |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['DNSIMPLE_PASSWORD']
end

.proxyString

Default Proxy address:port from ENV

Returns:

  • (String)


79
80
81
# File 'lib/dnsimple/default.rb', line 79

def proxy
  ENV['DNSIMPLE_PROXY']
end

.user_agentString

Default User-Agent header string from ENV or USER_AGENT

Returns:

  • (String)


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

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