iesde 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6937ba51e796cd6ffb2c1a3ac5935f3a79d4ca17
4
- data.tar.gz: b56cacb34cf8197e5c3b848a24d2691ba2a9c3de
3
+ metadata.gz: 3f74b027beb1b42abe81eb0836c21ea0b8b5ea79
4
+ data.tar.gz: 36a12babe4008b9461c25fd924050c4dc4acfe5f
5
5
  SHA512:
6
- metadata.gz: 1be65ff4d63f2cac4ef9cec5a7f935e1560d01707832a21b17d5a2ca5c606bb0ea55a7b9e80c0ccd53b15473cea39e02e84c3aa40b4fe4ff23618926ed5f76cb
7
- data.tar.gz: 5f99358d7178bbb4b88af2c1124fa48bd6766ee363ec5601028e1a42290d67d7cfd1a0a0b3e5d003e2fc99f8a5f210e900f0489aaa51b13140d3109a7b115641
6
+ metadata.gz: 28c0863eae5d2a183cd2126994b2b43cae9993f29f0e75ade4853c1200b6b9341e741ea7cfa81f3abc88bf8c880683de3e83cc2dabce8a96069924146521cee3
7
+ data.tar.gz: e6cf8fc2f8d17b223c97aaf9aebd4d379a81e429aac46dabf8e0e543c078a364ddcf39e21ce4ca87851aec44d3e792127bdacb1207ad7dfe247099daeb6587a5
data/lib/iesde/api.rb CHANGED
@@ -3,11 +3,11 @@ module Iesde
3
3
  include ActionView::Helpers::SanitizeHelper
4
4
 
5
5
  def initialize(o_que, format, opts = {})
6
- tipo = tipo_requisicao(o_que)
6
+ @tipo = tipo_requisicao(o_que)
7
7
  config_api(opts)
8
8
 
9
9
  params = config_params(opts)
10
- request = Request.new(tipo, format, api_hash)
10
+ request = Request.new(@tipo, format, api_hash)
11
11
  @response = request.execute(params)
12
12
  end
13
13
 
@@ -42,6 +42,12 @@ module Iesde
42
42
  [ BASE, WEB_SERVICE, ask_for, 'format', FORMATS[format]].join('/')
43
43
  end
44
44
 
45
+ FORMATS = { json: "json", html: 'html', xml: 'xml' }
46
+ BASE = 'http://ead.portalava.com.br'
47
+ WEB_SERVICE = 'web_service'
48
+
49
+ private
50
+
45
51
  def tipo_requisicao(o_que)
46
52
  strings = {
47
53
  cursos: 'getCursos',
@@ -68,12 +74,6 @@ module Iesde
68
74
  raise 'Você precisa passar um tipo de requisição válido'
69
75
  end
70
76
 
71
- FORMATS = { json: "json", html: 'html', xml: 'xml' }
72
- BASE = 'http://ead.portalava.com.br'
73
- WEB_SERVICE = 'web_service'
74
-
75
- private
76
-
77
77
  def config_params(opts)
78
78
  opts.reject { |k,_| k == :config }
79
79
  end
@@ -84,8 +84,6 @@ module Iesde
84
84
  opts.merge!(config: {})
85
85
  end
86
86
 
87
- # opts.merge!(config: {}) unless opts.has_key?(:config)
88
-
89
87
  _config = opts[:config]
90
88
 
91
89
  @user = _config[:user] || Iesde.config.user
@@ -93,6 +91,7 @@ module Iesde
93
91
  @ead_api_key = _config[:ead_api_key] || Iesde.config.ead_api_key
94
92
 
95
93
  rescue NoMethodError => e
94
+ ap "requisicao para #{@tipo}" if ENV['DEBUG']
96
95
  raise 'Você precisa configurar usuario e password'
97
96
  end
98
97
 
@@ -15,11 +15,11 @@ module Iesde
15
15
  matriculas_obtidas.underscorize_fields(Matricula)
16
16
  end
17
17
 
18
- def self.criar params
18
+ def self.criar(params = {})
19
19
  matricula = Iesde::Api::CriarMatricula.new(:json, params)
20
20
 
21
21
  if matricula.salvo_com_sucesso?
22
- Iesde::Model::Matricula.buscar.select do |mat|
22
+ Iesde::Model::Matricula.buscar(params).select do |mat|
23
23
  mat.matricula_id.to_s == matricula.matricula_id_do_retorno.to_s
24
24
  end.first
25
25
  else
@@ -27,14 +27,16 @@ module Iesde
27
27
  end
28
28
  end
29
29
 
30
- def self.criar_com_campos_obrigatorios(curso_id, nome, cpf, email, cep, numero)
30
+ def self.criar_com_campos_obrigatorios(curso_id, nome, cpf, email, cep, numero, opts = {})
31
31
  self.criar(
32
+ {
32
33
  'CursoID' => curso_id,
33
34
  'Nome' => nome,
34
35
  'CPF' => cpf,
35
36
  'Email' => email,
36
37
  'CEP' => cep,
37
38
  'Numero' => numero
39
+ }.merge(opts)
38
40
  )
39
41
  end
40
42
 
data/lib/iesde/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iesde
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iesde
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Benevides
@@ -9,202 +9,202 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-03-03 00:00:00.000000000 Z
12
+ date: 2017-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.8'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.8'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '10.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: savon
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.10'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '2.10'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: json
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.7'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.7'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: activesupport
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ~>
75
75
  - !ruby/object:Gem::Version
76
76
  version: '4.2'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ~>
82
82
  - !ruby/object:Gem::Version
83
83
  version: '4.2'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: actionview
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - '>='
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: net-http-digest_auth
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ">="
102
+ - - '>='
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
109
+ - - '>='
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: rspec
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ">="
116
+ - - '>='
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ">="
123
+ - - '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: awesome_print
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ">="
130
+ - - '>='
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ">="
137
+ - - '>='
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: pry
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ">="
144
+ - - '>='
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - ">="
151
+ - - '>='
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: pry-byebug
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ">="
158
+ - - '>='
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">="
165
+ - - '>='
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: vcr
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - ">="
172
+ - - '>='
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
175
  type: :development
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - ">="
179
+ - - '>='
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  - !ruby/object:Gem::Dependency
183
183
  name: webmock
184
184
  requirement: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - ">="
186
+ - - '>='
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  type: :development
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - ">="
193
+ - - '>='
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: simplecov
198
198
  requirement: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - ">="
200
+ - - '>='
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  type: :development
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - ">="
207
+ - - '>='
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  description: Esta não é uma versão oficial
@@ -215,9 +215,9 @@ executables: []
215
215
  extensions: []
216
216
  extra_rdoc_files: []
217
217
  files:
218
- - ".gitignore"
219
- - ".rspec"
220
- - ".travis.yml"
218
+ - .gitignore
219
+ - .rspec
220
+ - .travis.yml
221
221
  - Gemfile
222
222
  - LICENSE
223
223
  - README-OLD-API.md
@@ -265,17 +265,17 @@ require_paths:
265
265
  - lib
266
266
  required_ruby_version: !ruby/object:Gem::Requirement
267
267
  requirements:
268
- - - ">="
268
+ - - '>='
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - ">="
273
+ - - '>='
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.4.8
278
+ rubygems_version: 2.4.6
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: Client do WebService REST do IESDE