http_store 0.6.14 → 0.6.16

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
  SHA256:
3
- metadata.gz: 1fd70dbe26604d3dc46c9af21dcb9b059fadd2f78c31e0d409a4fe3783924be3
4
- data.tar.gz: 93fdea1c8ea11c8500d94c32661ba51580fb0694f78afc5464b4ee73703a507d
3
+ metadata.gz: c3fbc1ffe51b05225dca0f70606c44e265aefab1c15de7e1d70f7bb4fb0683bf
4
+ data.tar.gz: 73d384f25df3690dcd90b95e8af51689c663a620c8a692cfb0f319c8aacf984b
5
5
  SHA512:
6
- metadata.gz: ab91816c3907117a20975a4a8b265cedf66d38dd41c1917deb44825df023cef5a46cf3e7d91539208464cb91fa07a69129a2c725344bdf9c012d258ef0058dd9
7
- data.tar.gz: de13f929b812e0dcb5c1a346b1ee1235db21673eaa5fca8bdcf4788edcfec492ef37023c38ff5aa86e6d273c5e3428c58339a32ebdaa80e0567fe9e18447e556
6
+ metadata.gz: ab8bf951b9cbc97a7ea34c2ac25b46a30dafb4f0dc1f546c1fc8ff6b6355d63fda1c65d10467e6852ffab5f4e22fb5c2708a061c8821956a81e5ce1983026ad7
7
+ data.tar.gz: 820c9390db321874089bbbe8b39074d40ee03201532a25da0b41a6acc9703b850eb1a8633752faf11c09efc2bcd7048e0fa073c71f7105ce7fda3fbcfadbe9e3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- http_store (0.6.14)
4
+ http_store (0.6.16)
5
5
  activerecord
6
6
  hashie
7
7
  rails
@@ -10,101 +10,104 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (7.2.0)
14
- actionpack (= 7.2.0)
15
- activesupport (= 7.2.0)
13
+ actioncable (7.1.3.2)
14
+ actionpack (= 7.1.3.2)
15
+ activesupport (= 7.1.3.2)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
18
  zeitwerk (~> 2.6)
19
- actionmailbox (7.2.0)
20
- actionpack (= 7.2.0)
21
- activejob (= 7.2.0)
22
- activerecord (= 7.2.0)
23
- activestorage (= 7.2.0)
24
- activesupport (= 7.2.0)
25
- mail (>= 2.8.0)
26
- actionmailer (7.2.0)
27
- actionpack (= 7.2.0)
28
- actionview (= 7.2.0)
29
- activejob (= 7.2.0)
30
- activesupport (= 7.2.0)
31
- mail (>= 2.8.0)
19
+ actionmailbox (7.1.3.2)
20
+ actionpack (= 7.1.3.2)
21
+ activejob (= 7.1.3.2)
22
+ activerecord (= 7.1.3.2)
23
+ activestorage (= 7.1.3.2)
24
+ activesupport (= 7.1.3.2)
25
+ mail (>= 2.7.1)
26
+ net-imap
27
+ net-pop
28
+ net-smtp
29
+ actionmailer (7.1.3.2)
30
+ actionpack (= 7.1.3.2)
31
+ actionview (= 7.1.3.2)
32
+ activejob (= 7.1.3.2)
33
+ activesupport (= 7.1.3.2)
34
+ mail (~> 2.5, >= 2.5.4)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
32
38
  rails-dom-testing (~> 2.2)
33
- actionpack (7.2.0)
34
- actionview (= 7.2.0)
35
- activesupport (= 7.2.0)
39
+ actionpack (7.1.3.2)
40
+ actionview (= 7.1.3.2)
41
+ activesupport (= 7.1.3.2)
36
42
  nokogiri (>= 1.8.5)
37
43
  racc
38
- rack (>= 2.2.4, < 3.2)
44
+ rack (>= 2.2.4)
39
45
  rack-session (>= 1.0.1)
40
46
  rack-test (>= 0.6.3)
41
47
  rails-dom-testing (~> 2.2)
42
48
  rails-html-sanitizer (~> 1.6)
43
- useragent (~> 0.16)
44
- actiontext (7.2.0)
45
- actionpack (= 7.2.0)
46
- activerecord (= 7.2.0)
47
- activestorage (= 7.2.0)
48
- activesupport (= 7.2.0)
49
+ actiontext (7.1.3.2)
50
+ actionpack (= 7.1.3.2)
51
+ activerecord (= 7.1.3.2)
52
+ activestorage (= 7.1.3.2)
53
+ activesupport (= 7.1.3.2)
49
54
  globalid (>= 0.6.0)
50
55
  nokogiri (>= 1.8.5)
51
- actionview (7.2.0)
52
- activesupport (= 7.2.0)
56
+ actionview (7.1.3.2)
57
+ activesupport (= 7.1.3.2)
53
58
  builder (~> 3.1)
54
59
  erubi (~> 1.11)
55
60
  rails-dom-testing (~> 2.2)
56
61
  rails-html-sanitizer (~> 1.6)
57
- activejob (7.2.0)
58
- activesupport (= 7.2.0)
62
+ activejob (7.1.3.2)
63
+ activesupport (= 7.1.3.2)
59
64
  globalid (>= 0.3.6)
60
- activemodel (7.2.0)
61
- activesupport (= 7.2.0)
62
- activerecord (7.2.0)
63
- activemodel (= 7.2.0)
64
- activesupport (= 7.2.0)
65
+ activemodel (7.1.3.2)
66
+ activesupport (= 7.1.3.2)
67
+ activerecord (7.1.3.2)
68
+ activemodel (= 7.1.3.2)
69
+ activesupport (= 7.1.3.2)
65
70
  timeout (>= 0.4.0)
66
- activestorage (7.2.0)
67
- actionpack (= 7.2.0)
68
- activejob (= 7.2.0)
69
- activerecord (= 7.2.0)
70
- activesupport (= 7.2.0)
71
+ activestorage (7.1.3.2)
72
+ actionpack (= 7.1.3.2)
73
+ activejob (= 7.1.3.2)
74
+ activerecord (= 7.1.3.2)
75
+ activesupport (= 7.1.3.2)
71
76
  marcel (~> 1.0)
72
- activesupport (7.2.0)
77
+ activesupport (7.1.3.2)
73
78
  base64
74
79
  bigdecimal
75
- concurrent-ruby (~> 1.0, >= 1.3.1)
80
+ concurrent-ruby (~> 1.0, >= 1.0.2)
76
81
  connection_pool (>= 2.2.5)
77
82
  drb
78
83
  i18n (>= 1.6, < 2)
79
- logger (>= 1.4.2)
80
84
  minitest (>= 5.1)
81
- securerandom (>= 0.3)
82
- tzinfo (~> 2.0, >= 2.0.5)
85
+ mutex_m
86
+ tzinfo (~> 2.0)
83
87
  base64 (0.2.0)
84
88
  bigdecimal (3.1.8)
85
- builder (3.3.0)
89
+ builder (3.2.4)
86
90
  byebug (11.1.3)
87
- concurrent-ruby (1.3.4)
91
+ concurrent-ruby (1.3.3)
88
92
  connection_pool (2.4.1)
89
93
  crass (1.0.6)
90
94
  date (3.3.4)
91
95
  diff-lcs (1.5.0)
92
96
  domain_name (0.6.20240107)
93
97
  drb (2.2.1)
94
- erubi (1.13.0)
98
+ erubi (1.12.0)
95
99
  globalid (1.2.1)
96
100
  activesupport (>= 6.1)
97
101
  hashie (5.0.0)
98
102
  http-accept (1.7.0)
99
- http-cookie (1.0.6)
103
+ http-cookie (1.0.7)
100
104
  domain_name (~> 0.5)
101
105
  i18n (1.14.5)
102
106
  concurrent-ruby (~> 1.0)
103
107
  io-console (0.7.2)
104
- irb (1.14.0)
108
+ irb (1.13.1)
105
109
  rdoc (>= 4.0.0)
106
110
  reline (>= 0.4.2)
107
- logger (1.6.0)
108
111
  loofah (2.22.0)
109
112
  crass (~> 1.0.2)
110
113
  nokogiri (>= 1.12.0)
@@ -116,10 +119,11 @@ GEM
116
119
  marcel (1.0.4)
117
120
  mime-types (3.5.2)
118
121
  mime-types-data (~> 3.2015)
119
- mime-types-data (3.2024.0806)
122
+ mime-types-data (3.2024.0820)
120
123
  mini_mime (1.1.5)
121
- minitest (5.24.1)
122
- net-imap (0.4.14)
124
+ minitest (5.22.3)
125
+ mutex_m (0.2.0)
126
+ net-imap (0.4.11)
123
127
  date
124
128
  net-protocol
125
129
  net-pop (0.1.2)
@@ -130,12 +134,12 @@ GEM
130
134
  net-protocol
131
135
  netrc (0.11.0)
132
136
  nio4r (2.7.3)
133
- nokogiri (1.16.7-arm64-darwin)
137
+ nokogiri (1.16.5-arm64-darwin)
134
138
  racc (~> 1.4)
135
139
  psych (5.1.2)
136
140
  stringio
137
- racc (1.8.1)
138
- rack (3.1.7)
141
+ racc (1.7.3)
142
+ rack (3.0.11)
139
143
  rack-session (2.0.0)
140
144
  rack (>= 3.0.0)
141
145
  rack-test (2.1.0)
@@ -143,20 +147,20 @@ GEM
143
147
  rackup (2.1.0)
144
148
  rack (>= 3)
145
149
  webrick (~> 1.8)
146
- rails (7.2.0)
147
- actioncable (= 7.2.0)
148
- actionmailbox (= 7.2.0)
149
- actionmailer (= 7.2.0)
150
- actionpack (= 7.2.0)
151
- actiontext (= 7.2.0)
152
- actionview (= 7.2.0)
153
- activejob (= 7.2.0)
154
- activemodel (= 7.2.0)
155
- activerecord (= 7.2.0)
156
- activestorage (= 7.2.0)
157
- activesupport (= 7.2.0)
150
+ rails (7.1.3.2)
151
+ actioncable (= 7.1.3.2)
152
+ actionmailbox (= 7.1.3.2)
153
+ actionmailer (= 7.1.3.2)
154
+ actionpack (= 7.1.3.2)
155
+ actiontext (= 7.1.3.2)
156
+ actionview (= 7.1.3.2)
157
+ activejob (= 7.1.3.2)
158
+ activemodel (= 7.1.3.2)
159
+ activerecord (= 7.1.3.2)
160
+ activestorage (= 7.1.3.2)
161
+ activesupport (= 7.1.3.2)
158
162
  bundler (>= 1.15.0)
159
- railties (= 7.2.0)
163
+ railties (= 7.1.3.2)
160
164
  rails-dom-testing (2.2.0)
161
165
  activesupport (>= 5.0.0)
162
166
  minitest
@@ -164,18 +168,18 @@ GEM
164
168
  rails-html-sanitizer (1.6.0)
165
169
  loofah (~> 2.21)
166
170
  nokogiri (~> 1.14)
167
- railties (7.2.0)
168
- actionpack (= 7.2.0)
169
- activesupport (= 7.2.0)
170
- irb (~> 1.13)
171
+ railties (7.1.3.2)
172
+ actionpack (= 7.1.3.2)
173
+ activesupport (= 7.1.3.2)
174
+ irb
171
175
  rackup (>= 1.0.0)
172
176
  rake (>= 12.2)
173
177
  thor (~> 1.0, >= 1.2.2)
174
178
  zeitwerk (~> 2.6)
175
179
  rake (13.0.6)
176
- rdoc (6.7.0)
180
+ rdoc (6.6.3.1)
177
181
  psych (>= 4.0.0)
178
- reline (0.5.9)
182
+ reline (0.5.6)
179
183
  io-console (~> 0.5)
180
184
  rest-client (2.1.0)
181
185
  http-accept (>= 1.7.0, < 2.0)
@@ -195,18 +199,16 @@ GEM
195
199
  diff-lcs (>= 1.2.0, < 2.0)
196
200
  rspec-support (~> 3.12.0)
197
201
  rspec-support (3.12.1)
198
- securerandom (0.3.1)
199
- stringio (3.1.1)
202
+ stringio (3.1.0)
200
203
  thor (1.3.1)
201
204
  timeout (0.4.1)
202
205
  tzinfo (2.0.6)
203
206
  concurrent-ruby (~> 1.0)
204
- useragent (0.16.10)
205
207
  webrick (1.8.1)
206
208
  websocket-driver (0.7.6)
207
209
  websocket-extensions (>= 0.1.0)
208
210
  websocket-extensions (0.1.5)
209
- zeitwerk (2.6.17)
211
+ zeitwerk (2.6.13)
210
212
 
211
213
  PLATFORMS
212
214
  arm64-darwin-23
@@ -15,14 +15,16 @@ module HttpStore
15
15
  end
16
16
 
17
17
  def build_response
18
+ response = json_safe_parse(response_obj.body)
19
+ response = { original: response } unless response.is_a?(Hash)
20
+ @meta.response = response
21
+
18
22
  @meta.status_code = response_obj.code
19
- @meta.response = json_safe_parse(response_obj.body)
20
23
  @meta.response_headers = response_obj.headers
21
-
22
- @meta.response_valid = response_valid?
23
- @meta.response_code = build_response_code
24
- @meta.response_data = build_response_data
25
- @meta.cache_response = cache_response?
24
+ @meta.response_valid = response_valid?
25
+ @meta.response_code = build_response_code
26
+ @meta.response_data = build_response_data
27
+ @meta.cache_response = cache_response?
26
28
  raise HttpStore::RequestError, '三方请求异常, 请与管理员联系' if response_data.nil?
27
29
 
28
30
  Rails.logger.info "#{uri}: response: #{response}"
@@ -24,13 +24,16 @@ module HttpStore
24
24
  end
25
25
 
26
26
  # you can rewrite this callback, to store the request
27
- def store_request
27
+ def store_request(save_now = true)
28
28
  return unless HttpStore.config.store_enable
29
29
 
30
- @meta.parent_id = storeable_record.id if use_cache?
31
- HttpStore::Job::HttpLogStoreJob.perform_later(gen_storable_meta)
32
- # @storeable_record = store_class.new(gen_storable_meta)
33
- # @storeable_record.save!
30
+ if save_now
31
+ @storeable_record = store_class.new(gen_storable_meta)
32
+ @storeable_record.save!
33
+ else
34
+ @meta.parent_id = storeable_record.id if use_cache?
35
+ HttpStore::Job::HttpLogStoreJob.perform_later(gen_storable_meta)
36
+ end
34
37
  end
35
38
 
36
39
  def store_class
@@ -14,7 +14,7 @@ module HttpStore
14
14
  [status, headers, body]
15
15
  ensure
16
16
  build_meta(env, status, headers, body)
17
- store_request
17
+ store_request(false)
18
18
  end
19
19
 
20
20
  def build_meta(env, status, headers, body)
@@ -1,3 +1,3 @@
1
1
  module HttpStore
2
- VERSION = "0.6.14"
2
+ VERSION = "0.6.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.14
4
+ version: 0.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - black
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client