Method: Dnsync::Nsone#connection

Defined in:
lib/dnsync/nsone.rb

#connectionObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dnsync/nsone.rb', line 16

def connection
  @connection ||= Faraday.new('https://api.nsone.net/v1/') do |conn|
    conn.request :json

    # conn.response :logger
    conn.response :raise_error
    conn.response :json, :content_type => /\bjson$/

    conn.adapter Faraday.default_adapter

    conn.headers['X-NSONE-Key'] = @api_key

    conn.options.timeout      = 5
    conn.options.open_timeout = 5
  end
end