Class: TShield::Request
- Inherits:
-
Object
- Object
- TShield::Request
- Defined in:
- lib/tshield/request.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ Request
constructor
A new instance of Request.
- #request ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Request
Returns a new instance of Request.
18 19 20 21 22 23 24 |
# File 'lib/tshield/request.rb', line 18 def initialize(path, = {}) @path = path @options = @configuration = TShield::Configuration.singleton @options[:timeout] = @configuration.request['timeout'] request end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
16 17 18 |
# File 'lib/tshield/request.rb', line 16 def response @response end |
Instance Method Details
#request ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tshield/request.rb', line 26 def request if not (@options[:raw_query].nil? or @options[:raw_query].empty?) @path = "#{@path}?#{@options[:raw_query]}" end @url = "#{domain}#{@path}" if exists @response = get_current_response @response.original = false else raw = HTTParty.send("#{method}", @url, @options) @response = save(raw) @response.original = true end current_session[:counter].add(@path, method) if current_session debugger if TShield::Options.instance.break?(path: @path, moment: :after) @response end |