Module: SenadoChile
- Defined in:
- lib/senado_chile.rb,
lib/senado_chile/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .buscar(value, attribute = 'nombre', object = 'diputados') ⇒ Object
- .diputados ⇒ Object
- .periodo_actual ⇒ Object
- .periodos_legislativos ⇒ Object
- .senadores ⇒ Object
- .tramitaciones(date = Time.now.strftime('%d/%m/%Y').to_s) ⇒ Object
Class Method Details
.buscar(value, attribute = 'nombre', object = 'diputados') ⇒ Object
7 8 9 10 |
# File 'lib/senado_chile.rb', line 7 def buscar(value, attribute='nombre', object='diputados') response = send(object) founds = response.select{ |row| row[attribute.to_sym].include?(value) } end |
.diputados ⇒ Object
13 14 15 16 |
# File 'lib/senado_chile.rb', line 13 def diputados response = HTTParty.get('http://opendata.congreso.cl/wscamaradiputados.asmx/getDiputados_Vigentes') response.parsed_response["Diputados"]["Diputado"].string_to_symbol end |
.periodo_actual ⇒ Object
19 20 21 22 23 |
# File 'lib/senado_chile.rb', line 19 def periodo_actual reponse = HTTParty.get('http://opendata.congreso.cl/wscamaradiputados.asmx/getPeriodosLegislativos') current = reponse.parsed_response['PeriodosLegislativo']['PeriodoLegislativo'].string_to_symbol current.last end |
.periodos_legislativos ⇒ Object
26 27 28 29 |
# File 'lib/senado_chile.rb', line 26 def periodos_legislativos reponse = HTTParty.get('http://opendata.congreso.cl/wscamaradiputados.asmx/getPeriodosLegislativos') reponse.parsed_response['PeriodosLegislativo']['PeriodoLegislativo'].string_to_symbol end |
.senadores ⇒ Object
32 33 34 35 |
# File 'lib/senado_chile.rb', line 32 def senadores response = HTTParty.get('http://www.senado.cl/wspublico/senadores_vigentes.php') response.parsed_response["senadores"]["senador"].string_to_symbol end |
.tramitaciones(date = Time.now.strftime('%d/%m/%Y').to_s) ⇒ Object
38 39 40 41 |
# File 'lib/senado_chile.rb', line 38 def tramitaciones(date=Time.now.strftime('%d/%m/%Y').to_s) response = HTTParty.get("http://www.senado.cl/wspublico/tramitacion.php?fecha=#{date}") response.parsed_response["proyectos"]["proyecto"].string_to_symbol end |