Class: Iesde::Model::Matricula
- Inherits:
-
Object
- Object
- Iesde::Model::Matricula
- Includes:
- Stringable
- Defined in:
- lib/iesde/model/matricula.rb
Instance Attribute Summary collapse
-
#aluno ⇒ Object
Returns the value of attribute aluno.
-
#cpf ⇒ Object
Returns the value of attribute cpf.
-
#curso ⇒ Object
Returns the value of attribute curso.
-
#curso_id ⇒ Object
Returns the value of attribute curso_id.
-
#dt_cadastro ⇒ Object
Returns the value of attribute dt_cadastro.
-
#email ⇒ Object
Returns the value of attribute email.
-
#login_id ⇒ Object
Returns the value of attribute login_id.
-
#matricula_id ⇒ Object
Returns the value of attribute matricula_id.
-
#polo_id ⇒ Object
Returns the value of attribute polo_id.
-
#sexo ⇒ Object
Returns the value of attribute sexo.
-
#situacao ⇒ Object
Returns the value of attribute situacao.
-
#situacao_descricao ⇒ Object
Returns the value of attribute situacao_descricao.
Class Method Summary collapse
- .alterar_status(params) ⇒ Object
- .buscar(config = {}) ⇒ Object
- .criar(params = {}) ⇒ Object
- .criar_com_campos_obrigatorios(curso_id, nome, cpf, email, cep, numero, opts = {}) ⇒ Object
Instance Method Summary collapse
- #ativar!(opts = {}) ⇒ Object
- #inativar!(opts = {}) ⇒ Object
-
#initialize(*args) ⇒ Matricula
constructor
A new instance of Matricula.
Methods included from Stringable
Constructor Details
#initialize(*args) ⇒ Matricula
Returns a new instance of Matricula.
8 9 10 |
# File 'lib/iesde/model/matricula.rb', line 8 def initialize(*args) @matricula_id, @login_id, @situacao, @dt_cadastro, @curso_id, @polo_id, @curso, @aluno, @cpf, @email, @situacao_descricao, @sexo = args end |
Instance Attribute Details
#aluno ⇒ Object
Returns the value of attribute aluno.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def aluno @aluno end |
#cpf ⇒ Object
Returns the value of attribute cpf.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def cpf @cpf end |
#curso ⇒ Object
Returns the value of attribute curso.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def curso @curso end |
#curso_id ⇒ Object
Returns the value of attribute curso_id.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def curso_id @curso_id end |
#dt_cadastro ⇒ Object
Returns the value of attribute dt_cadastro.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def dt_cadastro @dt_cadastro end |
#email ⇒ Object
Returns the value of attribute email.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def email @email end |
#login_id ⇒ Object
Returns the value of attribute login_id.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def login_id @login_id end |
#matricula_id ⇒ Object
Returns the value of attribute matricula_id.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def matricula_id @matricula_id end |
#polo_id ⇒ Object
Returns the value of attribute polo_id.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def polo_id @polo_id end |
#sexo ⇒ Object
Returns the value of attribute sexo.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def sexo @sexo end |
#situacao ⇒ Object
Returns the value of attribute situacao.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def situacao @situacao end |
#situacao_descricao ⇒ Object
Returns the value of attribute situacao_descricao.
6 7 8 |
# File 'lib/iesde/model/matricula.rb', line 6 def situacao_descricao @situacao_descricao end |
Class Method Details
.alterar_status(params) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/iesde/model/matricula.rb', line 43 def self.alterar_status(params) api = Iesde::Api::AlterarStatusMatricula.new(:json, params) if api.salvo_com_sucesso? api.msg else raise Iesde::Error::WSError.new(api.msg) end end |
.buscar(config = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/iesde/model/matricula.rb', line 12 def self.buscar(config = {}) matriculas_obtidas = Iesde::Api::ObterMatricula.new(:json, config) matriculas_obtidas.underscorize_fields(Matricula) end |
.criar(params = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/iesde/model/matricula.rb', line 18 def self.criar(params = {}) matricula = Iesde::Api::CriarMatricula.new(:json, params) if matricula.salvo_com_sucesso? Iesde::Model::Matricula.buscar(params).select do |mat| mat.matricula_id.to_s == matricula.matricula_id_do_retorno.to_s end.first else raise Iesde::Error::WSError.new(matricula.msg) end end |
.criar_com_campos_obrigatorios(curso_id, nome, cpf, email, cep, numero, opts = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/iesde/model/matricula.rb', line 30 def self.criar_com_campos_obrigatorios(curso_id, nome, cpf, email, cep, numero, opts = {}) self.criar( { 'CursoID' => curso_id, 'Nome' => nome, 'CPF' => cpf, 'Email' => email, 'CEP' => cep, 'Numero' => numero }.merge(opts) ) end |
Instance Method Details
#ativar!(opts = {}) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/iesde/model/matricula.rb', line 53 def ativar!(opts = {}) Iesde::Model::Matricula.alterar_status({ 'MatriculaID' => self.matricula_id, 'Situacao' => 'A' }.merge(opts)) end |
#inativar!(opts = {}) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/iesde/model/matricula.rb', line 60 def inativar!(opts = {}) Iesde::Model::Matricula.alterar_status({ 'MatriculaID' => self.matricula_id, 'Situacao' => 'I' }.merge(opts)) end |