http-request 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/http-request.rb +6 -11
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
data/lib/http-request.rb CHANGED
@@ -33,7 +33,7 @@
33
33
  require 'net/http'
34
34
 
35
35
  class HttpRequest
36
- VERSION = '1.0.1'
36
+ VERSION = '1.0.2'
37
37
 
38
38
  class HTTPError < StandardError; end
39
39
  class UnexpectedError < StandardError; end
@@ -48,6 +48,10 @@ class HttpRequest
48
48
  attr_accessor :body
49
49
  attr_accessor :status
50
50
 
51
+ class << self
52
+ attr_accessor :user_agent, :timeout
53
+ end
54
+
51
55
 
52
56
  def self.head(url, options={})
53
57
  http = HttpRequest.new(url)
@@ -59,15 +63,6 @@ class HttpRequest
59
63
  http.get(options)
60
64
  end
61
65
 
62
- def self.user_agent=(user_agent)
63
- @user_agent = user_agent
64
- end
65
-
66
- def self.user_agent
67
- @user_agent
68
- end
69
-
70
-
71
66
  def initialize(url)
72
67
  self.uri = url
73
68
  end
@@ -82,7 +77,7 @@ class HttpRequest
82
77
 
83
78
  def request(type, options={})
84
79
  user_agent = options[:user_agent] || HttpRequest.user_agent || 'HttpRequest'
85
- timeout = (options[:timeout] || 10).to_i
80
+ timeout = (options[:timeout] || HttpRequest.timeout || 10).to_i
86
81
  redirect_limit = options[:redirect_limit] || 5
87
82
  output_file = options[:output_file]
88
83
  content_max = options[:content_max]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Peter Kieltyka
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-21 00:00:00 -04:00
17
+ date: 2010-09-09 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20