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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d7e1db9f84f2b497ec9eada71151409d421a0d8
4
- data.tar.gz: 83dbbf36addeb919b810cd7bd029d1ea2efa939f
3
+ metadata.gz: 88617b0c0b9e6d1f4cfbe27d4adbcf75735c4f1b
4
+ data.tar.gz: 851dd8304b510aff8b0b8308d6aebb364677e939
5
5
  SHA512:
6
- metadata.gz: 7b24b7d5c0ecc522d51150918553e5456a9c452c7c579dbf46fb53054f1845dbb71b3111fc130dda28fcdf00e6bb71305c8ab871cf6a17585e2419228f1489d6
7
- data.tar.gz: 2c618b7a09cdb20c2a1d907191893c797ac1903f4a8d334bf9d9024abf8746ac6cbff05222d5ca4613f25c800a4dcdd276134e0e795c57bf4b9746c362b5d9a6
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
- client.get(path) do |request|
14
- request.header[:cookie] = "PHPSESSID=#{token};"
15
- end
10
+ HTTParty.get("#{ENDPOINT}#{path}", headers: { "cookie" => "PHPSESSID=#{token};" })
16
11
  end
17
12
 
18
- private
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
@@ -1,3 +1,3 @@
1
1
  module UniaraVirtualParser
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'hurley'
1
+ require 'httparty'
2
2
  require 'nokogiri'
3
3
  require 'uniara_virtual_parser/version'
4
4
  require 'uniara_virtual_parser/client'
@@ -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 hurley_client and send the post' do
22
- expect(client).to receive(:post).with('/batman')
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 'hurley', '~> 0.1'
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.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-02-11 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: hurley
14
+ name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
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.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement