Module: SWD
- Defined in:
- lib/swd.rb,
lib/swd/cache.rb,
lib/swd/resource.rb,
lib/swd/response.rb,
lib/swd/exception.rb,
lib/swd/debugger/request_filter.rb
Defined Under Namespace
Modules: Debugger
Classes: BadRequest, Cache, Exception, Forbidden, HttpError, NotFound, Resource, Response, Unauthorized
Constant Summary
collapse
- VERSION =
::File.read(
::File.join(::File.dirname(__FILE__), '../VERSION')
)
Class Method Summary
collapse
Class Method Details
.cache ⇒ Object
16
17
18
|
# File 'lib/swd.rb', line 16
def self.cache
@@cache
end
|
.cache=(cache) ⇒ Object
13
14
15
|
# File 'lib/swd.rb', line 13
def self.cache=(cache)
@@cache = cache
end
|
.debug(&block) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/swd.rb', line 42
def self.debug(&block)
original = self.debugging?
self.debugging = true
yield
ensure
self.debugging = original
end
|
.debug! ⇒ Object
39
40
41
|
# File 'lib/swd.rb', line 39
def self.debug!
self.debugging = true
end
|
.debugging=(boolean) ⇒ Object
36
37
38
|
# File 'lib/swd.rb', line 36
def self.debugging=(boolean)
@@debugging = boolean
end
|
.debugging? ⇒ Boolean
33
34
35
|
# File 'lib/swd.rb', line 33
def self.debugging?
@@debugging
end
|
.discover!(attributes = {}) ⇒ Object
20
21
22
|
# File 'lib/swd.rb', line 20
def self.discover!(attributes = {})
Resource.new(attributes).discover!(attributes[:cache])
end
|
.http_client ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/swd.rb', line 51
def self.http_client
_http_client_ = HTTPClient.new(
:agent_name => "SWD (#{VERSION})"
)
_http_client_.request_filter << Debugger::RequestFilter.new if debugging?
http_config.try(:call, _http_client_)
_http_client_
end
|
.http_config(&block) ⇒ Object
59
60
61
|
# File 'lib/swd.rb', line 59
def self.http_config(&block)
@@http_config ||= block
end
|
.logger ⇒ Object
24
25
26
|
# File 'lib/swd.rb', line 24
def self.logger
@@logger
end
|
.logger=(logger) ⇒ Object
27
28
29
|
# File 'lib/swd.rb', line 27
def self.logger=(logger)
@@logger = logger
end
|
.url_builder ⇒ Object
63
64
65
|
# File 'lib/swd.rb', line 63
def self.url_builder
@@url_builder ||= URI::HTTPS
end
|
.url_builder=(builder) ⇒ Object
66
67
68
|
# File 'lib/swd.rb', line 66
def self.url_builder=(builder)
@@url_builder = builder
end
|