fastlane-plugin-rustore_developer 0.3.1 → 0.3.3

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: 4c395b2d1c3bc9975ac41c1c3af329160363d0cc14da5b134d76bc81c1323685
4
- data.tar.gz: afeee1b001b6819b0c0bc84e6bca475ee0b2cac2c5c80f8e2d523981a523477e
3
+ metadata.gz: 75f2a8ee857f51cd6a86b7bbc01676e6ae5c74a280712ada97a4d5ce6b90c2b5
4
+ data.tar.gz: d47d95eab1ba7085418cd6ed5c6c979a903d580cf2a71bfface9a73670d1a3df
5
5
  SHA512:
6
- metadata.gz: f31b22723ed762ee134f45e2c340ad4d66a21ae331705f5c0dac9cde6d585e30815029d16d40e78fbc90b0799491b39260ad7ecac9ada41f2b9a6d2fba753738
7
- data.tar.gz: ce59893ce3d290f2d7e5d52497bc7a7ce6e0b876647ded311dcc7b2b7d5e8da53795dd7a569a560357ca2f3a4fcdf174f499e48c49005d5a666295e70a353a01
6
+ metadata.gz: 9ac3f3720359ccf5af0cfad03f3e84eb8219355ca02d42de124bbd6fa651aee893dc6cf161f8c146a09b2d6a8ad2292953e65e097455fad60ab3ad5cfee4d041
7
+ data.tar.gz: acd73a0faf8ebf1735422694089f306d28b8c5e6c5296a78aa9ac3290c94aaddd00e58b7d50b0ac6850b1c1088b4ad107765ceeaa0a3efca5328f370506ee160
@@ -4,60 +4,72 @@ require_relative '../helper/rustore_developer_helper'
4
4
  module Fastlane
5
5
  module Actions
6
6
  class RustoreDeveloperStatusAction < Action
7
-
8
7
  def self.run(params)
9
8
  if params[:version].nil?
10
- massive = Helper::RustoreDeveloperHelper.getStatusAll(params[:token], params[:package])
11
- # puts(massive)
12
- exclude_cols = ['paid', 'priceValue', 'whatsNew', 'partialValue', 'sendDateForModer', 'publishDateTime',]
13
- col_labels = {versionId: "ID",
14
- appName: "Title",
15
- appType: "appType",
16
- versionName: "vName",
17
- versionCode: "vCode",
18
- versionStatus: "Status",
19
- publishType: 'publishType',
20
- publishDateTime: 'Published',
21
- sendDateForModer: 'Commited',
22
- partialValue: 'Part',
23
- whatsNew: 'whatsNew',
24
- priceValue: 'Price',
25
- paid: 'paid',
26
- }
27
- @columns = col_labels.each_with_object({}) { |(col, label), h|
28
- h[col] = {label: label,
29
- width: [[(massive.map { |g| g[col.to_s].to_s.size }.max), 30].min, label.size].max}
30
- }
31
-
32
- # header top line
33
- puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
34
- # header line
35
- puts "| #{@columns.map { |_, g| g[:label].to_s.ljust(g[:width]) }.join(' | ')} |"
36
- # # header bottom line
37
- puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
38
-
39
- # row line
40
- massive.each do |row|
41
- str = row.keys.map { |k|
42
- a = row[k]
43
- if a.to_s.size > 30 then
44
- a = a.to_s[0..26] + "..."
45
- end
46
- a.to_s.ljust(@columns[k.to_sym][:width])
47
- }.join(' | ')
48
- puts "| #{str} |"
49
- end
50
- # bottom line
51
- puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
9
+ data = Helper::RustoreDeveloperHelper.getStatusAll(params[:token], params[:package])
10
+ display(data, params[:table_view])
52
11
  else
53
- info = Helper::RustoreDeveloperHelper.getStatus(params[:token], params[:package], params[:version])
54
- puts(info)
12
+ data = Helper::RustoreDeveloperHelper.getStatus(params[:token], params[:package], params[:version])
13
+ display(data, params[:table_view])
14
+ # puts(data)
55
15
  end
16
+ end
56
17
 
18
+ def self.display(data, table_view)
19
+ if table_view
20
+ # puts(data)
21
+ exclude_cols = ['paid', 'priceValue', 'whatsNew', 'partialValue', 'sendDateForModer', 'publishDateTime', 'testingType']
22
+ col_labels = { versionId: "ID",
23
+ appName: "Title",
24
+ appType: "AppType",
25
+ versionName: "vName",
26
+ versionCode: "vCode",
27
+ versionStatus: "Status",
28
+ publishType: 'PublishType',
29
+ publishDateTime: 'Published',
30
+ sendDateForModer: 'Commited',
31
+ partialValue: 'Part',
32
+ whatsNew: 'Changelog',
33
+ priceValue: 'Price',
34
+ paid: 'Paid' }
35
+
36
+ @columns = col_labels.each_with_object({}) do |(col, label), h|
37
+ h[col] = { label: label,
38
+ width: [[data.map { |g| g[col.to_s].to_s.size }.max, 30].min, label.size].max }
39
+ end
40
+
41
+ # header top line
42
+ puts("+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+")
43
+ # header line
44
+ puts("| #{@columns.map { |_, g| g[:label].to_s.ljust(g[:width]) }.join(' | ')} |")
45
+ # # header bottom line
46
+ puts("+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+")
47
+
48
+ # row line
49
+ data.each do |row|
50
+ str = row.keys.map do |k|
51
+ a = row[k]
52
+ if a.to_s.size > 30
53
+ a = "#{a.to_s[0..26]}..."
54
+ end
55
+ if a
56
+ # if @columns[k.to_sym]
57
+ a.to_s.ljust(@columns[k.to_sym][:width])
58
+ else
59
+ a.to_s
60
+ end
61
+ end.join(' | ')
62
+ puts("| #{str} |")
63
+ end
64
+ # bottom line
65
+ puts("+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+")
66
+ else
67
+ puts(data)
68
+ end
57
69
  end
58
70
 
59
71
  def self.description
60
- "RUSTORE: Get app versions statuses"
72
+ "RUSTORE: Get app statuses for the last 100 versions"
61
73
  end
62
74
 
63
75
  def self.authors
@@ -85,6 +97,12 @@ module Fastlane
85
97
  optional: true,
86
98
  type: String,
87
99
  default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_DRAFT_VERSION]),
100
+ FastlaneCore::ConfigItem.new(key: :table_view,
101
+ env_name: "RUSTORE_TABLE_VIEW",
102
+ description: "Show result in a tabular format",
103
+ optional: true,
104
+ type: Boolean,
105
+ default_value: false),
88
106
  FastlaneCore::ConfigItem.new(key: :token,
89
107
  description: "Access token",
90
108
  optional: false,
@@ -2,15 +2,14 @@ require 'fastlane_core/ui/ui'
2
2
  require "base64"
3
3
 
4
4
  module Fastlane
5
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
6
6
 
7
7
  module Helper
8
8
  class RustoreDeveloperHelper
9
-
10
9
  BASE_URL = 'https://public-api.rustore.ru'
11
10
 
12
- def self.getTimestamp()
13
- return DateTime.now.to_s()
11
+ def self.getTimestamp
12
+ return DateTime.now.to_s
14
13
  # return '2023-08-23T09:00:32.939+03:00'
15
14
  end
16
15
 
@@ -24,14 +23,14 @@ module Fastlane
24
23
 
25
24
  def self.getAccessToken(key_id, key_path)
26
25
  UI.important("Getting access token ...")
27
- timestamp = getTimestamp()
26
+ timestamp = getTimestamp
28
27
  sign = getSignatureEncoded(key_id, timestamp, key_path)
29
28
  uri = URI(BASE_URL + '/public/auth/')
30
29
  http = Net::HTTP.new(uri.host, uri.port)
31
30
  http.use_ssl = true
32
31
  req = Net::HTTP::Post.new(uri.path)
33
32
  req["Content-Type"] = "application/json"
34
- data = {'keyId': key_id, 'timestamp': timestamp, 'signature': sign}
33
+ data = { keyId: key_id, timestamp: timestamp, signature: sign }
35
34
  req.body = data.to_json
36
35
  res = http.request(req)
37
36
  result_json = JSON.parse(res.body)
@@ -40,8 +39,8 @@ module Fastlane
40
39
  if token.nil?
41
40
  UI.error("Cannot retrieve access token, please check your credentials.\n#{result_json['message']}")
42
41
  else
43
- UI.success 'Got access token'
44
- # UI.message token
42
+ UI.success('Got access token')
43
+ UI.message(token)
45
44
  end
46
45
 
47
46
  return token
@@ -50,13 +49,13 @@ module Fastlane
50
49
  def self.createVersion(token, package_name, publish_type = 'INSTANTLY', app_type = 'MAIN', whats_new)
51
50
  UI.important("Creating draft version of '#{package_name}' ...")
52
51
  uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version")
53
- p uri
52
+ # p uri
54
53
  http = Net::HTTP.new(uri.host, uri.port)
55
54
  http.use_ssl = true
56
55
  req = Net::HTTP::Post.new(uri.path)
57
56
  req["Content-Type"] = "application/json"
58
57
  req["Public-Token"] = token
59
- data = {'publishType': publish_type, 'appType': app_type, 'whatsNew': whats_new}
58
+ data = { publishType: publish_type, appType: app_type, whatsNew: whats_new }
60
59
  req.body = data.to_json
61
60
  # puts req.body
62
61
  res = http.request(req)
@@ -64,9 +63,9 @@ module Fastlane
64
63
  result_json = JSON.parse(res.body)
65
64
  version = result_json['body'] if result_json['code'] == 'OK'
66
65
  if version.nil?
67
- UI.error("#{result_json['message']}")
66
+ UI.error((result_json['message']).to_s)
68
67
  else
69
- UI.success "Created new version: #{version}"
68
+ UI.success("Created new version: #{version}")
70
69
  end
71
70
  return version
72
71
  end
@@ -74,7 +73,7 @@ module Fastlane
74
73
  def self.deleteDraft(token, package_name, version_id)
75
74
  UI.important("Deleting draft version #{version_id} ...")
76
75
  uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}")
77
- p uri
76
+ # p uri
78
77
  http = Net::HTTP.new(uri.host, uri.port)
79
78
  http.use_ssl = true
80
79
  req = Net::HTTP::Delete.new(uri.path)
@@ -82,31 +81,33 @@ module Fastlane
82
81
  req["Content-Type"] = "application/json"
83
82
  res = http.request(req)
84
83
  result_json = JSON.parse(res.body)
85
- if result_json['code'] != 'OK'
86
- UI.error("#{result_json['message']}")
87
- return false
88
- else
89
- UI.success "Successfully deleted"
84
+ if result_json['code'] == 'OK'
85
+ UI.success("Successfully deleted")
90
86
  return true
87
+ else
88
+ UI.error((result_json['message']).to_s)
89
+ return false
91
90
  end
92
91
  end
93
92
 
94
93
  def self.getStatus(token, package_name, version_id, page = 0, size = 10)
95
94
  # METHOD_URL = BASE_URL + "/public/v1/application/#{package_name}/version"
95
+ p(size)
96
96
  if version_id.nil?
97
97
  UI.important("Getting status of \'#{package_name}\' versions on page #{page} ...")
98
98
  uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version?page=#{page}&size=#{size}")
99
99
  else
100
100
  UI.important("Getting status of \'#{package_name}\' version #{version_id} ...")
101
- uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version?id=#{version_id}")
101
+ uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version?ids=#{version_id}")
102
102
  end
103
- p uri
103
+ # p(uri)
104
104
  http = Net::HTTP.new(uri.host, uri.port)
105
105
  http.use_ssl = true
106
- req = Net::HTTP::Get.new(uri.path)
106
+ req = Net::HTTP::Get.new(uri)
107
107
  req["Public-Token"] = token
108
- req["Content-Type"] = "application/json"
108
+ req["Accept"] = "application/json"
109
109
  res = http.request(req)
110
+ p(req)
110
111
  result_json = JSON.parse(res.body)
111
112
  if result_json['code'] == 'OK'
112
113
  content = result_json['body']['content']
@@ -115,12 +116,12 @@ module Fastlane
115
116
  end
116
117
 
117
118
  if content.nil?
118
- UI.error("#{result_json['message']}")
119
+ UI.error((result_json['message']).to_s)
119
120
  else
120
121
  if version_id.nil?
121
- UI.success "Got #{totalVersions} versions in #{totalPages} pages"
122
+ UI.success("Got #{totalVersions} versions in #{totalPages} pages")
122
123
  else
123
- UI.success "Got version info"
124
+ UI.success("Got version info")
124
125
  end
125
126
  end
126
127
 
@@ -135,21 +136,21 @@ module Fastlane
135
136
  UI.important("Uploading APK #{apk_path} ...")
136
137
  # uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}/apk?isMainApk=#{is_main}&servicesType=#{service_type}")
137
138
  uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}/apk")
138
- p uri
139
+ # p uri
139
140
  http = Net::HTTP.new(uri.host, uri.port)
140
141
  http.use_ssl = true
141
142
  req = Net::HTTP::Post.new(uri.path)
142
143
  req["Public-Token"] = token
143
144
  req.set_content_type("multipart/form-data")
144
- req.set_form([['file', File.open(apk_path)],['isMainApk', is_main.to_s],['servicesType', service_type]], 'multipart/form-data')
145
+ req.set_form([['file', File.open(apk_path)], ['isMainApk', is_main.to_s], ['servicesType', service_type]], 'multipart/form-data')
145
146
  res = http.request(req)
146
147
  result_json = JSON.parse(res.body)
147
- if result_json['code'] != 'OK'
148
- UI.error("#{result_json['message']}")
149
- return false
150
- else
151
- UI.success "APK uploaded"
148
+ if result_json['code'] == 'OK'
149
+ UI.success("APK uploaded")
152
150
  return true
151
+ else
152
+ UI.error((result_json['message']).to_s)
153
+ return false
153
154
  end
154
155
  end
155
156
 
@@ -160,16 +161,16 @@ module Fastlane
160
161
  http.use_ssl = true
161
162
  req = Net::HTTP::Post.new(uri.path)
162
163
  req["Public-Token"] = token
163
- puts req.body
164
+ puts(req.body)
164
165
  res = http.request(req)
165
- puts res.body
166
+ puts(res.body)
166
167
  result_json = JSON.parse(res.body)
167
- if result_json['code'] != 'OK'
168
- UI.error("#{result_json['message']}")
169
- return false
170
- else
171
- UI.success "Successfully committed"
168
+ if result_json['code'] == 'OK'
169
+ UI.success("Successfully committed")
172
170
  return true
171
+ else
172
+ UI.error((result_json['message']).to_s)
173
+ return false
173
174
  end
174
175
  end
175
176
 
@@ -180,19 +181,18 @@ module Fastlane
180
181
  http.use_ssl = true
181
182
  req = Net::HTTP::Post.new(uri.path)
182
183
  req["Public-Token"] = token
183
- puts req.body
184
+ puts(req.body)
184
185
  res = http.request(req)
185
- puts res.body
186
+ puts(res.body)
186
187
  result_json = JSON.parse(res.body)
187
- if result_json['code'] != 'OK'
188
- return false
189
- UI.error("#{result_json['message']}")
190
- else
191
- UI.success "Successfully published"
188
+ if result_json['code'] == 'OK'
189
+ UI.success("Successfully published")
192
190
  return true
191
+ else
192
+ return false
193
+ UI.error((result_json['message']).to_s)
193
194
  end
194
195
  end
195
196
  end
196
-
197
197
  end
198
198
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module RustoreDeveloper
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-rustore_developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - RimiX2
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -150,7 +149,6 @@ dependencies:
150
149
  - - ">="
151
150
  - !ruby/object:Gem::Version
152
151
  version: '0'
153
- description:
154
152
  email: cj_rimix@rambler.ru
155
153
  executables: []
156
154
  extensions: []
@@ -168,11 +166,9 @@ files:
168
166
  - lib/fastlane/plugin/rustore_developer/actions/rustore_developer_upload_action.rb
169
167
  - lib/fastlane/plugin/rustore_developer/helper/rustore_developer_helper.rb
170
168
  - lib/fastlane/plugin/rustore_developer/version.rb
171
- homepage:
172
169
  licenses:
173
170
  - MIT
174
171
  metadata: {}
175
- post_install_message:
176
172
  rdoc_options: []
177
173
  require_paths:
178
174
  - lib
@@ -187,8 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
183
  - !ruby/object:Gem::Version
188
184
  version: '0'
189
185
  requirements: []
190
- rubygems_version: 3.4.19
191
- signing_key:
186
+ rubygems_version: 3.6.8
192
187
  specification_version: 4
193
188
  summary: RUSTORE beta API integration plugin
194
189
  test_files: []