Class: Fastlane::Actions::GalaxyStoreDeveloperUploadAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb

Constant Summary collapse

PUB_SCOPE =
"publishing"

Class Method Summary collapse

Class Method Details

.authorsObject



52
53
54
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 52

def self.authors
  ["Rim Ganiev"]
end

.available_optionsObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 64

def self.available_options

  [
      FastlaneCore::ConfigItem.new(key: :sa_id,
                                   env_name: "GALAXY_STORE_DEVELOPER_SA_ID",
                                   description: "Service Account (SA) ID",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :key_path,
                                   env_name: "GALAXY_STORE_DEVELOPER_SA_KEY_PATH",
                                   description: "Path for the SA's private key (PEM)",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :file_path,
                                   env_name: "GALAXY_STORE_DEVELOPER_UPLOAD_FILE_PATH",
                                   description: "Path for the file to upload",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :app_id,
                                   env_name: "GALAXY_STORE_DEVELOPER_APP_ID",
                                   description: "Content ID of the app",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :changelog,
                                   description: "Changelog (4000 symbols max)",
                                   optional: true,
                                   default_value: "",
                                   type: String)
  ]
end

.descriptionObject



48
49
50
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 48

def self.description
  "Samsung Developer API integration - Uploading app's new version binary"
end

.detailsObject



60
61
62
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 60

def self.details
  "Fastlane plugin to interacting with Samsung Galaxy Store API"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
98
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 95

def self.is_supported?(platform)
  [:android].include?(platform)
  true
end

.return_valueObject



56
57
58
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 56

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fastlane/plugin/galaxy_store_developer/actions/galaxy_store_developer_upload.rb', line 10

def self.run(params)

  # FastlaneCore::PrintTable.print_values(
  #     config: params,
  #     title: "Summary for galaxy_store_developer #{GalaxyStoreDeveloper::VERSION}"
  # )

  accessToken = Helper::GalaxyStoreDeveloperHelper.get_access_token(params[:sa_id], PUB_SCOPE, params[:key_path])
  # is_valid_token = Helper::GalaxyStoreDeveloperHelper.validate_access_token(params[:sa_id], accessToken)
  # if is_valid_token
  #   UI.message "Valid"
  #   else UI.error "Invalid"
  # end
  sessionId = Helper::GalaxyStoreDeveloperHelper.create_upload_session(params[:sa_id], accessToken)

  fileKey = Helper::GalaxyStoreDeveloperHelper.upload_file(params[:sa_id], accessToken, sessionId, params[:file_path])

  newBinaryJSON =
      {
          contentId: "#{params[:app_id]}",
          defaultLanguageCode: "RUS",
          publicationType: "01",
          paid: "N",
          usExportLaws: "true",
          ageLimit: "12",
          newFeature: "#{params[:changelog]}",
          binaryList: [
              {
                  gms: "Y",
                  filekey: "#{fileKey}"
              }
          ]
      }.to_json

  Helper::GalaxyStoreDeveloperHelper.modify_app(params[:sa_id], accessToken, newBinaryJSON)

end