module SenadoChile

Constants

VERSION

Public Class Methods

buscar(value, attribute='nombre', object='diputados') click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# 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

Private Instance Methods

buscar(value, attribute='nombre', object='diputados') click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# 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