cashbox 0.0.22 → 0.0.24

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a65946289676778f4dc4785340cda4d50b3676d
4
- data.tar.gz: 3063ec722bd08319295fd49e510c9cf74852a5ff
3
+ metadata.gz: bface5e4d8ea8d755aac3427f128eea37691c4d4
4
+ data.tar.gz: c69cc918b15a0ce8a2210be5a2ca2f7d7585202d
5
5
  SHA512:
6
- metadata.gz: 460cd4e764450784b2b2ccef0e8fb3ee32fdbccffa6ec068f1acb4caa35b528db2bd60c96f7a49300a3d098bd8d00d671488024616127743a82679ff8e426bbb
7
- data.tar.gz: 91d3ad2f0de280c0a7f2b5886130dc37e56581195436a2494a34ec6428fffcc7afb0a7c7249b4da19d899a7757fdcc23a7ddd5b0159524ff4328019a622f1034
6
+ metadata.gz: ea6a90ef36238961617648c28dc6baf6a86fc205111e7e79ef522ab5053cc4f2ebe3871ee8c60f26be497c4a0598851aec5009ab39019f43440eac391e150ce4
7
+ data.tar.gz: 0a770fddb7002d189eb8a7f1323c77825713f9a056797a0ab01b2f6c4fb5ff95ffc7b8d3b7b3137d2fdf9f391cf35d8760509a5ad253ed0fc924f53bccc4f447
data/README.md CHANGED
@@ -101,6 +101,22 @@ account.save
101
101
 
102
102
  After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bundle console` for an interactive prompt that will allow you to experiment.
103
103
 
104
+ ### Logging
105
+
106
+ You can log the request and response of a call to Vindicia by defining a block in your calling application and passing it to this gem.
107
+
108
+ ```ruby
109
+ Cashbox::Request.after_request_log do |method, path, options, response|
110
+ puts "Request >>>"
111
+ puts method
112
+ puts path
113
+ puts options
114
+ puts "Response >>>"
115
+ puts response
116
+ end
117
+ ```
118
+
119
+
104
120
  ## Contributing
105
121
 
106
122
  Bug reports and pull requests are welcome on GitHub at https://github.com/LegalShield/cashbox. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -10,8 +10,26 @@ module Cashbox
10
10
  @options = options
11
11
  end
12
12
 
13
+ def self.after_request_log(&block)
14
+ @@after_request_log = block
15
+ end
16
+
17
+ def self.after_request_log_block
18
+ @@after_request_log ||= nil
19
+ end
20
+
21
+ def self.after_request_log_block_call(method, path, options, r)
22
+ @@after_request_log.call(method, path, options, r)
23
+ end
24
+
13
25
  def response
14
- Hashie::Mash.new(self.class.send(@method, @path, @options.merge(default_options)))
26
+ resp = self.class.send(@method, @path, @options.merge(default_options))
27
+
28
+ if self.class.after_request_log_block
29
+ self.class.after_request_log_block_call(@method, @path, @options, resp)
30
+ end
31
+
32
+ Hashie::Mash.new(resp)
15
33
  end
16
34
 
17
35
  private
@@ -1,3 +1,3 @@
1
1
  module Cashbox
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.24"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cashbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathon Storer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-13 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler