Class: NDBC::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/ndbc/connection.rb

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



6
7
8
9
10
# File 'lib/ndbc/connection.rb', line 6

def initialize
  @client = Faraday.new do |faraday|
    faraday.adapter  Faraday.default_adapter
  end
end

Instance Method Details

#get(path) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/ndbc/connection.rb', line 12

def get(path)
  response = @client.get(path)
  case response.status
  when 200
    response.body
  when 404
    raise NDBC::NotFound
  end
end