Module: Mambu::Helpers

Included in:
LoanSchedule, Savings
Defined in:
lib/mambu/helpers.rb

Instance Method Summary collapse

Instance Method Details

#camelize_hash(options) ⇒ Object



14
15
16
# File 'lib/mambu/helpers.rb', line 14

def camelize_hash(options)
  Hash[options.map { |k, v| [k.to_s.camelize(:lower).to_sym, v] }]
end

#handle_error(response) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/mambu/helpers.rb', line 3

def handle_error(response)
  return if response.success?
  error = response.error
  if error.status == 'INTERNAL_SERVER_ERROR'
    error = Mambu::Error.new(
      'Mambu API returned error without message.'
    )
  end
  fail error
end