Class: Bci::Hipotecario

Inherits:
Base
  • Object
show all
Defined in:
lib/bci/hipotecario.rb

Overview

The class for BCI hipotecario API

Constant Summary

Constants inherited from Base

Base::BASE_URL

Instance Method Summary collapse

Methods inherited from Base

#connector, #headers, #initialize, #response_checker, #url

Constructor Details

This class inherits a constructor from Bci::Base

Instance Method Details

#allObject



10
11
12
13
# File 'lib/bci/hipotecario.rb', line 10

def all
  puts url
  response_checker(connector.get(url, headers))
end

#find(id) ⇒ Object



15
16
17
18
# File 'lib/bci/hipotecario.rb', line 15

def find(id)
  local_url = "#{url}/#{id}"
  response_checker(connector.get(local_url, headers))
end

#find_rates(id) ⇒ Object



28
29
30
31
# File 'lib/bci/hipotecario.rb', line 28

def find_rates(id)
  local_url = "#{url}/#{id}/tasas"
  response_checker(connector.get(local_url, headers))
end

#simulate(id, params) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/bci/hipotecario.rb', line 20

def simulate(id, params)
  local_url = "#{url}/#{id}/simulaciones"
  puts local_url
  response_checker(connector.post(local_url, params.to_json, headers))
rescue RestClient::InternalServerError => e
  puts e
end

#submoduleObject



6
7
8
# File 'lib/bci/hipotecario.rb', line 6

def submodule
  'creditos_hipotecarios'
end