uniara_virtual_parser 1.1.2 → 2.0.0
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 +10 -2
- data/lib/uniara_virtual_parser/services/login.rb +1 -1
- data/lib/uniara_virtual_parser/version.rb +1 -1
- data/lib/uniara_virtual_parser.rb +0 -1
- data/spec/uniara_virtual_parser/client_spec.rb +1 -1
- data/uniara_virtual_parser.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 140bdf23e8a5760457f283f6199883d581fb0283
|
4
|
+
data.tar.gz: f1e892d201802957143cf86b725d53f493f12e67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95dacc28488ab96aa8f5cc4e657fd6a53041f2fde36db3fc0c099f4f9e260ef9d19665f7722ee24787bfb728ec634e07bb3fcc2c886f5d14a603641189786615
|
7
|
+
data.tar.gz: 3aa1987f2e983094a9af49006ade5a180cd6470222c11d982f04e86de90593ad4b2cba2256bf99982b0859fbfd1b055adc6c2976599a5172588d5b8259de1a0b
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'net/http'
|
1
2
|
module UniaraVirtualParser
|
2
3
|
#
|
3
4
|
# This module handle the connections between all services and the
|
@@ -5,13 +6,20 @@ module UniaraVirtualParser
|
|
5
6
|
#
|
6
7
|
class Client
|
7
8
|
ENDPOINT = 'http://virtual.uniara.com.br'
|
9
|
+
|
8
10
|
class << self
|
9
11
|
def get_with_token(path, token)
|
10
|
-
|
12
|
+
uri = URI("#{ENDPOINT}#{path}")
|
13
|
+
req = Net::HTTP::Get.new(uri)
|
14
|
+
req['Cookie'] = "PHPSESSID=#{token};"
|
15
|
+
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
16
|
+
http.request(req)
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
def post(path, body=nil)
|
14
|
-
|
21
|
+
uri = URI("#{ENDPOINT}#{path}")
|
22
|
+
Net::HTTP.post_form(uri, body)
|
15
23
|
end
|
16
24
|
end
|
17
25
|
end
|
@@ -3,7 +3,7 @@ module UniaraVirtualParser
|
|
3
3
|
module Login
|
4
4
|
def login(ra, password)
|
5
5
|
response = Client.post('/login', username: ra, senha: password)
|
6
|
-
cookies = response
|
6
|
+
cookies = response['Set-Cookie']
|
7
7
|
|
8
8
|
fail InvalidLogin unless /UVXS233E3=S/.match cookies
|
9
9
|
cookies.match(/PHPSESSID=([^;]*);/)[1]
|
@@ -18,7 +18,6 @@ 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 'httparty'
|
22
21
|
spec.add_dependency 'nokogiri', '~> 1.6.6.2'
|
23
22
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
23
|
spec.add_development_dependency 'coveralls'
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniara_virtual_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
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-05-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: httparty
|
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
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: nokogiri
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|