webinspector 0.1.0 → 0.2.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: e032ae52ae21e3e3b5e6797e51e5f90c6682035e
4
- data.tar.gz: 98407e3d9ef2b8f469a4c7886c86166e74e0fbf8
3
+ metadata.gz: 7ad37cd905f72b0d7b6a9e12253b65dd2a48e94a
4
+ data.tar.gz: efddee40c1b9505a43b96085e2f7ff93dfb678ea
5
5
  SHA512:
6
- metadata.gz: 4499172570068e8a4ea5b747093d5ea8a2cb49f87745af6bc2884a39d4658cbfc7d27e110a5a794e97514caf7474265ef6b7ab6e8d513619c9180c0947ee997c
7
- data.tar.gz: 56de25e0dacd21ec19a59c513076980d56f1bbe02a4290b1959e0cb3dddd3ea09f0f286b15d9f11c0130c2a378fff859f512a37c35f26a290eba3667e5ca8e3d
6
+ metadata.gz: 6e208ec285ed76abaaca8b16f8a76a1323343ace86ee44cd5bb23a94148468841c63e28e5dcc14d04f0dfae580019d2b92194311f4e34bdb0e7c5b56f3e06978
7
+ data.tar.gz: bbd316683c9ea289975ad12d7d039ace65e3ffca109d71c25f54f61347032729e775d93f29b4a3dd341d66d7ee8e7b32af0ca8c6708981d1d068088839c8425b
@@ -1,11 +1,11 @@
1
1
  require 'nokogiri'
2
2
  require 'uri'
3
- require 'addressable/uri'
4
3
  require 'open-uri'
5
4
  require 'open_uri_redirections'
6
5
  require 'faraday'
7
6
 
8
7
  require File.expand_path(File.join(File.dirname(__FILE__), 'inspector'))
8
+ require File.expand_path(File.join(File.dirname(__FILE__), 'uri'))
9
9
 
10
10
  module WebInspector
11
11
  class Page
@@ -14,6 +14,7 @@ module WebInspector
14
14
  def initialize(url, options = {})
15
15
  @url = url
16
16
  @options = options
17
+ @uri = WebInspector::Uri.new(url)
17
18
  @inspector = WebInspector::Inspector.new(page)
18
19
  end
19
20
 
@@ -38,19 +39,19 @@ module WebInspector
38
39
  end
39
40
 
40
41
  def url
41
- normalized_uri
42
+ @uri.url
42
43
  end
43
44
 
44
45
  def host
45
- uri.host
46
+ @uri.host
46
47
  end
47
48
 
48
49
  def scheme
49
- uri.scheme
50
+ @uri.scheme
50
51
  end
51
52
 
52
53
  def port
53
- URI(normalized_uri).port
54
+ @uri.port
54
55
  end
55
56
 
56
57
  def to_hash
@@ -101,20 +102,12 @@ module WebInspector
101
102
  response
102
103
  end
103
104
 
104
- def uri
105
- Addressable::URI.parse(@url)
106
- end
107
-
108
- def normalized_uri
109
- uri.normalize.to_s
110
- end
111
-
112
105
  def default_user_agent
113
106
  "WebInspector/#{WebInspector::VERSION} (+https://github.com/davidesantangelo/webinspector)"
114
107
  end
115
108
 
116
109
  def page
117
- Nokogiri::HTML(open(normalized_uri, :allow_redirections => :safe))
110
+ Nokogiri::HTML(open(@uri.url, :allow_redirections => :safe))
118
111
  end
119
112
  end
120
113
  end
@@ -1,3 +1,3 @@
1
1
  module WebInspector
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webinspector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo