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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88617b0c0b9e6d1f4cfbe27d4adbcf75735c4f1b
4
- data.tar.gz: 851dd8304b510aff8b0b8308d6aebb364677e939
3
+ metadata.gz: 140bdf23e8a5760457f283f6199883d581fb0283
4
+ data.tar.gz: f1e892d201802957143cf86b725d53f493f12e67
5
5
  SHA512:
6
- metadata.gz: 7cdc8a7d1fa2eb9ed1f8db7f24e842391f48127a98a76d2fe1adfa85c72c45ffa696260376b023ff388260f7121a74da929ee80ffbccb0b81f1b718bc5c4c9c7
7
- data.tar.gz: 89939bab945790d0c3c4ea404f6e89721bc71cee7b0143b3e75c4220abbdfdc14003dee2e591aed02aa233e213017fef812512bc7698e5c6b9d73874f2c5514d
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
- HTTParty.get("#{ENDPOINT}#{path}", headers: { "cookie" => "PHPSESSID=#{token};" })
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
- HTTParty.post("#{ENDPOINT}#{path}", body: body)
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.header['Set-Cookie']
6
+ cookies = response['Set-Cookie']
7
7
 
8
8
  fail InvalidLogin unless /UVXS233E3=S/.match cookies
9
9
  cookies.match(/PHPSESSID=([^;]*);/)[1]
@@ -1,3 +1,3 @@
1
1
  module UniaraVirtualParser
2
- VERSION = '1.1.2'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -1,4 +1,3 @@
1
- require 'httparty'
2
1
  require 'nokogiri'
3
2
  require 'uniara_virtual_parser/version'
4
3
  require 'uniara_virtual_parser/client'
@@ -10,7 +10,7 @@ module UniaraVirtualParser
10
10
 
11
11
  describe '.post' do
12
12
  it 'calls HTTParty and send the post' do
13
- expect(HTTParty).to receive(:post)
13
+ expect(Net::HTTP).to receive(:post_form)
14
14
 
15
15
  described_class.post '/batman'
16
16
  end
@@ -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: 1.1.2
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-20 00:00:00.000000000 Z
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