uni 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +23 -15
- data/lib/uni.rb +13 -23
- data/lib/uni/params.rb +6 -0
- data/lib/uni/private_info.rb +8 -9
- data/lib/uni/public_info.rb +38 -24
- data/lib/uni/version.rb +1 -1
- data/spec/lib/uni_spec.rb +119 -52
- data/uni.gemspec +12 -12
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjkxZWUxYTY3ZDI0YjU5ZjY5NDM3NmE0ZmVkZmNiMTQ1MTYwZjA3MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGI3MDBiZjY0NDg3MjQ3OTkzNzJkYzhhYTZhZmU0Y2QxY2NlMmFhYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Yzk1MDdjODhhZGMxM2QyY2RkODM0ZjFkYjAzMjU4MzI0N2M1ZjZlN2E1ZTUx
|
10
|
+
NGIzYTMwYmM3NTViMzlmYWVhNzY2NDFiY2FkMDAzYzUzZTVlMzJiYTA0MzVi
|
11
|
+
MzM3MTAzNmVkNGI4MDQzOWFjYWJkMDI4ZWQwMjhiOTI5Y2VhNzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWU4ODVlODVjMGI5NDk1NGE2Y2NhNTdjYzg2M2ZmMjQxMWRjYzg1MWM2ZDBk
|
14
|
+
ZjA5ZTAzNjYyNTIwMzM2ZGRjOTg1ZTgyYWNjN2Y3ZTUxMWUwMGY4MmU0YmZm
|
15
|
+
MDliNTg5NGQ0OTBkMzI0MTg4MGZjNGI0OWFhYjVhMDk0NGIwY2M=
|
data/README.md
CHANGED
@@ -1,42 +1,50 @@
|
|
1
1
|
## Uni
|
2
2
|
Simple interface de la [Orce](http://www.orce.uni.edu.pe/).
|
3
|
-
Permite visualizar informacion publica, validar codigo, obtener la letra del mismo y consultar notas
|
3
|
+
Permite visualizar informacion publica, validar codigo, obtener la letra del mismo y consultar notas del ultimo ciclo
|
4
4
|
## Instalacion
|
5
5
|
```bash
|
6
6
|
$ gem install uni
|
7
7
|
```
|
8
|
+
Una vez instalado el uso es simple, solo debes requerirlo
|
9
|
+
```ruby
|
10
|
+
require 'uni'
|
11
|
+
```
|
8
12
|
## Ejemplos de uso:
|
9
13
|
### Obtener la letra del codigo:
|
10
14
|
Usando el algoritmo de MOD11
|
11
15
|
```ruby
|
12
16
|
Uni.codigo_uni 19741084 # => "19741084H"
|
17
|
+
Uni.codigo_uni "19741084" # => "19741084H"
|
13
18
|
```
|
14
|
-
|
19
|
+
### Validar codigo
|
15
20
|
```ruby
|
16
|
-
Uni.
|
17
|
-
Uni.
|
21
|
+
Uni.valid? "19741084K" # => false
|
22
|
+
Uni.valid? "20072531g" # => true
|
18
23
|
```
|
19
24
|
### Consultar informacion basica:
|
20
|
-
Tambien llamada informacion publica
|
25
|
+
Tambien llamada informacion publica
|
21
26
|
```ruby
|
22
|
-
Uni.data "19741084H"
|
27
|
+
Uni.data "19741084H"
|
28
|
+
# => {:codigo=>"19741084H", :nombre=>"...", :facultad=>"...", ...}
|
23
29
|
```
|
24
30
|
### Consultar cursos, seccion, evaluaciones, calificaciones, etc
|
25
31
|
Se require conocer el codigo y password del alumno(regular).
|
26
32
|
```ruby
|
27
33
|
codigo = "20152015"
|
28
|
-
password = "99999"
|
34
|
+
password = "99999"
|
29
35
|
notas = Uni.notas codigo, password
|
30
36
|
```
|
31
|
-
Retorna un Array de Hashes, cada Hash corresponde a un curso
|
37
|
+
Retorna un Array de Hashes, cada Hash corresponde a un curso. Si la informacion proporcionada es invalida, retornara un Array.new
|
32
38
|
```ruby
|
33
|
-
|
34
|
-
# { :curso => "
|
35
|
-
# :notas => {:practicas=>[
|
36
|
-
|
39
|
+
notas[0]
|
40
|
+
# => { :curso => "Geometria Analitica", :codigo => "CB102", :seccion => "U",
|
41
|
+
# :notas => {:practicas=>[...], :examenes=>[...]}}
|
42
|
+
notas[0][:notas][:practicas][2]
|
43
|
+
# => ["PRACTICA 3", "18", "--", "16.13%"]
|
44
|
+
notas[0][:notas][:examenes][0]
|
45
|
+
# => ["EXAMEN PARCIAL", "08", "--", "32.35%"]
|
37
46
|
```
|
38
47
|
## Ideas/problemas/uso
|
39
|
-
* TODO: Clase alumno, Uni.sample, filtrar,
|
40
|
-
* Sugerencias, dudas o problemas
|
48
|
+
* TODO: Clase alumno, Uni.sample, filtrar, cambiar de nombre a la gema
|
49
|
+
* Sugerencias, dudas o problemas en la repo([issues](https://github.com/cxrlospxndo/uni/issues)) o en su defecto a mi [email](mailto:cxrlospxndo@gmail.com).
|
41
50
|
* De momento lo mas cool que he hecho con esta gema es obtener esta info [2013-I](http://goo.gl/hqNKI)
|
42
|
-
|
data/lib/uni.rb
CHANGED
@@ -1,35 +1,25 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
require 'nokogiri'
|
3
3
|
|
4
|
+
require "uni/params"
|
4
5
|
require "uni/version"
|
5
6
|
require "uni/public_info"
|
6
7
|
require "uni/private_info"
|
7
8
|
|
8
9
|
module Uni
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def step
|
18
|
-
Uni::codigo_uni 20072531
|
19
|
-
end
|
20
|
-
# Ejemplo de uso de #fast_uni y #data
|
21
|
-
# @return [Hash] informacion publica del alumno
|
22
|
-
def beep
|
23
|
-
Uni.initialize
|
24
|
-
codigo = Uni::fast_uni 20072531
|
25
|
-
data = Uni::data codigo
|
26
|
-
puts data
|
27
|
-
end
|
28
|
-
## cursos y notas
|
29
|
-
#def top
|
30
|
-
# ...
|
31
|
-
#end
|
10
|
+
# Ejemplo de uso de #codigo_uni, #fast_uni y #data
|
11
|
+
# @return [Hash] informacion publica del alumno
|
12
|
+
def beep
|
13
|
+
puts Uni.codigo_uni 20072531
|
14
|
+
Uni.initialize
|
15
|
+
codigo = Uni::fast_uni 20072531
|
16
|
+
data = Uni::data codigo
|
17
|
+
puts data
|
32
18
|
end
|
19
|
+
## cursos y notas
|
20
|
+
#def top
|
21
|
+
# ...
|
22
|
+
#end
|
33
23
|
end
|
34
24
|
|
35
25
|
|
data/lib/uni/params.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
module Uni
|
2
|
+
URL = 'http://www.orce.uni.edu.pe/'
|
3
|
+
SITUACION = [ 'SUSPENSION VOLUNTARIA', 'ALUMNO REGULAR', 'INACTIVO', 'EN REGULARIZACION DE CURSO(S)',
|
4
|
+
'EXPULSADO', 'INACTIVO', 'RETIRADO ', 'FALLECIDO', 'SUSPENSION ', 'PROYECTO ESPECIAL ALUMNOS UNI',
|
5
|
+
'TITULADO', 'BACHILLER', 'EGRESADO']
|
6
|
+
end
|
data/lib/uni/private_info.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
URL = "http://www.orce.uni.edu.pe/"
|
2
1
|
module Uni
|
3
2
|
# Falta refactorizar, aplicar buenas practicas, tests, etc
|
4
3
|
# http://www.orce.uni.edu.pe/recordNotas.php?op=cursos&flag=notas
|
@@ -13,9 +12,9 @@ module Uni
|
|
13
12
|
cursos = []
|
14
13
|
|
15
14
|
agent = Mechanize.new
|
16
|
-
params = {
|
17
|
-
agent.post( URL +
|
18
|
-
agent.get URL +
|
15
|
+
params = {'txtusu' => codigo, 'txtcla' => password}
|
16
|
+
agent.post( Uni::URL + 'logeo.php', params)
|
17
|
+
agent.get Uni::URL + 'recordNotas.php?op=cursos&flag=notas'
|
19
18
|
pag = agent.page
|
20
19
|
a=[]
|
21
20
|
pag.parser.css('tr.fila td').each do |f|
|
@@ -25,15 +24,15 @@ module Uni
|
|
25
24
|
n = a.size/5
|
26
25
|
|
27
26
|
(1..n).each do |i|
|
28
|
-
ans = { curso:
|
27
|
+
ans = { curso: '', codigo: '', seccion: '', notas: {} }
|
29
28
|
ind = (i-1)*5
|
30
29
|
curso = a[ind.. ind+4]
|
31
30
|
ans[:codigo] = curso[0]
|
32
31
|
ans[:curso] = curso[1]
|
33
32
|
ans[:seccion] = curso[2]
|
34
33
|
|
35
|
-
practicas = obtener_notas_de
|
36
|
-
examenes = obtener_notas_de
|
34
|
+
practicas = obtener_notas_de 'Practicas', ans[:codigo], ans[:seccion], agent
|
35
|
+
examenes = obtener_notas_de 'Teoria', ans[:codigo], ans[:seccion], agent
|
37
36
|
|
38
37
|
ans[:notas] = { practicas: practicas, examenes: examenes}
|
39
38
|
cursos << ans
|
@@ -44,11 +43,11 @@ module Uni
|
|
44
43
|
# @return [Array] Nota del curso
|
45
44
|
|
46
45
|
def self.obtener_notas_de evaluacion, codigo, seccion, agent
|
47
|
-
agent.get URL+"recordNotas.php?op=notas&tipo=#{evaluacion}&codcur=#{codigo}&facul=I&codsec=#{seccion}"
|
46
|
+
agent.get Uni::URL+"recordNotas.php?op=notas&tipo=#{evaluacion}&codcur=#{codigo}&facul=I&codsec=#{seccion}"
|
48
47
|
pag_evaluacion = agent.page
|
49
48
|
|
50
49
|
evaluacion=[]
|
51
|
-
pag_evaluacion.parser.css(
|
50
|
+
pag_evaluacion.parser.css('tr td').each_slice(4) do |f|
|
52
51
|
ans = []
|
53
52
|
f.each do |c|
|
54
53
|
ans << c.content.gsub(/\u00a0/, '') # 
|
data/lib/uni/public_info.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
SITUACIONX = [ "SUSPENSION VOLUNTARIA", "ALUMNO REGULAR", "INACTIVO", "EN REGULARIZACION DE CURSO(S)", "EXPULSADO", "INACTIVO", "RETIRADO ", "FALLECIDO", "SUSPENSION ", "PROYECTO ESPECIAL ALUMNOS UNI"]
|
3
|
-
SITUACIONY = [ "TITULADO", "BACHILLER", "EGRESADO"]
|
4
|
-
|
5
2
|
module Uni
|
6
|
-
SITUACION = SITUACIONX + SITUACIONY
|
7
3
|
@x, @y = {}, {}
|
8
4
|
@base = Mechanize.new
|
9
5
|
# Inicializa las constantes @x y @y, para el uso de #fast_uni
|
@@ -19,70 +15,88 @@ module Uni
|
|
19
15
|
end
|
20
16
|
(0..9999).each do |n|
|
21
17
|
tmp, v, ans = n, 4567, 0
|
22
|
-
while
|
18
|
+
while tmp != 0
|
23
19
|
ans += (tmp%10)*(v%10)
|
24
20
|
v /= 10
|
25
21
|
tmp /= 10
|
26
22
|
end
|
27
23
|
@y[n] = ans
|
28
|
-
"Ahora puedes usar #fast_uni"
|
29
24
|
end
|
25
|
+
'memoria inicializada'
|
30
26
|
end
|
31
27
|
# Obtiene la letra del codigo (mas rapido que la implementacion #codigo_uni)
|
32
28
|
# @see #codigo_uni
|
33
29
|
# @param n [Fixnum] Un objeto Fixnum # 20072531
|
34
30
|
# @return [String] El codigo con su respectiva letra # 20072531G
|
35
31
|
def self.fast_uni n
|
36
|
-
n.to_s + (65 + (@x[n/10000] + @y[n%10000])%11).chr
|
32
|
+
n.to_s + (65 + (@x[n.to_i/10000] + @y[n.to_i%10000])%11).chr
|
37
33
|
end
|
38
34
|
# Obtiene letra de codigo
|
39
35
|
# @see #fast_uni
|
40
36
|
# @param n [Fixnum] Un objeto Fixnum # 20072531
|
41
37
|
# @return [String] El codigo con su respectiva letra # 20072531G
|
42
38
|
def self.codigo_uni n
|
43
|
-
|
39
|
+
n = n.to_i
|
40
|
+
codigo = n
|
44
41
|
v, ans = 21234567, 0
|
45
|
-
8.times do
|
42
|
+
8.times do
|
46
43
|
ans += (n%10)*(v%10)
|
47
44
|
v /= 10
|
48
45
|
n /= 10
|
49
46
|
end
|
50
|
-
codigo + (65 + ans%11).chr
|
47
|
+
codigo.to_s + (65 + ans%11).chr
|
51
48
|
end
|
52
|
-
# Obtiene informacion publica de un alumno #
|
53
|
-
# @param codigo [String] Un objeto String, que representa el codigo de un estudiante # 20072531G
|
49
|
+
# Obtiene informacion publica de un alumno # facultad, especialidad, pic:url, ciclo_relativo, etc
|
50
|
+
# @param codigo [String] Un objeto String, que representa el codigo de un estudiante # 20072531G, 20072531
|
54
51
|
# @return [Hash] Informacion publica obtenida de la Orce
|
55
52
|
|
56
|
-
def self.data codigo
|
53
|
+
def self.data codigo
|
54
|
+
codigo = codigo_uni codigo if codigo.is_a? Fixnum
|
57
55
|
agent = @base
|
58
|
-
cod = codigo.upcase
|
59
|
-
url = "
|
56
|
+
cod = codigo.upcase
|
57
|
+
url = Uni::URL + "detaalu.php?id=#{cod}&op=detalu"
|
60
58
|
|
61
59
|
page = agent.get url
|
62
60
|
a = []
|
63
61
|
|
64
|
-
page.parser.css(
|
62
|
+
page.parser.css('tr td').each do |f|
|
65
63
|
a << f.text
|
66
64
|
end
|
67
65
|
|
68
|
-
nombre = a[6].split(
|
69
|
-
return {} if nombre ==
|
66
|
+
nombre = a[6].split('-').join(' ')
|
67
|
+
return {} if nombre == ''
|
70
68
|
info = { codigo: codigo, nombre: nombre }
|
71
69
|
info[:facultad] = a[9]
|
72
70
|
info[:especialidad] = a[12]
|
73
71
|
info[:situacion] = a[15]
|
74
|
-
info[:pic] =
|
75
|
-
info[:pic] =
|
72
|
+
info[:pic] = Uni::URL + page.parser.css('img')[3]['src']
|
73
|
+
info[:pic] = 'NO TIENE FOTO' if /nose/ =~ info[:pic]
|
76
74
|
|
77
|
-
info[:ciclo_relativo] = page.parser.xpath('//td[@bgcolor!="#ffffff"]').last.text.gsub(/[.]/, '').to_i rescue
|
75
|
+
info[:ciclo_relativo] = page.parser.xpath('//td[@bgcolor!="#ffffff"]').last.text.gsub(/[.]/, '').to_i rescue ' '
|
78
76
|
|
79
|
-
if
|
80
|
-
info[:egreso] =
|
77
|
+
if Uni::SITUACION[0..9].include? info[:situacion]
|
78
|
+
info[:egreso] = ''
|
81
79
|
info[:medida_disciplinaria] = a[18]
|
82
80
|
else
|
83
|
-
info[:egreso] = a[17].length == 3 ?
|
81
|
+
info[:egreso] = a[17].length == 3 ? '' : a[17]
|
84
82
|
info[:medida_disciplinaria] = a[20]
|
85
83
|
end
|
86
84
|
info
|
87
85
|
end
|
86
|
+
# Valida que el codigo pertenezca a un alumno(existe)
|
87
|
+
# @param codigo [String] Un objeto String, que representa el codigo de un estudiante # 20072531G, 20072531
|
88
|
+
# @return [Boolean] es valido?
|
89
|
+
def self.valid? codigo
|
90
|
+
codigo = codigo_uni codigo if codigo.is_a? Fixnum
|
91
|
+
agent = @base
|
92
|
+
cod = codigo.upcase
|
93
|
+
url = Uni::URL + "detaalu.php?id=#{cod}&op=detalu"
|
94
|
+
page = agent.get url
|
95
|
+
a = []
|
96
|
+
page.parser.css('tr td').each do |f|
|
97
|
+
a << f.text
|
98
|
+
end
|
99
|
+
a[6].split('-').join(' ') == '' ? false:true
|
100
|
+
end
|
101
|
+
# deberia ser codigo.valid?, de momento lo dejamos en Uni.valido? "20072531a"
|
88
102
|
end
|
data/lib/uni/version.rb
CHANGED
data/spec/lib/uni_spec.rb
CHANGED
@@ -1,79 +1,146 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
describe 'Uni' do
|
4
|
-
|
5
|
-
|
6
|
-
it
|
7
|
-
Uni::
|
4
|
+
|
5
|
+
context 'parameters' do
|
6
|
+
it 'has correct orce''s url' do
|
7
|
+
Uni::URL.should eql 'http://www.orce.uni.edu.pe/'
|
8
8
|
end
|
9
|
-
it
|
10
|
-
Uni::
|
9
|
+
it 'has a collection of all posible situacion' do
|
10
|
+
Uni::SITUACION.should be_an_instance_of Array
|
11
11
|
end
|
12
|
-
|
13
|
-
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#valid?' do
|
15
|
+
specify { Uni.valid?(20072531).should be_true }
|
16
|
+
specify { Uni.valid?('20072531g').should be_true }
|
17
|
+
specify { Uni.valid?('20072531a').should_not be_true }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#codigo_Uni' do
|
21
|
+
context 'param is String' do
|
22
|
+
it 'returns a String' do
|
23
|
+
Uni::codigo_uni('20072531').should be_an_instance_of String
|
24
|
+
end
|
25
|
+
it 'returns "20072531G" for 20072531' do
|
26
|
+
Uni::codigo_uni('20072531').should eql '20072531G'
|
27
|
+
end
|
28
|
+
it 'returns "19100003B" for 19100003' do
|
29
|
+
Uni::codigo_uni('19100003').should eql '19100003B'
|
30
|
+
end
|
31
|
+
it 'returns "20090435F" for 20090435' do
|
32
|
+
Uni::codigo_uni('20090435').should eql '20090435F'
|
33
|
+
end
|
14
34
|
end
|
15
|
-
|
16
|
-
|
35
|
+
|
36
|
+
context 'param is Fixnum' do
|
37
|
+
it 'returns a String' do
|
38
|
+
Uni::codigo_uni(20072531).should be_an_instance_of String
|
39
|
+
end
|
40
|
+
it 'returns "20072531G" for 20072531' do
|
41
|
+
Uni::codigo_uni(20072531).should eql '20072531G'
|
42
|
+
end
|
43
|
+
it 'returns "19100003B" for 19100003' do
|
44
|
+
Uni::codigo_uni(19100003).should eql '19100003B'
|
45
|
+
end
|
46
|
+
it 'returns "20090435F" for 20090435' do
|
47
|
+
Uni::codigo_uni(20090435).should eql '20090435F'
|
48
|
+
end
|
17
49
|
end
|
50
|
+
|
18
51
|
end
|
19
52
|
describe '#fast_Uni' do
|
20
|
-
before(:all)
|
21
|
-
Uni.initialize
|
22
|
-
end
|
53
|
+
before(:all) { Uni.initialize }
|
23
54
|
|
24
|
-
it
|
25
|
-
Uni
|
26
|
-
end
|
27
|
-
it "returns 20072531G for 20072531" do
|
28
|
-
Uni::fast_uni(20072531).should eql "20072531G"
|
55
|
+
it 'initialize memory' do
|
56
|
+
Uni.initialize.should eql 'memoria inicializada'
|
29
57
|
end
|
30
|
-
|
31
|
-
|
58
|
+
|
59
|
+
context 'param is String' do
|
60
|
+
it 'returns a String' do
|
61
|
+
Uni::fast_uni('20072531').should be_an_instance_of String
|
62
|
+
end
|
63
|
+
it 'returns "20072531G" for 20072531' do
|
64
|
+
Uni::fast_uni('20072531').should eql '20072531G'
|
65
|
+
end
|
66
|
+
it 'returns "19100003B" for 19100003' do
|
67
|
+
Uni::fast_uni('19100003').should eql '19100003B'
|
68
|
+
end
|
69
|
+
it 'returns "20090435F" for 20090435' do
|
70
|
+
Uni::fast_uni('20090435').should eql '20090435F'
|
71
|
+
end
|
32
72
|
end
|
33
|
-
|
34
|
-
|
73
|
+
|
74
|
+
context 'param is Fixnum' do
|
75
|
+
it 'returns a String' do
|
76
|
+
Uni::fast_uni(20072531).should be_an_instance_of String
|
77
|
+
end
|
78
|
+
it 'returns "20072531G" for 20072531' do
|
79
|
+
Uni::fast_uni(20072531).should eql '20072531G'
|
80
|
+
end
|
81
|
+
it 'returns "19100003B" for 19100003' do
|
82
|
+
Uni::fast_uni(19100003).should eql '19100003B'
|
83
|
+
end
|
84
|
+
it 'returns "20090435F" for 20090435' do
|
85
|
+
Uni::fast_uni(20090435).should eql '20090435F'
|
86
|
+
end
|
35
87
|
end
|
88
|
+
|
36
89
|
end
|
37
90
|
describe '#data' do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
91
|
+
let(:regular) { Uni::data '20072531G' }
|
92
|
+
let(:titulado) { Uni::data '19100003B' }
|
93
|
+
let(:egresado) { Uni::data '19780540K' }
|
94
|
+
let(:invalido) { Uni::data '20072531a' }
|
95
|
+
let(:fixnum) { Uni.data 20072531 }
|
96
|
+
let(:inv_fixnum) { Uni.data 2007253 }
|
44
97
|
|
45
|
-
it
|
46
|
-
|
47
|
-
end
|
48
|
-
it "returns an empty Hash if codigo invalid" do
|
49
|
-
@invalid.should eql Hash.new
|
98
|
+
it 'returns a Hash' do
|
99
|
+
regular.should be_an_instance_of Hash
|
50
100
|
end
|
51
|
-
it
|
52
|
-
|
101
|
+
it 'returns an empty Hash if codigo is invalid' do
|
102
|
+
invalido.should eql Hash.new
|
103
|
+
inv_fixnum.should eql Hash.new
|
53
104
|
end
|
54
|
-
it
|
55
|
-
|
105
|
+
it 'works with param as Fixnum' do
|
106
|
+
fixnum[:nombre].should eql 'PANDO MORALES CARLOS ENRIQUE'
|
107
|
+
fixnum[:situacion].should eql 'ALUMNO REGULAR'
|
108
|
+
fixnum[:medida_disciplinaria].should eql 'NO TIENE'
|
56
109
|
end
|
57
|
-
it
|
58
|
-
|
110
|
+
it 'returns data for "20072531G"' do
|
111
|
+
regular[:nombre].should eql 'PANDO MORALES CARLOS ENRIQUE'
|
112
|
+
regular[:situacion].should eql 'ALUMNO REGULAR'
|
113
|
+
regular[:medida_disciplinaria].should eql 'NO TIENE'
|
59
114
|
end
|
60
|
-
|
61
|
-
|
62
|
-
|
115
|
+
it 'returns data for "19100003B"' do
|
116
|
+
titulado[:nombre].should eql 'ARIZOLA FRANCISCO P'
|
117
|
+
titulado[:situacion].should eql 'TITULADO'
|
118
|
+
titulado[:especialidad].should eql 'INGENIERÍA CIVIL'
|
63
119
|
end
|
64
|
-
it
|
65
|
-
|
66
|
-
end
|
67
|
-
it "returns 'INGENIERÍA CIVIL' for :especialidad of 19100003B" do
|
68
|
-
@titulado[:especialidad].should eql "INGENIERÍA CIVIL"
|
69
|
-
end
|
70
|
-
it "returns 1993 - 1 for :egreso of 19780540K" do
|
71
|
-
@egreso[:egreso].should eql "1993 - 1"
|
120
|
+
it 'returns "1993 - 1" for :egreso of "19780540K"' do
|
121
|
+
egresado[:egreso].should eql '1993 - 1'
|
72
122
|
end
|
73
123
|
end
|
74
124
|
describe '#notas' do
|
75
|
-
|
76
|
-
|
125
|
+
xit 'returns an instance of Array' do
|
126
|
+
[].should be_an_instance_of Array
|
77
127
|
end
|
128
|
+
xit 'returns an empty Array for invalid codigo and/or password'
|
129
|
+
xit 'works with codigo as Fixnum or String'
|
130
|
+
|
131
|
+
context 'every element of Array' do
|
132
|
+
xit 'should be an instance of Hash'
|
133
|
+
xit 'should have the keys :curso, :codigo, :seccion, :notas'
|
134
|
+
xit 'should have an instance of String as value for :curso, :codigo, :seccion'
|
135
|
+
xit 'should have an instance of Hash as value for :notas'
|
136
|
+
context ':notas' do
|
137
|
+
xit 'contains :practicas and :examenes'
|
138
|
+
context ':practicas and :examenes' do
|
139
|
+
xit 'contains an instance of Array'
|
140
|
+
xit 'contains Strings as elements'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
78
145
|
end
|
79
146
|
end
|
data/uni.gemspec
CHANGED
@@ -4,24 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'uni/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'uni'
|
8
8
|
spec.version = Uni::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Carlos Pando Morales']
|
10
|
+
spec.email = ['cxrlospxndo@gmail.com']
|
11
11
|
spec.summary = %q{Libreria en Ruby para obtener informacion basica de la Orce-Uni}
|
12
|
-
spec.description = %q{
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
12
|
+
spec.description = %q{Simple interface de la orce, para consultar informacion publica y privada de un alumno}
|
13
|
+
spec.homepage = 'http://cxrlospxndo.github.io/uni/'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.add_runtime_dependency
|
17
|
-
spec.add_runtime_dependency
|
16
|
+
spec.add_runtime_dependency 'mechanize'
|
17
|
+
spec.add_runtime_dependency 'nokogiri'
|
18
18
|
|
19
|
-
spec.add_development_dependency
|
20
|
-
spec.add_development_dependency
|
21
|
-
spec.add_development_dependency
|
19
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
20
|
+
spec.add_development_dependency 'rake'
|
21
|
+
spec.add_development_dependency 'rspec'
|
22
22
|
|
23
23
|
spec.files = `git ls-files`.split($/)
|
24
24
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
25
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
|
-
spec.require_paths = [
|
26
|
+
spec.require_paths = ['lib']
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Carlos Pando
|
7
|
+
- Carlos Pando Morales
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
83
|
+
description: Simple interface de la orce, para consultar informacion publica y privada
|
84
84
|
de un alumno
|
85
85
|
email:
|
86
86
|
- cxrlospxndo@gmail.com
|
@@ -94,13 +94,14 @@ files:
|
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
96
|
- lib/uni.rb
|
97
|
+
- lib/uni/params.rb
|
97
98
|
- lib/uni/private_info.rb
|
98
99
|
- lib/uni/public_info.rb
|
99
100
|
- lib/uni/version.rb
|
100
101
|
- spec/lib/uni_spec.rb
|
101
102
|
- spec/spec_helper.rb
|
102
103
|
- uni.gemspec
|
103
|
-
homepage:
|
104
|
+
homepage: http://cxrlospxndo.github.io/uni/
|
104
105
|
licenses:
|
105
106
|
- MIT
|
106
107
|
metadata: {}
|