uniara_virtual_parser 0.0.1 → 0.0.2

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: 70ca7f52e8cb6eb38f591b934b494511e8b74251
4
- data.tar.gz: dd096cfd52b613e8c244ffcee07a053c2e80bb80
3
+ metadata.gz: b61ea827910906965e309da6334f7ed073fa88f7
4
+ data.tar.gz: 0609cde591bbb78981843a6675a37f8b9b879a55
5
5
  SHA512:
6
- metadata.gz: 4909efadac1245e39e5e6bf87ee75d115a34c4562dfc849032fa049a704d592bcac0fe41256958ae33f0377d5f832de27dbbcc728e87c15d356fe96bbb7bd7a9
7
- data.tar.gz: acb4c5b5f9013083e47d36961edf552932624d60141dabb4296d2224c941c963700da9add4d9b37ac4cb6a5fbe3d16f9a4ec990a217a9a00635553141c08cbb0
6
+ metadata.gz: 04d3109b575cd643c9f8747e1b80f7923ecda00a7fdf8fb40c0cebaceb3d0440a3b778ce6732969c33400e08229f52630f6f28c8320b00bd10c0028dfca42e0f
7
+ data.tar.gz: 101b000a8d99b80a8bd9dd9f77c75f96de01507dceaa1f3f86907307f726bf5b9f7efae4f85af9eb2053bb03b0570a266aed2af749449951c67317f60b01153e
@@ -8,9 +8,8 @@ module UniaraVirtualParser
8
8
  class << self
9
9
  extend Forwardable
10
10
  def_delegators :client, :post
11
- attr_accessor :token
12
11
 
13
- def get_with_token(path)
12
+ def get_with_token(path, token)
14
13
  client.get(path) do |request|
15
14
  request.header[:cookie] = "PHPSESSID=#{token};"
16
15
  end
@@ -1,8 +1,8 @@
1
1
  module UniaraVirtualParser
2
2
  module Services
3
3
  module Grades
4
- def grades
5
- response = Client.get_with_token('/alunos/consultas/notas/')
4
+ def grades(token)
5
+ response = Client.get_with_token('/alunos/consultas/notas/', token)
6
6
  parse_grades response.body
7
7
  end
8
8
 
@@ -5,7 +5,7 @@ module UniaraVirtualParser
5
5
  response = Client.post('/login', username: ra, senha: password)
6
6
  cookies = response.header['Set-Cookie']
7
7
  fail InvalidLogin unless /UVXS233E3=S/.match cookies
8
- Client.token = cookies.match(/PHPSESSID=([^;]*);/)[1]
8
+ cookies.match(/PHPSESSID=([^;]*);/)[1]
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module UniaraVirtualParser
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -7,7 +7,7 @@ module UniaraVirtualParser
7
7
  it 'fetch the content of uniara virtual and bring the array with grades' do
8
8
  stub_request(:get, "http://virtual.uniara.com.br/alunos/consultas/notas/").
9
9
  to_return(:status => 200, body: uniara_virtual_fixture("grades.html").read, headers: {})
10
- grades = described_class.grades
10
+ grades = described_class.grades 'batman'
11
11
  expect(grades.first.name).to eq "ADMINISTRAÇÃO E ECONOMIA"
12
12
  expect(grades.length).to eq 14
13
13
  end
@@ -18,13 +18,12 @@ module UniaraVirtualParser
18
18
  }
19
19
  end
20
20
 
21
- it 'sets the token in the Client' do
21
+ it 'returns the token in the Client' do
22
22
  stub_request(:post, 'http://virtual.uniara.com.br/login')
23
23
  .with(body: body)
24
24
  .to_return(status: 200, body: '', headers: response_headers)
25
25
 
26
- expect { described_class.login 'bruce', 'wayne' }
27
- .to change(Client, :token)
26
+ expect(described_class.login 'bruce', 'wayne').to be
28
27
  end
29
28
  end
30
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uniara_virtual_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Ribeiro