http_store 0.6.2 → 0.6.4
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 +4 -4
- data/Gemfile.lock +3 -3
- data/db/migrate/1_create_http_logs.rb +6 -1
- data/lib/http_store/helpers/storable.rb +5 -1
- data/lib/http_store/middleware/request_log.rb +1 -0
- data/lib/http_store/version.rb +1 -1
- metadata +2 -5
- data/db/migrate/2_add_cache_response_field_to_http_log.rb +0 -6
- data/db/migrate/3_add_retry_times_field_to_http_log.rb +0 -5
- data/db/migrate/4_add_index_to_http_log.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5912e7d57df1c0dbbed3edc404d103137ce8a503b36ed45d46059e1f54ff279
|
4
|
+
data.tar.gz: 27ef060e848875d2f0020124efbfbe19365b83015ab5cac188ce5d3cd9bbda68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '01887ac6363da2fccd78ac8dbfc86360ce85feadb84a911054aea6d40eff0c49864c986600dc4cae5c6a63b74251a2d1735dbb0e43c9ba1629f1ce9101109cee'
|
7
|
+
data.tar.gz: b0e1b314ace8561d7e04a88b746e31821504f099541085aa56744eeb18c5f850760013b296ea63838ee47f64f1683286167f5f703b7dc66091b2b66c8f7f4d12
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
http_store (0.6.
|
4
|
+
http_store (0.6.4)
|
5
5
|
activerecord
|
6
6
|
hashie
|
7
7
|
rails
|
@@ -106,7 +106,7 @@ GEM
|
|
106
106
|
i18n (1.14.1)
|
107
107
|
concurrent-ruby (~> 1.0)
|
108
108
|
io-console (0.7.1)
|
109
|
-
irb (1.
|
109
|
+
irb (1.11.0)
|
110
110
|
rdoc
|
111
111
|
reline (>= 0.3.8)
|
112
112
|
loofah (2.22.0)
|
@@ -124,7 +124,7 @@ GEM
|
|
124
124
|
mini_mime (1.1.5)
|
125
125
|
minitest (5.20.0)
|
126
126
|
mutex_m (0.2.0)
|
127
|
-
net-imap (0.4.
|
127
|
+
net-imap (0.4.9)
|
128
128
|
date
|
129
129
|
net-protocol
|
130
130
|
net-pop (0.1.2)
|
@@ -19,16 +19,21 @@ class CreateHttpLogs < ActiveRecord::Migration[5.2]
|
|
19
19
|
t.integer :status_code, comment: 'response http code'
|
20
20
|
t.text :response, comment: 'response body'
|
21
21
|
t.text :response_headers, comment: 'response header'
|
22
|
+
t.integer :response_code, comment: 'response code'
|
22
23
|
|
23
24
|
# response checker
|
24
25
|
t.boolean :response_valid, comment: '请求结果 true/false, 这个要根据业务逻辑来设定. 不能靠 status_code 来确定'
|
25
26
|
t.text :response_data, comment: '格式化后的 response'
|
26
27
|
|
27
28
|
# relation
|
28
|
-
t.string :client_type, limit: 80, comment: '请求类型'
|
29
|
+
t.string :client_type, index: true, limit: 80, comment: '请求类型'
|
29
30
|
t.string :requestable_id, comment: '外键 ID'
|
30
31
|
t.string :requestable_type, comment: '外键 类型'
|
31
32
|
t.integer :parent_id
|
33
|
+
t.boolean :is_system, default: false, comment: '是否系统请求'
|
34
|
+
|
35
|
+
t.boolean :cache_request, comment: '是否缓存请求'
|
36
|
+
t.integer :retry_times, comment: '重试次数'
|
32
37
|
|
33
38
|
t.index [:created_at, :client_type]
|
34
39
|
t.index [:created_at, :response_valid]
|
@@ -28,10 +28,14 @@ module HttpStore
|
|
28
28
|
return unless HttpStore.config.store_enable
|
29
29
|
|
30
30
|
@meta.parent_id = storeable_record.id if use_cache?
|
31
|
-
@storeable_record =
|
31
|
+
@storeable_record = store_class.new(gen_storable_meta)
|
32
32
|
@storeable_record.save!
|
33
33
|
end
|
34
34
|
|
35
|
+
def store_class
|
36
|
+
@store_class ||= HttpStore.config.store_class.to_s.constantize
|
37
|
+
end
|
38
|
+
|
35
39
|
def use_cache?
|
36
40
|
@use_cache ||= !@meta.force && storeable_record.present?
|
37
41
|
end
|
@@ -31,6 +31,7 @@ module HttpStore
|
|
31
31
|
http_method: request.request_method,
|
32
32
|
data: request.params,
|
33
33
|
client_type: request.params[:client_type],
|
34
|
+
is_system: true,
|
34
35
|
headers: request.headers.select { |k, _v| k.start_with? 'HTTP_' }.to_h,
|
35
36
|
query_params: request.query_parameters,
|
36
37
|
force: true,
|
data/lib/http_store/version.rb
CHANGED
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.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- black
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -140,9 +140,6 @@ files:
|
|
140
140
|
- bin/console
|
141
141
|
- bin/setup
|
142
142
|
- db/migrate/1_create_http_logs.rb
|
143
|
-
- db/migrate/2_add_cache_response_field_to_http_log.rb
|
144
|
-
- db/migrate/3_add_retry_times_field_to_http_log.rb
|
145
|
-
- db/migrate/4_add_index_to_http_log.rb
|
146
143
|
- http_store.gemspec
|
147
144
|
- lib/generators/http_store/initializer_generator.rb
|
148
145
|
- lib/http_store.rb
|