uniara_virtual_parser 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uniara_virtual_parser/client.rb +3 -10
- data/lib/uniara_virtual_parser/version.rb +1 -1
- data/lib/uniara_virtual_parser.rb +1 -1
- data/spec/uniara_virtual_parser/client_spec.rb +2 -12
- data/spec/uniara_virtual_parser/services/login_spec.rb +2 -0
- data/spec/uniara_virtual_parser/services/student_spec.rb +1 -0
- data/uniara_virtual_parser.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88617b0c0b9e6d1f4cfbe27d4adbcf75735c4f1b
|
4
|
+
data.tar.gz: 851dd8304b510aff8b0b8308d6aebb364677e939
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cdc8a7d1fa2eb9ed1f8db7f24e842391f48127a98a76d2fe1adfa85c72c45ffa696260376b023ff388260f7121a74da929ee80ffbccb0b81f1b718bc5c4c9c7
|
7
|
+
data.tar.gz: 89939bab945790d0c3c4ea404f6e89721bc71cee7b0143b3e75c4220abbdfdc14003dee2e591aed02aa233e213017fef812512bc7698e5c6b9d73874f2c5514d
|
@@ -6,19 +6,12 @@ module UniaraVirtualParser
|
|
6
6
|
class Client
|
7
7
|
ENDPOINT = 'http://virtual.uniara.com.br'
|
8
8
|
class << self
|
9
|
-
extend Forwardable
|
10
|
-
def_delegators :client, :post
|
11
|
-
|
12
9
|
def get_with_token(path, token)
|
13
|
-
|
14
|
-
request.header[:cookie] = "PHPSESSID=#{token};"
|
15
|
-
end
|
10
|
+
HTTParty.get("#{ENDPOINT}#{path}", headers: { "cookie" => "PHPSESSID=#{token};" })
|
16
11
|
end
|
17
12
|
|
18
|
-
|
19
|
-
|
20
|
-
def client
|
21
|
-
@client ||= Hurley::Client.new ENDPOINT
|
13
|
+
def post(path, body=nil)
|
14
|
+
HTTParty.post("#{ENDPOINT}#{path}", body: body)
|
22
15
|
end
|
23
16
|
end
|
24
17
|
end
|
@@ -8,19 +8,9 @@ module UniaraVirtualParser
|
|
8
8
|
|
9
9
|
let(:client) { double(:client, post: true) }
|
10
10
|
|
11
|
-
describe '.client' do
|
12
|
-
it 'creates only one hurley_client object' do
|
13
|
-
expect(Hurley::Client).to receive(:new).once { client }
|
14
|
-
|
15
|
-
described_class.post '/batman'
|
16
|
-
described_class.post '/batman'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
11
|
describe '.post' do
|
21
|
-
it 'calls
|
22
|
-
expect(
|
23
|
-
allow(Hurley::Client).to receive(:new) { client }
|
12
|
+
it 'calls HTTParty and send the post' do
|
13
|
+
expect(HTTParty).to receive(:post)
|
24
14
|
|
25
15
|
described_class.post '/batman'
|
26
16
|
end
|
@@ -6,6 +6,7 @@ module UniaraVirtualParser
|
|
6
6
|
let(:body) do
|
7
7
|
{ 'senha' => 'wayne', 'username' => 'bruce' }
|
8
8
|
end
|
9
|
+
|
9
10
|
let(:response_headers) do
|
10
11
|
{
|
11
12
|
'Set-Cookie' => 'PHPSESSID=64sbv9srm10tove94kn7nutfb2;'\
|
@@ -19,6 +20,7 @@ module UniaraVirtualParser
|
|
19
20
|
before do
|
20
21
|
stub_request(:post, 'http://virtual.uniara.com.br/login')
|
21
22
|
.with(body: body)
|
23
|
+
.with(:body => {"senha"=>"wayne", "username"=>"bruce"})
|
22
24
|
.to_return(status: 200, body: '', headers: response_headers)
|
23
25
|
end
|
24
26
|
|
@@ -7,6 +7,7 @@ module UniaraVirtualParser
|
|
7
7
|
let(:student) { described_class.student 'theimp' }
|
8
8
|
before do
|
9
9
|
stub_request(:get, "http://virtual.uniara.com.br/alunos/index/").
|
10
|
+
with(:headers => {'Cookie'=>'PHPSESSID=theimp;'}).
|
10
11
|
to_return(:status => 200, body: uniara_virtual_fixture("index.html").read, headers: {})
|
11
12
|
end
|
12
13
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'httparty'
|
22
22
|
spec.add_dependency 'nokogiri', '~> 1.6.6.2'
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
24
|
spec.add_development_dependency 'coveralls'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniara_virtual_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|