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
17
18
19
|
# File 'lib/swd.rb', line 17
def self.cache
@@cache
end
|
.cache=(cache) ⇒ Object
14
15
16
|
# File 'lib/swd.rb', line 14
def self.cache=(cache)
@@cache = cache
end
|
.debug(&block) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/swd.rb', line 43
def self.debug(&block)
original = self.debugging?
self.debugging = true
yield
ensure
self.debugging = original
end
|
.debug! ⇒ Object
40
41
42
|
# File 'lib/swd.rb', line 40
def self.debug!
self.debugging = true
end
|
.debugging=(boolean) ⇒ Object
37
38
39
|
# File 'lib/swd.rb', line 37
def self.debugging=(boolean)
@@debugging = boolean
end
|
.debugging? ⇒ Boolean
34
35
36
|
# File 'lib/swd.rb', line 34
def self.debugging?
@@debugging
end
|
.discover!(attributes = {}) ⇒ Object
21
22
23
|
# File 'lib/swd.rb', line 21
def self.discover!(attributes = {})
Resource.new(attributes).discover!(attributes[:cache])
end
|
.http_client ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/swd.rb', line 52
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
60
61
62
|
# File 'lib/swd.rb', line 60
def self.http_config(&block)
@@http_config ||= block
end
|
.logger ⇒ Object
25
26
27
|
# File 'lib/swd.rb', line 25
def self.logger
@@logger
end
|
.logger=(logger) ⇒ Object
28
29
30
|
# File 'lib/swd.rb', line 28
def self.logger=(logger)
@@logger = logger
end
|
.url_builder ⇒ Object
64
65
66
|
# File 'lib/swd.rb', line 64
def self.url_builder
@@url_builder ||= URI::HTTPS
end
|
.url_builder=(builder) ⇒ Object
67
68
69
|
# File 'lib/swd.rb', line 67
def self.url_builder=(builder)
@@url_builder = builder
end
|