Class: Bci::Consumo

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

Overview

The class for BCI consumo 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
# File 'lib/bci/consumo.rb', line 10

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

#find(id) ⇒ Object



14
15
16
17
# File 'lib/bci/consumo.rb', line 14

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

#simulate(id, params) ⇒ Object



19
20
21
22
23
24
# File 'lib/bci/consumo.rb', line 19

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

#submoduleObject



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

def submodule
  'creditos-consumo'
end