lattes_api 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 731e270623e619d140702afc97f358d44d40f982
4
+ data.tar.gz: 071faf1b7d68e71cc52e833f1b7b0851a72e572d
5
+ SHA512:
6
+ metadata.gz: 7af734e24f360a809d8db309161f6803ea50bc8238a0c45af04dc61f6536cb3c40d53cd0bc26b378ba403a595972af0f947e8088555879a405b3a9c851f20859
7
+ data.tar.gz: 6cb9e88b8082d199274aad6f042ad3cf267b637e3de64f4fd1d8728bcb0f0a898a0d43a17eba2e13927dda6d551265262ff3d49bf8b75c7d401e7963b369edc0
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lattes_api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Rodrigo Manhães
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # LattesApi
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'lattes_api'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install lattes_api
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/lattes_api/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,27 @@
1
+ #encoding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lattes_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lattes_api"
8
+ spec.version = LattesApi::VERSION
9
+ spec.authors = ["Rodrigo Manhaes"]
10
+ spec.email = ["rmanhaes@gmail.com"]
11
+ spec.summary = %q{Lattes API client for Ruby.}
12
+ spec.description = %q{Lattes API client for Ruby.}
13
+ spec.homepage = "https://github.com/nsi-iff/lattes_api"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "savon"
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "webmock"
26
+ spec.add_development_dependency "pry-rails"
27
+ end
data/lib/lattes_api.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "lattes_api/version"
2
+
3
+ module LattesApi
4
+ autoload :Api, 'lattes_api/api'
5
+ autoload :AccessDenied, 'lattes_api/access_denied'
6
+ end
@@ -0,0 +1,4 @@
1
+ module LattesApi
2
+ class AccessDenied < Exception
3
+ end
4
+ end
@@ -0,0 +1,38 @@
1
+ require 'savon'
2
+
3
+ module LattesApi
4
+ class Api
5
+ def initialize
6
+ @client = Savon.client(wsdl: wsdl, endpoint: endpoint)
7
+ end
8
+
9
+ def get_identificador_cnpq(cpf)
10
+ response = @client.call(:get_identificador_cn_pq, message: { cpf: cpf,
11
+ nomeCompleto: nil, dataNascimento: nil })
12
+ result = response.body[:get_identificador_cn_pq_response][:return]
13
+ fail_or_return result
14
+ end
15
+
16
+ def get_curriculo_compactado(id_cnpq)
17
+ response = @client.call(
18
+ :get_curriculo_compactado, message: { id: id_cnpq })
19
+ result = response.body[:get_curriculo_compactado_response][:return]
20
+ fail_or_return result
21
+ end
22
+
23
+ private
24
+
25
+ def fail_or_return(result)
26
+ raise LattesApi::AccessDenied if result =~ /Servi.+o negado\.IP/
27
+ result
28
+ end
29
+
30
+ def endpoint
31
+ 'http://servicosweb.cnpq.br/srvcurriculo/WSCurriculo'
32
+ end
33
+
34
+ def wsdl
35
+ "#{endpoint}?wsdl"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module LattesApi
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe LattesApi do
4
+ before(:all) { savon.mock! }
5
+ after(:all) { savon.unmock! }
6
+
7
+ let(:id_cnpq) { '1234567890123456' }
8
+ let(:cpf) { '123.456.789-09' }
9
+
10
+ let(:client) { LattesApi::Api.new }
11
+
12
+ describe 'getIdentificadorCNPq(cpf)' do
13
+ let(:message) do
14
+ { cpf: cpf, nomeCompleto: nil, dataNascimento: nil }
15
+ end
16
+
17
+ it 'happy path' do
18
+ savon.expects(:get_identificador_cn_pq).with(message: message).returns(
19
+ response(:get_identificador_cnpq, id_cnpq))
20
+ expect(client.get_identificador_cnpq(cpf)).to eq id_cnpq
21
+ end
22
+
23
+ it 'access denied' do
24
+ savon.expects(:get_identificador_cn_pq).
25
+ with(message: message).
26
+ returns(access_denied('getIdentificadorCNPq'))
27
+ expect {
28
+ client.get_identificador_cnpq(cpf)
29
+ }.to raise_error LattesApi::AccessDenied
30
+ end
31
+ end
32
+
33
+ describe 'getCurriculoCompactado(id)' do
34
+ let(:message) { { id: id_cnpq } }
35
+
36
+ it 'happy path' do
37
+ result = encodeFile(id_cnpq)
38
+ savon.expects(:get_curriculo_compactado).with(message: message).returns(
39
+ response(:get_curriculo_compactado, result))
40
+ expect(client.get_curriculo_compactado(id_cnpq)).to eq result
41
+ end
42
+
43
+ it 'access denied' do
44
+ savon.expects(:get_curriculo_compactado).
45
+ with(message: message).
46
+ returns(access_denied('getCurriculoCompactado'))
47
+ expect {
48
+ client.get_curriculo_compactado(id_cnpq)
49
+ }.to raise_error LattesApi::AccessDenied
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,200 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
+ <CURRICULO-VITAE
3
+ SISTEMA-ORIGEM-XML="LATTES_OFFLINE"
4
+ DATA-ATUALIZACAO="24032014"
5
+ HORA-ATUALIZACAO="171439"
6
+ NUMERO-IDENTIFICADOR="1234567890123456">
7
+ <DADOS-GERAIS
8
+ NOME-COMPLETO="Linus Torvalds"
9
+ NOME-EM-CITACOES-BIBLIOGRAFICAS="TORVALDS, L."
10
+ NACIONALIDADE="B"
11
+ CPF="12345678909"
12
+ PAIS-DE-NASCIMENTO="Brasil"
13
+ UF-NASCIMENTO="RJ"
14
+ CIDADE-NASCIMENTO="Campos dos Goytacazes"
15
+ DATA-NASCIMENTO="04021973"
16
+ SEXO="MASCULINO"
17
+ NUMERO-IDENTIDADE="123456789"
18
+ ORGAO-EMISSOR="IFP"
19
+ UF-ORGAO-EMISSOR="RJ"
20
+ DATA-DE-EMISSAO="05061991"
21
+ NUMERO-DO-PASSAPORTE=""
22
+ NOME-DO-PAI="Linus Torvalds Senior"
23
+ NOME-DA-MAE="Lina Torvalds"
24
+ PERMISSAO-DE-DIVULGACAO="NAO"
25
+ DATA-FALECIMENTO=""
26
+ RACA-OU-COR="Parda"
27
+ SIGLA-PAIS-NACIONALIDADE="BRA"
28
+ PAIS-DE-NACIONALIDADE="Brasil">
29
+ <RESUMO-CV
30
+ TEXTO-RESUMO-CV-RH="possui diversos cursos mundo afora."
31
+ TEXTO-RESUMO-CV-RH-EN="a lot of unuseful courses"/>
32
+ <OUTRAS-INFORMACOES-RELEVANTES OUTRAS-INFORMACOES-RELEVANTES="alguma coisa"/>
33
+ <FORMACAO-ACADEMICA-TITULACAO>
34
+ <ESPECIALIZACAO
35
+ SEQUENCIA-FORMACAO="4"
36
+ NIVEL="2"
37
+ TITULO-DA-MONOGRAFIA="Um Framework para Resolver um Problema que Acabei de Criar"
38
+ NOME-DO-ORIENTADOR="Johnny Rotten"
39
+ CODIGO-INSTITUICAO="123412341234"
40
+ NOME-INSTITUICAO="Instituto José das Couves"
41
+ CODIGO-CURSO="12341234"
42
+ NOME-CURSO="Desenvolvimento de Software Orientado a Objetos"
43
+ STATUS-DO-CURSO="CONCLUIDO"
44
+ ANO-DE-INICIO="2005"
45
+ ANO-DE-CONCLUSAO="2006"
46
+ FLAG-BOLSA="SIM"
47
+ CODIGO-AGENCIA-FINANCIADORA="09876543"
48
+ NOME-AGENCIA="FAPERJ"
49
+ CARGA-HORARIA="360"
50
+ TITULO-DA-MONOGRAFIA-INGLES="An Awesome Unuseful Framework"
51
+ NOME-CURSO-INGLES="Object-Oriented Software Development"/>
52
+ <ESPECIALIZACAO
53
+ SEQUENCIA-FORMACAO="5"
54
+ NIVEL="2"
55
+ TITULO-DA-MONOGRAFIA="Um Sistema Bacana"
56
+ NOME-DO-ORIENTADOR="Sistemeiro"
57
+ CODIGO-INSTITUICAO="123443211234"
58
+ NOME-INSTITUICAO="Escola Superior José das Couves"
59
+ CODIGO-CURSO="9876543"
60
+ NOME-CURSO="Engenharia de Programas"
61
+ STATUS-DO-CURSO="CONCLUIDO"
62
+ ANO-DE-INICIO="2010"
63
+ ANO-DE-CONCLUSAO="2010"
64
+ FLAG-BOLSA="NAO"
65
+ CODIGO-AGENCIA-FINANCIADORA=""
66
+ NOME-AGENCIA=""
67
+ CARGA-HORARIA="480"
68
+ TITULO-DA-MONOGRAFIA-INGLES="A Cool System"
69
+ NOME-CURSO-INGLES="Program Engineering"/>
70
+ <ESPECIALIZACAO
71
+ SEQUENCIA-FORMACAO="6"
72
+ NIVEL="2"
73
+ TITULO-DA-MONOGRAFIA="Outra coisa qualquer"
74
+ NOME-DO-ORIENTADOR="Sistemeiro"
75
+ CODIGO-INSTITUICAO="123443211234"
76
+ NOME-INSTITUICAO="Escola Superior José das Couves"
77
+ CODIGO-CURSO="9876543"
78
+ NOME-CURSO="Engenharia de Programas"
79
+ STATUS-DO-CURSO="CONCLUIDO"
80
+ ANO-DE-INICIO="2010"
81
+ ANO-DE-CONCLUSAO="2010"
82
+ FLAG-BOLSA="NAO"
83
+ CODIGO-AGENCIA-FINANCIADORA=""
84
+ NOME-AGENCIA=""
85
+ CARGA-HORARIA="480"
86
+ TITULO-DA-MONOGRAFIA-INGLES="A Cool System"
87
+ NOME-CURSO-INGLES="Program Engineering"/>
88
+ </FORMACAO-ACADEMICA-TITULACAO>
89
+ </DADOS-GERAIS>
90
+ <PRODUCAO-TECNICA>
91
+ <SOFTWARE SEQUENCIA-PRODUCAO="2">
92
+ <DADOS-BASICOS-DO-SOFTWARE
93
+ NATUREZA="COMPUTACIONAL"
94
+ TITULO-DO-SOFTWARE="Postgrow"
95
+ ANO="2005"
96
+ PAIS="Brasil"
97
+ IDIOMA=""
98
+ MEIO-DE-DIVULGACAO="NAO_INFORMADO"
99
+ HOME-PAGE-DO-TRABALHO="http://quintodosinferno.org"
100
+ FLAG-RELEVANCIA="SIM"
101
+ DOI=""
102
+ TITULO-DO-SOFTWARE-INGLES=""
103
+ FLAG-DIVULGACAO-CIENTIFICA="NAO"
104
+ FLAG-POTENCIAL-INOVACAO="NAO"/>
105
+ <DETALHAMENTO-DO-SOFTWARE
106
+ FINALIDADE="Awesome tool"
107
+ PLATAFORMA="Java, Multiplataforma"
108
+ AMBIENTE="Multiplataforma"
109
+ DISPONIBILIDADE="IRRESTRITA"
110
+ INSTITUICAO-FINANCIADORA=""
111
+ FINALIDADE-INGLES=""/>
112
+ <AUTORES
113
+ NOME-COMPLETO-DO-AUTOR="Topo Giggio"
114
+ NOME-PARA-CITACAO="GIGGIO, T."
115
+ ORDEM-DE-AUTORIA="2"
116
+ NRO-ID-CNPQ=""/>
117
+ <AUTORES
118
+ NOME-COMPLETO-DO-AUTOR="Jaspion Honda"
119
+ NOME-PARA-CITACAO="HONDA, J."
120
+ ORDEM-DE-AUTORIA="3"
121
+ NRO-ID-CNPQ=""/>
122
+ <AUTORES
123
+ NOME-COMPLETO-DO-AUTOR="Zezin La da Rua"
124
+ NOME-PARA-CITACAO="LA DA RUA, Z."
125
+ ORDEM-DE-AUTORIA="1"
126
+ NRO-ID-CNPQ="1234567890123456"/>
127
+ <PALAVRAS-CHAVE
128
+ PALAVRA-CHAVE-1="Software Factory"
129
+ PALAVRA-CHAVE-2="Extreme Modeling"
130
+ PALAVRA-CHAVE-3="Bureaucratic Process"
131
+ PALAVRA-CHAVE-4="Taylorist Development"
132
+ PALAVRA-CHAVE-5=""
133
+ PALAVRA-CHAVE-6=""/>
134
+ <AREAS-DO-CONHECIMENTO>
135
+ <AREA-DO-CONHECIMENTO-1
136
+ NOME-GRANDE-AREA-DO-CONHECIMENTO="CIENCIAS_EXATAS_E_DA_TERRA"
137
+ NOME-DA-AREA-DO-CONHECIMENTO="Ciência da Computação"
138
+ NOME-DA-SUB-AREA-DO-CONHECIMENTO=""
139
+ NOME-DA-ESPECIALIDADE=""/>
140
+ <AREA-DO-CONHECIMENTO-2
141
+ NOME-GRANDE-AREA-DO-CONHECIMENTO="CIENCIAS_EXATAS_E_DA_TERRA"
142
+ NOME-DA-AREA-DO-CONHECIMENTO="Ciência da Computação"
143
+ NOME-DA-SUB-AREA-DO-CONHECIMENTO="Metodologia e Técnicas da Computação"
144
+ NOME-DA-ESPECIALIDADE="Banco de Dados"/>
145
+ </AREAS-DO-CONHECIMENTO>
146
+ <INFORMACOES-ADICIONAIS
147
+ DESCRICAO-INFORMACOES-ADICIONAIS="Ferramenta para OLAP Espacial."
148
+ DESCRICAO-INFORMACOES-ADICIONAIS-INGLES=""/>
149
+ </SOFTWARE>
150
+ <SOFTWARE SEQUENCIA-PRODUCAO="3">
151
+ <DADOS-BASICOS-DO-SOFTWARE
152
+ NATUREZA="COMPUTACIONAL"
153
+ TITULO-DO-SOFTWARE="Sartapreuta"
154
+ ANO="2010"
155
+ PAIS="Brasil"
156
+ IDIOMA=""
157
+ MEIO-DE-DIVULGACAO="NAO_INFORMADO"
158
+ HOME-PAGE-DO-TRABALHO=""
159
+ FLAG-RELEVANCIA="NAO"
160
+ DOI=""
161
+ TITULO-DO-SOFTWARE-INGLES=""
162
+ FLAG-DIVULGACAO-CIENTIFICA="NAO"
163
+ FLAG-POTENCIAL-INOVACAO="NAO"/>
164
+ <DETALHAMENTO-DO-SOFTWARE
165
+ FINALIDADE=""
166
+ PLATAFORMA="Multiplataforma"
167
+ AMBIENTE="Java"
168
+ DISPONIBILIDADE="RESTRITA"
169
+ INSTITUICAO-FINANCIADORA=""
170
+ FINALIDADE-INGLES=""/>
171
+ <AUTORES
172
+ NOME-COMPLETO-DO-AUTOR="Jece Valadão"
173
+ NOME-PARA-CITACAO="VALADAO, J."
174
+ ORDEM-DE-AUTORIA="2"
175
+ NRO-ID-CNPQ=""/>
176
+ <AUTORES
177
+ NOME-COMPLETO-DO-AUTOR="Sergio Mallandro"
178
+ NOME-PARA-CITACAO="MALLANDRO, S."
179
+ ORDEM-DE-AUTORIA="1"
180
+ NRO-ID-CNPQ=""/>
181
+ <PALAVRAS-CHAVE
182
+ PALAVRA-CHAVE-1="Java"
183
+ PALAVRA-CHAVE-2="Aplicações desktop"
184
+ PALAVRA-CHAVE-3="Framework MVC"
185
+ PALAVRA-CHAVE-4="J2EE"
186
+ PALAVRA-CHAVE-5=""
187
+ PALAVRA-CHAVE-6=""/>
188
+ <AREAS-DO-CONHECIMENTO>
189
+ <AREA-DO-CONHECIMENTO-1 NOME-GRANDE-AREA-DO-CONHECIMENTO="CIENCIAS_EXATAS_E_DA_TERRA" NOME-DA-AREA-DO-CONHECIMENTO="Ciência da Computação" NOME-DA-SUB-AREA-DO-CONHECIMENTO="Sistemas de Computação" NOME-DA-ESPECIALIDADE="Arquitetura de Sistemas de Computação"/>
190
+ </AREAS-DO-CONHECIMENTO>
191
+ <SETORES-DE-ATIVIDADE
192
+ SETOR-DE-ATIVIDADE-1="Desenvolvimento de Programas (Software)"
193
+ SETOR-DE-ATIVIDADE-2=""
194
+ SETOR-DE-ATIVIDADE-3=""/>
195
+ <INFORMACOES-ADICIONAIS
196
+ DESCRICAO-INFORMACOES-ADICIONAIS=""
197
+ DESCRICAO-INFORMACOES-ADICIONAIS-INGLES=""/>
198
+ </SOFTWARE>
199
+ </PRODUCAO-TECNICA>
200
+ </CURRICULO-VITAE>
Binary file
@@ -0,0 +1,9 @@
1
+ <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
2
+ <env:Header>
3
+ </env:Header>
4
+ <env:Body>
5
+ <tns:$$value$$Response xmlns:tns='http://ws.servico.repositorio.cnpq.br/'>
6
+ <return>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;&lt;MENSAGEM&gt;&lt;ERRO&gt;Servi\xC3\xA7o negado.IP:111.111.111.111.&lt;/ERRO&gt;&lt;/MENSAGEM&gt;</return>
7
+ </tns:$$value$$Response>
8
+ </env:Body>
9
+ </env:Envelope>
@@ -0,0 +1,9 @@
1
+ <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
2
+ <env:Header>
3
+ </env:Header>
4
+ <env:Body>
5
+ <tns:getCurriculoCompactadoResponse xmlns:tns='http://ws.servico.repositorio.cnpq.br/'>
6
+ <return>$$value$$</return>
7
+ </tns:getCurriculoCompactadoResponse>
8
+ </env:Body>
9
+ </env:Envelope>
@@ -0,0 +1,9 @@
1
+ <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
2
+ <env:Header>
3
+ </env:Header>
4
+ <env:Body>
5
+ <tns:getIdentificadorCNPqResponse xmlns:tns='http://ws.servico.repositorio.cnpq.br/'>
6
+ <return>$$value$$</return>
7
+ </tns:getIdentificadorCNPqResponse>
8
+ </env:Body>
9
+ </env:Envelope>
@@ -0,0 +1,8 @@
1
+ require './lib/lattes_api'
2
+
3
+ Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each do |f|
4
+ require f
5
+ end
6
+
7
+ RSpec.configure do |config|
8
+ end
@@ -0,0 +1,6 @@
1
+ require 'savon'
2
+ require "savon/mock/spec_helper"
3
+
4
+ RSpec.configure do |config|
5
+ config.include Savon::SpecHelper
6
+ end
@@ -0,0 +1,20 @@
1
+ require 'base64'
2
+
3
+ module LattesApi::Template
4
+ def response(operation, return_value)
5
+ content = File.read("spec/resources/#{operation}_template.xml")
6
+ content['$$value$$'] = return_value
7
+ content
8
+ end
9
+
10
+ def encodeFile(return_value)
11
+ Base64.encode64(File.open(
12
+ "spec/resources/#{return_value}_test.zip", 'rb') { |io| io.read })
13
+ end
14
+
15
+ def access_denied(operation)
16
+ File.read('spec/resources/access_denied.xml').gsub('$$value$$', operation)
17
+ end
18
+ end
19
+
20
+ RSpec.configure {|config| config.include LattesApi::Template }
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lattes_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rodrigo Manhaes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: savon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
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
+ - !ruby/object:Gem::Dependency
84
+ name: pry-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Lattes API client for Ruby.
98
+ email:
99
+ - rmanhaes@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - lattes_api.gemspec
110
+ - lib/lattes_api.rb
111
+ - lib/lattes_api/access_denied.rb
112
+ - lib/lattes_api/api.rb
113
+ - lib/lattes_api/version.rb
114
+ - spec/lattes_spec.rb
115
+ - spec/resources/1234567890123456.xml
116
+ - spec/resources/1234567890123456.zip
117
+ - spec/resources/1234567890123456_test.zip
118
+ - spec/resources/access_denied.xml
119
+ - spec/resources/get_curriculo_compactado_template.xml
120
+ - spec/resources/get_identificador_cnpq_template.xml
121
+ - spec/spec_helper.rb
122
+ - spec/support/savon.rb
123
+ - spec/support/template.rb
124
+ homepage: https://github.com/nsi-iff/lattes_api
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.2.2
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Lattes API client for Ruby.
148
+ test_files:
149
+ - spec/lattes_spec.rb
150
+ - spec/resources/1234567890123456.xml
151
+ - spec/resources/1234567890123456.zip
152
+ - spec/resources/1234567890123456_test.zip
153
+ - spec/resources/access_denied.xml
154
+ - spec/resources/get_curriculo_compactado_template.xml
155
+ - spec/resources/get_identificador_cnpq_template.xml
156
+ - spec/spec_helper.rb
157
+ - spec/support/savon.rb
158
+ - spec/support/template.rb