torna_sdk 0.1.5 → 0.2.1

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: 2b4d4a03c2ef4aadc323910b7eb5b6ee2333e9f5395325a48bfed93b5dc64182
4
- data.tar.gz: 14eecb646289bb8c51de5a9ceaaffd45b74fbbcf2dad3484a75e16c25ebba7c4
3
+ metadata.gz: 25341e80026dc680cdaea351d3985f84a156231f05694e9121abb20b70b09b5e
4
+ data.tar.gz: c071c6244463055407921d52ab0e8ec87b0df7820f3e1cb49e9693ec581cd13c
5
5
  SHA512:
6
- metadata.gz: 799227d3cc14f0a84b59dd7a55c97321ed0ac8889af3fefb9ed758c4080517de32d096417226826a20ef67891b7426e48f711917bded4afa22e654510e002031
7
- data.tar.gz: d9b8f13a5c39e0225b4ed5e6a4dd2867374b2996ccc9f33243a37c7f79fd5dbd80ccb8e1a07a8041dfb653bc989c4591cbe9ba88cd8f6aa885dee24fa719c91e
6
+ metadata.gz: 5ba537669b4f5c9d8e291ebe64c2e3a8991df64d4ca80c2c37b61684877c3a1ab0891a983350f3e18744fadfd5609fc43f80059dda8d6fe85944abdafd4bb48b
7
+ data.tar.gz: 911c08dd6c5f29cf86e0c392b5150e95e872e397100728fb0e73d831241c140a74897fd224d41eaea2fe51851dacb6d9c65761266c4cea94593343bd65d9b08f
data/.cz.yaml CHANGED
@@ -2,7 +2,7 @@
2
2
  commitizen:
3
3
  major_version_zero: true
4
4
  name: cz_conventional_commits
5
- tag_format: 0.1.5
5
+ tag_format: 0.2.1
6
6
  update_changelog_on_bump: true
7
- version: 0.4.0
7
+ version: 0.6.0
8
8
  version_scheme: semver
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3
2
+ TargetRubyVersion: 2
3
3
 
4
4
  Style/StringLiterals:
5
5
  EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -1,61 +1,11 @@
1
1
 
2
2
  - Initial release
3
3
 
4
- ## 0.1.1 (2024-12-29)
5
-
6
- ### Feat
7
-
8
- - torna api
9
-
10
- ## 0.1.1 (2024-12-29)
11
-
12
- ### Fix
13
-
14
- - **gemspec**: remove Appraisals corectlly
15
-
16
- ## 0.1.1 (2024-12-29)
17
-
18
- ### Feat
19
-
20
- - torna api
21
-
22
- ## 0.1.2 (2024-12-29)
23
-
24
- ### Feat
25
-
26
- - torna api
27
-
28
- ### Fix
29
-
30
- - **gemspec**: remove Appraisals corectlly
31
-
32
- ## 0.1.3 (2024-12-29)
33
-
34
- ### Feat
35
-
36
- - torna api
37
-
38
- ### Fix
39
-
40
- - **log**: remove unnecessary logs
41
- - **gemspec**: remove Appraisals corectlly
42
-
43
- ## 0.1.4 (2024-12-29)
44
-
45
- ### Feat
46
-
47
- - torna api
48
-
49
- ### Fix
50
-
51
- - **railtie**: load torna.rake exactly
52
- - **log**: remove unnecessary logs
53
- - **gemspec**: remove Appraisals corectlly
54
-
55
- ## 0.1.5 (2024-12-29)
4
+ ## 0.2.1 (2025-01-15)
56
5
 
57
6
  ### Feat
58
7
 
8
+ - **torna.rake**: add more fields to documents
59
9
  - torna api
60
10
 
61
11
  ### Fix
data/lib/tasks/torna.rake CHANGED
@@ -6,6 +6,8 @@ namespace :torna do
6
6
  Rails.application.reload_routes!
7
7
  routes = Rails.application.routes.routes
8
8
 
9
+ author = ENV["AUTHOR"] || ""
10
+
9
11
  torna_apis = routes.map do |route|
10
12
  # {
11
13
  # "name": "获取商品信息",
@@ -163,13 +165,14 @@ namespace :torna do
163
165
  # "items": []
164
166
  # }
165
167
  {
166
- "name" => "#{route.verb} #{route.path.spec}",
168
+ "isFolder" => 0,
169
+ "isShow" => 1,
167
170
  "type" => 0,
171
+ "author" => author,
172
+ "name" => "#{route.verb} #{route.path.spec}",
168
173
  "url" => route.path.spec.to_s,
169
174
  "httpMethod" => route.verb.to_s,
170
175
  "contentType" => route.defaults[:format] || "application/json",
171
- "isFolder" => 0,
172
- "isShow" => 1,
173
176
  "pathParams" => route.path.required_names.map { |name| { "name" => name, "type" => "string" } }
174
177
  }
175
178
  end
@@ -180,6 +183,11 @@ namespace :torna do
180
183
 
181
184
  uri = URI.parse(ENV["TORNADO_URL"])
182
185
  access_token = ENV["TORNADO_ACCESS_TOKEN"]
186
+ git_url = ENV["GIT_URL"]
187
+ branch = ENV["GIT_BRANCH"]
188
+
189
+ is_replace = ENV["IS_REPLACE"] || "1"
190
+ is_override = ENV["IS_OVERRIDE"] || "0"
183
191
 
184
192
  raise "Please set TORNADO_URL and TORNADO_ACCESS_TOKEN" if uri.nil? || access_token.nil?
185
193
 
@@ -188,23 +196,32 @@ namespace :torna do
188
196
  data = {
189
197
  "debugEnvs" => [],
190
198
  "commonErrorCodes" => [],
191
- "isReplace" => 0,
192
- "isOverride" => 0,
199
+ "isReplace" => is_replace.to_i,
200
+ "isOverride" => is_override.to_i,
193
201
  "apis" => torna_apis
194
202
  }
195
203
 
204
+ data["gitUrl"] = git_url if git_url
205
+ data["moduleName"] = branch if branch
206
+
196
207
  request_body = {
197
208
  access_token: access_token,
198
209
  name: "doc.push",
199
210
  version: "1.0",
200
- data: URI.encode_www_form_component(data.to_json)
211
+ data: URI.encode_www_form_component(data.to_json),
212
+ timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S")
201
213
  }
202
214
 
203
- http = Net::HTTP.new(uri.host, uri.port)
215
+ # print request body
216
+ puts "========== Request:"
217
+ puts request_body.to_json
218
+ puts "=========="
219
+
204
220
  request = Net::HTTP::Post.new(uri.request_uri, header)
205
221
  request.body = request_body.to_json
206
-
207
- response = http.request(request)
222
+ response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
223
+ http.request(request)
224
+ end
208
225
 
209
226
  if response.code == "200"
210
227
  puts "Success: #{response.code} #{response.body}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TornaSdk
4
- VERSION = "0.1.5"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torna_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JustQyx
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-29 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: 2.6.6
146
+ version: 2.6.0
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - ">="