module CnpqWs::CurriculoLattes
Public Instance Methods
participacoes_em_projetos()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 12 def participacoes_em_projetos participacoes_em_projetos = [] participacoes_em_projetos_hash.each do |pp| participacoes_em_projetos << ParticipacaoProjeto.new( sequencia_funcao_atividade: pp["SEQUENCIA_FUNCAO_ATIVIDADE"], flag_periodo: pp["FLAG_PERIODO"], mes_inicio: pp["MES_INICIO"], ano_inicio: pp["ANO_INICIO"], mes_fim: pp["MES_FIM"], ano_fim: pp["ANO_FIM"], codigo_orgao: pp["CODIGO_ORGAO"], nome_orgao: pp["NOME_ORGAO"], codigo_unidade: pp["CODIGO_UNIDADE"], nome_unidade: pp["NOME_UNIDADE"], projeto_de_pesquisa: pp["PROJETO_DE_PESQUISA"] ) end participacoes_em_projetos end
projetos_de_pesquisa()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 8 def projetos_de_pesquisa self.participacoes_em_projetos.map {|pp| pp.projetos_de_pesquisa}.flatten end
Private Instance Methods
curriculo_lattes_hash()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 110 def curriculo_lattes_hash File.open("#{get_identificador_cn_pq}.zip", 'wb') {|f| f.write(Base64.decode64(get_curriculo_compactado))} xml_to_hash = nil Zip::File.open("#{get_identificador_cn_pq}.zip") do |zipfile| zipfile.each do |entry| xml_to_hash = Hash.from_xml(zipfile.read(entry)) end end File.delete("#{get_identificador_cn_pq}.zip") xml_to_hash end
get_curriculo_compactado()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 34 def get_curriculo_compactado client = Savon.client(endpoint: CnpqWs.curriculo_end_point, wsdl: CnpqWs.curriculo_wsdl, ssl_verify_mode: :none) begin response = client.call(:get_curriculo_compactado, message: {id: get_identificador_cn_pq}) response.body[:get_curriculo_compactado_response][:return] rescue Exception => e return e end end
get_curriculo_compactado_por_usuario()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 44 def get_curriculo_compactado_por_usuario client = Savon.client(endpoint: CnpqWs.curriculo_end_point, wsdl: CnpqWs.curriculo_wsdl, ssl_verify_mode: :none) begin client.call(:get_curriculo_compactado_por_usuario, message: {id: get_identificador_cn_pq, login: CnpqWs.cnpq_login}) rescue Exception => e return e end end
get_data_atualizacao_cv()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 53 def get_data_atualizacao_cv #to do end
get_data_atualizacao_cv_por_usuario()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 57 def get_data_atualizacao_cv_por_usuario end
get_identificador_cn_pq()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 60 def get_identificador_cn_pq unless self.cnpq_id client = Savon.client(endpoint: CnpqWs.curriculo_end_point, wsdl: CnpqWs.curriculo_wsdl, ssl_verify_mode: :none) begin response = client.call(:get_identificador_cn_pq, message: {cpf: self.login, nomeCompleto: self.name, dataNascimento: self.birth_date}) response.body[:get_identificador_cn_pq_response][:return] rescue Exception => e return e end else self.cnpq_id end end
get_identificador_cn_pq_por_usuario()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 74 def get_identificador_cn_pq_por_usuario #to do end
get_ocorrencia_cv()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 78 def get_ocorrencia_cv #to do end
get_ocorrencia_cv_por_usuario()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 82 def get_ocorrencia_cv_por_usuario #to do end
participacoes_em_projetos_hash()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 96 def participacoes_em_projetos_hash project_activities.map{|pa| pa["PARTICIPACAO_EM_PROJETO"]}.flatten end
project_activities()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 100 def project_activities project_activities = [] curriculo_lattes_hash["CURRICULO_VITAE"]["DADOS_GERAIS"].fetch("ATUACOES_PROFISSIONAIS", {}).fetch("ATUACAO_PROFISSIONAL", {}).each do |ap| unless ap["ATIVIDADES_DE_PARTICIPACAO_EM_PROJETO"].nil? project_activities << ap["ATIVIDADES_DE_PARTICIPACAO_EM_PROJETO"] end end project_activities end
projetos_de_pesquisa_hash()
click to toggle source
# File lib/cnpq_ws/curriculo_lattes.rb, line 86 def projetos_de_pesquisa_hash projects = [] project_activities.each do |p| p["PARTICIPACAO_EM_PROJETO"].each do |pp| projects << pp["PROJETO_DE_PESQUISA"] end end projects.flatten end