uni 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWU1YzllMWY2MGIyZGMxM2ExODc5M2Y4MGQzNjVlMTRlODYyMzM5Zg==
4
+ YTViOTAyZWE2OGFhMjAzMWM3NTcyYmY4NjI0ZjRiMDdkZmI0MTgyOA==
5
5
  data.tar.gz: !binary |-
6
- NDg3OGQ3ZGYzMTkxOTI4ZDk0YmM1YjI5ZDUxNzFlNDhiMmE1MWM1Mg==
6
+ ZjYwOTcwZTFkZmEzZTVmZjRjMGI5MTg4NzlmNTBiYzFlMGZlNmYwMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmEwODFiNWNiNjczMjY1OWZjMDQ0NTU1MTI3Y2E3YjllOTY0M2JmMTUzY2E1
10
- ZDA2NjAwODNjZGNlY2NlOGIzYThjMWJiMzZhYzQ0ZmE5NWQwM2VjZjJjMzMy
11
- ZTAyZWYwMTY5MzQ5YzBlODYwMDFiYTViZmVhZjQxYjk5Mzk2Mzc=
9
+ YWI5NzE3ODFiY2EwYWRkNTkwNjRiZTlmYzA0MjgzZjA2YzZjZTc4MjdiYzRi
10
+ NzQyNGU3NTM5ZTM3ZTgzYWQ5ODFkZjZiZjljYzRjM2NmZWUyN2E5NWViYWRh
11
+ OTIzZGE2ZGJiN2Y5NGY0ZjQ4MzcwMDZhZGJjMDY4NzQxY2M4ZWY=
12
12
  data.tar.gz: !binary |-
13
- YmNjYjIxZDhhOTg5YmUwNGIwYTE1YTI1NDZjNmZjMWNkZTQ0OTQxZjg1YjMy
14
- NTBmN2MxMGUzMTk0MzA0MWI0MTA5OTIyNzQ2N2FmZjdlZTlhNTZmZDYzYjMz
15
- YThjMzU4ZDI5MWVlYzVjNTdmMmRmZGZmYTEyZWE4ZTk5ZjgzMmQ=
13
+ YjRhZWU3YmRlYzUwYzFkYzVjYjUzN2JiNmQ4NGZlODM0ZmU3Yjc5ZmIxY2E2
14
+ ODJhZDliOWVmNjQ3ZjA0NmMyYTc4MmNjY2E5ODAwMWJhNmQ5M2EyMjAwZTdh
15
+ N2Y0YjQyM2Y4MTI2NzI3NWMxYjVkNGY5ZGVjY2IzNmY3NTgwMmM=
data/README.md CHANGED
@@ -1,29 +1,32 @@
1
- # Uni
1
+ Simple interface de la [Orce](http://www.orce.uni.edu.pe/).
2
+ Permite visualizar informacion publica, validar codigo, obtener la letra del mismo y consultar notas (password requerido)
2
3
 
3
- TODO: Write a gem description
4
+ Instalacion
4
5
 
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'uni'
6
+ ```bash
7
+ $ gem install uni
8
+ ```
10
9
 
11
- And then execute:
10
+ ## Ejemplos de uso:
12
11
 
13
- $ bundle
12
+ ### Obtener la letra del codigo:
14
13
 
15
- Or install it yourself as:
14
+ ```ruby
15
+ Uni::codigo_uni 19741084 # => "19741084H"
16
+ ```
17
+ De ser necesario un calculo de la letra mas rapido, usar fast_uni, pero antes se debe invocar a initialize en la constante 'Uni'
16
18
 
17
- $ gem install uni
19
+ ```ruby
20
+ Uni.initialize
21
+ Uni::fast_uni 19741084 # => "19741084H"
22
+ ```
18
23
 
19
- ## Usage
24
+ ### Consultar informacion basica:
20
25
 
21
- TODO: Write usage instructions here
26
+ ```ruby
27
+ Uni.data "19741084H" # => {:codigo=>"19741084H", :nombre=>"REYN...", :facultad=>"INGENIERÍA...", ..., :situacion=>"TITULADO"}
28
+ ```
22
29
 
23
- ## Contributing
30
+ * Sugerencias, dudas o problemas aqui en la repo o en su defecto a mi [email](mailto:cxrlospxndo@gmail.com).
31
+ * De momento lo mas cool que he hecho con esto es obtener esta info [2013-I](http://goo.gl/hqNKI)
24
32
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new('spec')
data/lib/uni.rb CHANGED
@@ -3,12 +3,29 @@ require "uni/public_info"
3
3
 
4
4
  module Uni
5
5
  class Amijo
6
+ # Ejemplo
7
+ # @return [String] mensaje
6
8
  def mister
7
- "It works!"
9
+ 'It works!'
8
10
  end
11
+ # Ejemplo de uso de #codigo_uni
12
+ # @return [String] codigo con su letra respectiva
9
13
  def step
10
14
  Uni::codigo_uni 20072531
11
15
  end
16
+ # Ejemplo de uso de #fast_uni y #data
17
+ # @return [Hash] informacion publica del alumno
18
+ def beep
19
+ Uni.initialize
20
+ codigo = Uni::fast_uni 20072531
21
+ data = Uni::data codigo
22
+ puts data
23
+ end
24
+
25
+ ## cursos y notas
26
+ #def top
27
+ # ...
28
+ #end
12
29
  end
13
30
  end
14
31
 
@@ -8,7 +8,7 @@ module Uni
8
8
  SITUACION = SITUACIONX + SITUACIONY
9
9
  @x, @y = {}, {}
10
10
  @base = Mechanize.new
11
- # Inicializa las constantes @x y @y
11
+ # Inicializa las constantes @x y @y, para el uso de #fast_uni
12
12
  def self.initialize
13
13
  (1900..2014).each do |n|
14
14
  tmp, v, ans = n, 2123, 0
@@ -27,19 +27,20 @@ module Uni
27
27
  tmp /= 10
28
28
  end
29
29
  @y[n] = ans
30
+ "Ahora puedes usar #fast_uni"
30
31
  end
31
32
  end
32
- # Obtiene letra de codigo (mas rapido que la implementacion #codigo_uni)
33
+ # Obtiene la letra del codigo (mas rapido que la implementacion #codigo_uni)
33
34
  # @see #codigo_uni
34
- # @param n [Fixnum] Un objeto Fixnum
35
- # @return [String] El codigo con su respectiva letra
35
+ # @param n [Fixnum] Un objeto Fixnum # 20072531
36
+ # @return [String] El codigo con su respectiva letra # 20072531G
36
37
  def self.fast_uni n
37
38
  n.to_s + (65 + (@x[n/10000] + @y[n%10000])%11).chr
38
39
  end
39
40
  # Obtiene letra de codigo
40
41
  # @see #fast_uni
41
- # @param n [Fixnum] Un objeto Fixnum
42
- # @return [String] El codigo con su respectiva letra
42
+ # @param n [Fixnum] Un objeto Fixnum # 20072531
43
+ # @return [String] El codigo con su respectiva letra # 20072531G
43
44
  def self.codigo_uni n
44
45
  codigo = n.to_s
45
46
  v, ans = 21234567, 0
@@ -50,8 +51,8 @@ module Uni
50
51
  end
51
52
  codigo + (65 + ans%11).chr
52
53
  end
53
- # Obtiene informacion publica de un alumno
54
- # @param codigo [String] Un objeto String, que representa el codigo de un estudiante
54
+ # Obtiene informacion publica de un alumno # faculta, especialidad, pic:url, ciclo_relativo, etc
55
+ # @param codigo [String] Un objeto String, que representa el codigo de un estudiante # 20072531G
55
56
  # @return [Hash] Informacion publica obtenida de la Orce
56
57
 
57
58
  def self.data codigo
@@ -1,3 +1,3 @@
1
1
  module Uni
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,74 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ describe 'Uni' do
4
+
5
+ describe '#codigo_Uni' do
6
+ it "returns a String" do
7
+ Uni::codigo_uni(20072531).should be_an_instance_of String
8
+ end
9
+ it "returns 20072531G for 20072531" do
10
+ Uni::codigo_uni(20072531).should eql "20072531G"
11
+ end
12
+ it "returns 19100003B for 19100003" do
13
+ Uni::codigo_uni(19100003).should eql "19100003B"
14
+ end
15
+ it "returns 20090435F for 20090435" do
16
+ Uni::codigo_uni(20090435).should eql "20090435F"
17
+ end
18
+ end
19
+ describe '#fast_Uni' do
20
+ before(:all) do
21
+ Uni.initialize
22
+ end
23
+
24
+ it "returns a String" do
25
+ Uni::fast_uni(20072531).should be_an_instance_of String
26
+ end
27
+ it "returns 20072531G for 20072531" do
28
+ Uni::fast_uni(20072531).should eql "20072531G"
29
+ end
30
+ it "returns 19100003B for 19100003" do
31
+ Uni::fast_uni(19100003).should eql "19100003B"
32
+ end
33
+ it "returns 20090435F for 20090435" do
34
+ Uni::fast_uni(20090435).should eql "20090435F"
35
+ end
36
+ end
37
+ describe '#data' do
38
+ before(:all) do
39
+ @Uni = Uni::data "20072531G"
40
+ @titulado = Uni::data "19100003B"
41
+ @egreso = Uni::data "19780540K"
42
+ @invalid = Uni::data "20072531A"
43
+ end
44
+
45
+ it "returns a Hash if codigo valid" do
46
+ @Uni.should be_an_instance_of Hash
47
+ end
48
+ it "returns an empty Hash if codigo invalid" do
49
+ @invalid.should eql Hash.new
50
+ end
51
+ it "returns 'PANDO MORALES CARLOS ENRIQUE' for :nombre of 20072531G" do
52
+ @Uni[:nombre].should eql "PANDO MORALES CARLOS ENRIQUE"
53
+ end
54
+ it "returns 'ALUMNO REGULAR' for :situacion of 20072531G" do
55
+ @Uni[:situacion].should eql "ALUMNO REGULAR"
56
+ end
57
+ it "returns 'NO TIENE' for :medida_disciplinaria of 20072531G" do
58
+ @Uni[:medida_disciplinaria].should eql "NO TIENE"
59
+ end
60
+
61
+ it "returns 'ARIZOLA FRANCISCO P' for :nombre of 19100003B" do
62
+ @titulado[:nombre].should eql "ARIZOLA FRANCISCO P"
63
+ end
64
+ it "returns 'TITULADO' for :situacion of 19100003B" do
65
+ @titulado[:situacion].should eql "TITULADO"
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"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,12 @@
1
+ require "bundler/setup"
2
+ require 'rspec'
3
+ require "uni"
4
+
5
+ #UNI::initialize
6
+
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ config.order = 'random'
12
+ end
@@ -9,17 +9,19 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Carlos Pando"]
10
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{Permite consultar informacion publica(nombre, facultad, foto, etc) y privada(cursos y notas) de un alumno}
13
- # spec.homepage = ""
12
+ spec.description = %q{Simpe interface de la orce, para consultar informacion publica y privada de un alumno}
13
+ spec.homepage = "https://github.com/cxrlospxndo/uni"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.add_runtime_dependency "mechanize"
17
17
  spec.add_runtime_dependency "nokogiri"
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.3"
20
+ spec.add_development_dependency "rake"
21
+ spec.add_development_dependency "rspec"
22
+
18
23
  spec.files = `git ls-files`.split($/)
19
24
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
25
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
26
  spec.require_paths = ["lib"]
22
-
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
25
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Pando
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-22 00:00:00.000000000 Z
11
+ date: 2013-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -66,8 +66,22 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: Permite consultar informacion publica(nombre, facultad, foto, etc) y
70
- privada(cursos y notas) de un alumno
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Simpe interface de la orce, para consultar informacion publica y privada
84
+ de un alumno
71
85
  email:
72
86
  - cxrlospxndo@gmail.com
73
87
  executables: []
@@ -82,8 +96,10 @@ files:
82
96
  - lib/uni.rb
83
97
  - lib/uni/public_info.rb
84
98
  - lib/uni/version.rb
99
+ - spec/lib/uni_spec.rb
100
+ - spec/spec_helper.rb
85
101
  - uni.gemspec
86
- homepage:
102
+ homepage: https://github.com/cxrlospxndo/uni
87
103
  licenses:
88
104
  - MIT
89
105
  metadata: {}
@@ -107,5 +123,7 @@ rubygems_version: 2.0.3
107
123
  signing_key:
108
124
  specification_version: 4
109
125
  summary: Libreria en Ruby para obtener informacion basica de la Orce-Uni
110
- test_files: []
126
+ test_files:
127
+ - spec/lib/uni_spec.rb
128
+ - spec/spec_helper.rb
111
129
  has_rdoc: