Class: Cashbox::Request
- Inherits:
-
Object
- Object
- Cashbox::Request
- Includes:
- HTTParty
- Defined in:
- lib/cashbox/request.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(method, path, options = {}) ⇒ Request
constructor
A new instance of Request.
- #response ⇒ Object
Constructor Details
#initialize(method, path, options = {}) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 |
# File 'lib/cashbox/request.rb', line 7 def initialize(method, path, = {}) @method = method @path = path @options = end |
Class Method Details
.after_request_log(&block) ⇒ Object
13 14 15 |
# File 'lib/cashbox/request.rb', line 13 def self.after_request_log(&block) @@after_request_log = block if block_given? end |
.after_request_log_block ⇒ Object
17 18 19 |
# File 'lib/cashbox/request.rb', line 17 def self.after_request_log_block @@after_request_log ||= nil end |
Instance Method Details
#response ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cashbox/request.rb', line 21 def response resp = self.class.send(@method, @path, @options.merge()) if self.class.after_request_log_block resp.tap do |r| self.class.after_request_log_block.call(@method, @path, @options, r) end end Hashie::Mash.new(resp) end |