Module: Mambu::Finders

Included in:
LoanProduct
Defined in:
lib/mambu/finders.rb

Instance Method Summary collapse

Instance Method Details

#find(id, connection) ⇒ Object



3
4
5
6
7
# File 'lib/mambu/finders.rb', line 3

def find(id, connection)
  response = connection.get("#{endpoint(connection)}/#{id}")
  fail response.error unless response.success?
  new(response.body)
end

#find_all(connection) ⇒ Object



9
10
11
12
13
# File 'lib/mambu/finders.rb', line 9

def find_all(connection)
  response = connection.get(endpoint(connection))
  fail response.error unless response.success?
  response.body.map { |data| new(data) }
end