fastlane-plugin-galaxy_store_developer 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_info.rb +61 -0
- data/lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_list.rb +75 -0
- data/lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_submit.rb +60 -0
- data/lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb +101 -0
- data/lib/fastlane/plugin/galaxy_store_developer/helper/galaxy_store_developer_helper.rb +197 -0
- data/lib/fastlane/plugin/galaxy_store_developer/version.rb +5 -0
- data/lib/fastlane/plugin/galaxy_store_developer.rb +16 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f91a33763252f7dfb6a7d339825891085aececa003eadf2b3c6536a82b48719a
|
4
|
+
data.tar.gz: 3b0318083ca3f5919968e651827718e8357d7f488b7679c2d54c72bc03f4f0b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd722e02e52d5e8df7d275c8352c14d262b7bf5e947fc170711f189080245afd1f47afefbf2c386680145726a7040b523a8d3c41f8d57d4f44207fb64969c540
|
7
|
+
data.tar.gz: f18022c378169e95edbf93c8793c75dfc1c7994805af8e70930f9116999a975b8d66ad016fc12d732d300c74b382621bf4fbb312ac482fb4cd3026457e40653b
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Рим Ганиев <r_ganiev@inbox.ru>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# galaxy_store_developer plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-galaxy_store_developer)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-galaxy_store_developer`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin galaxy_store_developer
|
11
|
+
```
|
12
|
+
|
13
|
+
## About galaxy_store_developer
|
14
|
+
|
15
|
+
Samsung's "Galaxy Store Developer API" integration based on official documentation available on: https://developer.samsung.com/galaxy-store/galaxy-store-developer-api/content-publish-api.html
|
16
|
+
|
17
|
+
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
22
|
+
|
23
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
24
|
+
|
25
|
+
## Run tests for this plugin
|
26
|
+
|
27
|
+
To run both the tests, and code style validation, run
|
28
|
+
|
29
|
+
```
|
30
|
+
rake
|
31
|
+
```
|
32
|
+
|
33
|
+
To automatically fix many of the styling issues, use
|
34
|
+
```
|
35
|
+
rubocop -a
|
36
|
+
```
|
37
|
+
|
38
|
+
## Issues and Feedback
|
39
|
+
|
40
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
41
|
+
|
42
|
+
## Troubleshooting
|
43
|
+
|
44
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
45
|
+
|
46
|
+
## Using _fastlane_ Plugins
|
47
|
+
|
48
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
49
|
+
|
50
|
+
## About _fastlane_
|
51
|
+
|
52
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/galaxy_store_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class GalaxyStoreDeveloperInfoAction < Action
|
7
|
+
|
8
|
+
PUB_SCOPE = "publishing"
|
9
|
+
|
10
|
+
def self.run(params)
|
11
|
+
|
12
|
+
accessToken = Helper::GalaxyStoreDeveloperHelper.get_access_token(params[:sa_id], PUB_SCOPE, params[:key_path])
|
13
|
+
|
14
|
+
response = Helper::GalaxyStoreDeveloperHelper.get_app_info(params[:sa_id], accessToken, params[:app_id])
|
15
|
+
puts JSON.pretty_generate(response)
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.description
|
20
|
+
"Samsung Developer API integration - Getting app info"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.authors
|
24
|
+
["Rim Ganiev"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.return_value
|
28
|
+
# If your method provides a return value, you can describe here what it does
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.details
|
32
|
+
"Fastlane plugin to interacting with Samsung Galaxy Store API"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :sa_id,
|
38
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_ID",
|
39
|
+
description: "Service Account (SA) ID",
|
40
|
+
optional: false,
|
41
|
+
type: String),
|
42
|
+
FastlaneCore::ConfigItem.new(key: :key_path,
|
43
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_KEY_PATH",
|
44
|
+
description: "Path for the SA's private key (PEM)",
|
45
|
+
optional: false,
|
46
|
+
type: String),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :app_id,
|
48
|
+
env_name: "GALAXY_STORE_DEVELOPER_APP_ID",
|
49
|
+
description: "Content ID of the app",
|
50
|
+
optional: false,
|
51
|
+
type: String)
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.is_supported?(platform)
|
56
|
+
[:android].include?(platform)
|
57
|
+
true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/galaxy_store_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class GalaxyStoreDeveloperListAction < Action
|
7
|
+
|
8
|
+
PUB_SCOPE = "publishing"
|
9
|
+
|
10
|
+
def self.run(params)
|
11
|
+
|
12
|
+
accessToken = Helper::GalaxyStoreDeveloperHelper.get_access_token(params[:sa_id], PUB_SCOPE, params[:key_path])
|
13
|
+
|
14
|
+
responseJSON = Helper::GalaxyStoreDeveloperHelper.get_apps_list(params[:sa_id], accessToken)
|
15
|
+
|
16
|
+
puts JSON.pretty_generate(responseJSON)
|
17
|
+
|
18
|
+
# hah = Hash.new { |h, k| h[k] = "" }
|
19
|
+
|
20
|
+
col_labels = {contentName: "Title", contentId: "ID", contentStatus: "Status", standardPrice: "Price", paid: "Paid", modifyDate: "Date"}
|
21
|
+
@columns = col_labels.each_with_object({}) { |(col, label), h|
|
22
|
+
h[col] = {label: label,
|
23
|
+
width: [responseJSON.map { |g| g[col.to_s].size }.max, label.size].max }
|
24
|
+
# width: 30}
|
25
|
+
}
|
26
|
+
|
27
|
+
puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
|
28
|
+
puts "| #{@columns.map { |_, g| g[:label].ljust(g[:width]) }.join(' | ')} |"
|
29
|
+
puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
|
30
|
+
responseJSON.each do |item|
|
31
|
+
str = item.keys.map { |k| item[k].ljust(@columns[k.to_sym][:width]) }.join(' | ')
|
32
|
+
puts "| #{str} |"
|
33
|
+
end
|
34
|
+
puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.description
|
39
|
+
"Samsung Developer API integration - Listing apps"
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.authors
|
43
|
+
["Rim Ganiev"]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.return_value
|
47
|
+
# If your method provides a return value, you can describe here what it does
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.details
|
51
|
+
"Fastlane plugin to interacting with Samsung Galaxy Store API"
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.available_options
|
55
|
+
[
|
56
|
+
FastlaneCore::ConfigItem.new(key: :sa_id,
|
57
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_ID",
|
58
|
+
description: "Service Account (SA) ID",
|
59
|
+
optional: false,
|
60
|
+
type: String),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :key_path,
|
62
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_KEY_PATH",
|
63
|
+
description: "Path for the SA's private key (PEM)",
|
64
|
+
optional: false,
|
65
|
+
type: String)
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.is_supported?(platform)
|
70
|
+
[:android].include?(platform)
|
71
|
+
true
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/galaxy_store_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class GalaxyStoreDeveloperSubmitAction < Action
|
7
|
+
|
8
|
+
PUB_SCOPE = "publishing"
|
9
|
+
|
10
|
+
def self.run(params)
|
11
|
+
|
12
|
+
accessToken = Helper::GalaxyStoreDeveloperHelper.get_access_token(params[:sa_id], PUB_SCOPE, params[:key_path])
|
13
|
+
|
14
|
+
Helper::GalaxyStoreDeveloperHelper.submit_app(params[:sa_id], accessToken, params[:app_id])
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.description
|
19
|
+
"Samsung Developer API integration - Submitting app for review"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.authors
|
23
|
+
["Rim Ganiev"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.return_value
|
27
|
+
# If your method provides a return value, you can describe here what it does
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.details
|
31
|
+
"Fastlane plugin to interacting with Samsung Galaxy Store API"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.available_options
|
35
|
+
[
|
36
|
+
FastlaneCore::ConfigItem.new(key: :sa_id,
|
37
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_ID",
|
38
|
+
description: "Service Account (SA) ID",
|
39
|
+
optional: false,
|
40
|
+
type: String),
|
41
|
+
FastlaneCore::ConfigItem.new(key: :key_path,
|
42
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_KEY_PATH",
|
43
|
+
description: "Path for the SA's private key (PEM)",
|
44
|
+
optional: false,
|
45
|
+
type: String),
|
46
|
+
FastlaneCore::ConfigItem.new(key: :app_id,
|
47
|
+
env_name: "GALAXY_STORE_DEVELOPER_APP_ID",
|
48
|
+
description: "Developer's application ID",
|
49
|
+
optional: false,
|
50
|
+
type: String)
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.is_supported?(platform)
|
55
|
+
[:android].include?(platform)
|
56
|
+
true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/galaxy_store_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class GalaxyStoreDeveloperUploadAction < Action
|
7
|
+
|
8
|
+
PUB_SCOPE = "publishing"
|
9
|
+
|
10
|
+
def self.run(params)
|
11
|
+
|
12
|
+
# FastlaneCore::PrintTable.print_values(
|
13
|
+
# config: params,
|
14
|
+
# title: "Summary for galaxy_store_developer #{GalaxyStoreDeveloper::VERSION}"
|
15
|
+
# )
|
16
|
+
|
17
|
+
accessToken = Helper::GalaxyStoreDeveloperHelper.get_access_token(params[:sa_id], PUB_SCOPE, params[:key_path])
|
18
|
+
# is_valid_token = Helper::GalaxyStoreDeveloperHelper.validate_access_token(params[:sa_id], accessToken)
|
19
|
+
# if is_valid_token
|
20
|
+
# UI.message "Valid"
|
21
|
+
# else UI.error "Invalid"
|
22
|
+
# end
|
23
|
+
sessionId = Helper::GalaxyStoreDeveloperHelper.create_upload_session(params[:sa_id], accessToken)
|
24
|
+
|
25
|
+
fileKey = Helper::GalaxyStoreDeveloperHelper.upload_file(params[:sa_id], accessToken, sessionId, params[:file_path])
|
26
|
+
|
27
|
+
newBinaryJSON =
|
28
|
+
{
|
29
|
+
contentId: "#{params[:app_id]}",
|
30
|
+
defaultLanguageCode: "RUS",
|
31
|
+
publicationType: "01",
|
32
|
+
paid: "N",
|
33
|
+
usExportLaws: "true",
|
34
|
+
ageLimit: "12",
|
35
|
+
newFeature: "#{params[:changelog]}",
|
36
|
+
binaryList: [
|
37
|
+
{
|
38
|
+
gms: "Y",
|
39
|
+
filekey: "#{fileKey}"
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}.to_json
|
43
|
+
|
44
|
+
Helper::GalaxyStoreDeveloperHelper.modify_app(params[:sa_id], accessToken, newBinaryJSON)
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.description
|
49
|
+
"Samsung Developer API integration - Uploading app's new version binary"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.authors
|
53
|
+
["Rim Ganiev"]
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.return_value
|
57
|
+
# If your method provides a return value, you can describe here what it does
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.details
|
61
|
+
"Fastlane plugin to interacting with Samsung Galaxy Store API"
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.available_options
|
65
|
+
|
66
|
+
[
|
67
|
+
FastlaneCore::ConfigItem.new(key: :sa_id,
|
68
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_ID",
|
69
|
+
description: "Service Account (SA) ID",
|
70
|
+
optional: false,
|
71
|
+
type: String),
|
72
|
+
FastlaneCore::ConfigItem.new(key: :key_path,
|
73
|
+
env_name: "GALAXY_STORE_DEVELOPER_SA_KEY_PATH",
|
74
|
+
description: "Path for the SA's private key (PEM)",
|
75
|
+
optional: false,
|
76
|
+
type: String),
|
77
|
+
FastlaneCore::ConfigItem.new(key: :file_path,
|
78
|
+
env_name: "GALAXY_STORE_DEVELOPER_UPLOAD_FILE_PATH",
|
79
|
+
description: "Path for the file to upload",
|
80
|
+
optional: false,
|
81
|
+
type: String),
|
82
|
+
FastlaneCore::ConfigItem.new(key: :app_id,
|
83
|
+
env_name: "GALAXY_STORE_DEVELOPER_APP_ID",
|
84
|
+
description: "Content ID of the app",
|
85
|
+
optional: false,
|
86
|
+
type: String),
|
87
|
+
FastlaneCore::ConfigItem.new(key: :changelog,
|
88
|
+
description: "Changelog (4000 symbols max)",
|
89
|
+
optional: true,
|
90
|
+
default_value: "",
|
91
|
+
type: String)
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.is_supported?(platform)
|
96
|
+
[:android].include?(platform)
|
97
|
+
true
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
require "base64"
|
3
|
+
require "jwt"
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
7
|
+
|
8
|
+
module Helper
|
9
|
+
class GalaxyStoreDeveloperHelper
|
10
|
+
|
11
|
+
BASE_URL = 'https://devapi.samsungapps.com'
|
12
|
+
|
13
|
+
private_class_method def self.generate_jwt(scope, key_path, service_account_id)
|
14
|
+
private_key = OpenSSL::PKey.read(File.read(key_path))
|
15
|
+
now_time = Time.now.to_i
|
16
|
+
token = JWT.encode({
|
17
|
+
iss: service_account_id,
|
18
|
+
iat: now_time,
|
19
|
+
exp: now_time + 20 * 60,
|
20
|
+
scopes: ["#{scope}"]
|
21
|
+
},
|
22
|
+
private_key,
|
23
|
+
"RS256",
|
24
|
+
header_fields = {
|
25
|
+
alg: "RS256",
|
26
|
+
typ: "JWT"
|
27
|
+
}
|
28
|
+
)
|
29
|
+
return token
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.get_access_token(service_account_id, scope, key_path)
|
33
|
+
jwt = generate_jwt(scope, key_path, service_account_id)
|
34
|
+
UI.important("Getting access token ...")
|
35
|
+
|
36
|
+
uri = URI(BASE_URL + '/auth/accessToken')
|
37
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
38
|
+
http.use_ssl = true
|
39
|
+
req = Net::HTTP::Post.new(uri.path, {'Authorization' => "Bearer #{jwt}"})
|
40
|
+
res = http.request(req)
|
41
|
+
|
42
|
+
result_json = JSON.parse(res.body)
|
43
|
+
token = result_json['createdItem']['accessToken']
|
44
|
+
if token.nil?
|
45
|
+
UI.error("Cannot retrieve access token, please check your credentials")
|
46
|
+
else
|
47
|
+
UI.success 'Access token generated'
|
48
|
+
# UI.message token
|
49
|
+
end
|
50
|
+
return token
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.is_token_valid?(service_account_id, access_token)
|
55
|
+
UI.message("Validating access token ...")
|
56
|
+
|
57
|
+
uri = URI(BASE_URL + '/auth/checkAccessToken')
|
58
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
59
|
+
http.use_ssl = true
|
60
|
+
req = Net::HTTP::Get.new(uri.path)
|
61
|
+
req["Authorization"] = "Bearer #{access_token}"
|
62
|
+
req["service-account-id"] = service_account_id
|
63
|
+
res = http.request(req)
|
64
|
+
|
65
|
+
result_json = JSON.parse(res.body)
|
66
|
+
return result_json['ok']
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.get_apps_list(service_account_id, access_token)
|
70
|
+
UI.message("Listing all apps on the account ...")
|
71
|
+
|
72
|
+
uri = URI(BASE_URL + '/seller/contentList')
|
73
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
74
|
+
http.use_ssl = true
|
75
|
+
req = Net::HTTP::Get.new(uri.path)
|
76
|
+
req["Authorization"] = "Bearer #{access_token}"
|
77
|
+
req["service-account-id"] = service_account_id
|
78
|
+
res = http.request(req)
|
79
|
+
UI.success 'Listing done' if res.code == '200'
|
80
|
+
result_json = JSON.parse(res.body)
|
81
|
+
return result_json
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.get_app_info(service_account_id, access_token, content_id)
|
85
|
+
UI.message("Getting info of the app ...")
|
86
|
+
|
87
|
+
uri = URI(BASE_URL + '/seller/contentInfo')
|
88
|
+
params = {:contentId => content_id}
|
89
|
+
uri.query = URI.encode_www_form(params)
|
90
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
91
|
+
http.use_ssl = true
|
92
|
+
req = Net::HTTP::Get.new(uri)
|
93
|
+
req["Authorization"] = "Bearer #{access_token}"
|
94
|
+
req["service-account-id"] = service_account_id
|
95
|
+
res = http.request(req)
|
96
|
+
|
97
|
+
result_json = JSON.parse(res.body)
|
98
|
+
return result_json
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.create_upload_session(service_account_id, access_token)
|
102
|
+
UI.message("Creating upload session ...")
|
103
|
+
|
104
|
+
|
105
|
+
uri = URI(BASE_URL + '/seller/createUploadSessionId')
|
106
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
107
|
+
http.use_ssl = true
|
108
|
+
|
109
|
+
req = Net::HTTP::Post.new(uri.path)
|
110
|
+
req['Authorization'] = "Bearer #{access_token}"
|
111
|
+
req['service-account-id'] = "#{service_account_id}"
|
112
|
+
res = http.request(req)
|
113
|
+
|
114
|
+
result_json = JSON.parse(res.body)
|
115
|
+
session_id = result_json['sessionId']
|
116
|
+
UI.error("Failed") if session_id.nil?
|
117
|
+
|
118
|
+
return session_id
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.upload_file(service_account_id, access_token, session_id, file_path)
|
123
|
+
UI.message("Uploading file ...")
|
124
|
+
|
125
|
+
uri = URI('https://seller.samsungapps.com/galaxyapi/fileUpload')
|
126
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
127
|
+
http.use_ssl = true
|
128
|
+
req = Net::HTTP::Post.new(uri.path)
|
129
|
+
req['Authorization'] = "Bearer #{access_token}"
|
130
|
+
req['service-account-id'] = "#{service_account_id}"
|
131
|
+
req.set_content_type("multipart/form-data")
|
132
|
+
req.set_form([['file', File.open(file_path)], ['sessionId', session_id]], 'multipart/form-data')
|
133
|
+
res = http.request(req)
|
134
|
+
result_json = JSON.parse(res.body)
|
135
|
+
|
136
|
+
file_key = result_json['fileKey']
|
137
|
+
if file_key.nil?
|
138
|
+
UI.error("Upload failed")
|
139
|
+
UI.error(result_json['errorCode'])
|
140
|
+
UI.error(result_json['errorMsg'])
|
141
|
+
else
|
142
|
+
UI.success 'File uploaded'
|
143
|
+
end
|
144
|
+
|
145
|
+
return file_key
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
# register binary
|
150
|
+
def self.modify_app(service_account_id, access_token, json_body)
|
151
|
+
UI.message("Modifying app ...")
|
152
|
+
|
153
|
+
uri = URI(BASE_URL + '/seller/contentUpdate')
|
154
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
155
|
+
http.use_ssl = true
|
156
|
+
req = Net::HTTP::Post.new(uri.path)
|
157
|
+
req['Authorization'] = "Bearer #{access_token}"
|
158
|
+
req['service-account-id'] = "#{service_account_id}"
|
159
|
+
req.set_content_type("application/json")
|
160
|
+
req.body = json_body
|
161
|
+
res = http.request(req)
|
162
|
+
result_json = JSON.parse(res.body)
|
163
|
+
if result_json['contentStatus'] == 'REGISTERING'
|
164
|
+
UI.success 'App modified'
|
165
|
+
else
|
166
|
+
UI.error("Modification failed")
|
167
|
+
UI.error(result_json['errorCode'])
|
168
|
+
UI.error(result_json['errorMsg'])
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
# Apps must be in the REGISTERING state before they can be submitted.
|
174
|
+
def self.submit_app(service_account_id, access_token, content_id)
|
175
|
+
UI.important("Submitting app for review ...")
|
176
|
+
|
177
|
+
uri = URI(BASE_URL + '/seller/contentSubmit')
|
178
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
179
|
+
http.use_ssl = true
|
180
|
+
req = Net::HTTP::Post.new(uri.path)
|
181
|
+
req['Authorization'] = "Bearer #{access_token}"
|
182
|
+
req['service-account-id'] = "#{service_account_id}"
|
183
|
+
req.set_content_type("application/json")
|
184
|
+
req.body = {contentId: "#{content_id}"}.to_json
|
185
|
+
res = http.request(req)
|
186
|
+
if res.code == '204'
|
187
|
+
UI.success "App submitted"
|
188
|
+
else
|
189
|
+
UI.error 'App submission failed'
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/galaxy_store_developer/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module GalaxyStoreDeveloper
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::GalaxyStoreDeveloper.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-galaxy_store_developer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Рим Ганиев
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fastlane
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.211.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.211.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec_junit_formatter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.12.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.12.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-performance
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-require_tools
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description:
|
154
|
+
email: r_ganiev@inbox.ru
|
155
|
+
executables: []
|
156
|
+
extensions: []
|
157
|
+
extra_rdoc_files: []
|
158
|
+
files:
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- lib/fastlane/plugin/galaxy_store_developer.rb
|
162
|
+
- lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_info.rb
|
163
|
+
- lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_list.rb
|
164
|
+
- lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_submit.rb
|
165
|
+
- lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb
|
166
|
+
- lib/fastlane/plugin/galaxy_store_developer/helper/galaxy_store_developer_helper.rb
|
167
|
+
- lib/fastlane/plugin/galaxy_store_developer/version.rb
|
168
|
+
homepage:
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '2.6'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubygems_version: 3.1.6
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: Samsung Galaxy Store integration
|
191
|
+
test_files: []
|