fastlane-plugin-airwatch_workspaceone 2.0.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,9 +8,138 @@ module Fastlane
8
8
  # class methods that you define here become available in your action
9
9
  # as `Helper::AirwatchWorkspaceoneHelper.your_method`
10
10
  #
11
+
12
+ APP_VERSIONS_LIST_SUFFIX = "/API/mam/apps/search?applicationtype=Internal&includeAppsFromChildOgs=false&IncludeAppsFromParentOgs=false&bundleid=%s&locationgroupid=%d"
13
+ INTERNAL_APP_DELETE_SUFFIX = "/API/mam/apps/internal/%d"
14
+ INTERNAL_APP_RETIRE_SUFFIX = "/API/mam/apps/internal/%d/retire"
15
+ INTERNAL_APP_UNRETIRE_SUFFIX = "/API/mam/apps/internal/%d/unretire"
16
+
11
17
  def self.show_message
12
18
  UI.message("Hello from the airwatch_workspaceone plugin helper!")
13
19
  end
20
+
21
+ def self.construct_app_version(app)
22
+ app_version = Hash.new
23
+ app_version['Id'] = app['Id']['Value']
24
+ app_version['Version'] = app['AppVersion']
25
+ return app_version
26
+ end
27
+
28
+ def self.find_app_versions(app_identifier, app_status, host_url, aw_tenant_code, b64_encoded_auth, locationGrpId, debug)
29
+ # get the list of apps
30
+ apps = list_app_versions(app_identifier, host_url, aw_tenant_code, b64_encoded_auth, locationGrpId, debug)
31
+ app_versions = Array.new
32
+
33
+ apps['Application'].each do |app|
34
+
35
+ case app_status
36
+ when 'Active'
37
+ if app['Status'] == "Active"
38
+ app_version = construct_app_version(app)
39
+ app_versions << app_version
40
+ end
41
+
42
+ when 'Retired'
43
+ if app['Status'] == "Retired"
44
+ app_version = construct_app_version(app)
45
+ app_versions << app_version
46
+ end
47
+
48
+ else
49
+ app_version = construct_app_version(app)
50
+ app_versions << app_version
51
+ end
52
+ end
53
+
54
+ app_versions.sort_by! { |app_version| app_version["Id"] }
55
+ return app_versions
56
+ end
57
+
58
+ def self.list_app_versions(app_identifier, host_url, aw_tenant_code, b64_encoded_auth, locationGrpId, debug)
59
+ require 'rest-client'
60
+ require 'json'
61
+
62
+ response = RestClient.get(host_url + APP_VERSIONS_LIST_SUFFIX % [app_identifier, locationGrpId], {accept: :json, 'aw-tenant-code': aw_tenant_code, 'Authorization': "Basic " + b64_encoded_auth})
63
+
64
+ if debug
65
+ UI.message("Response code: %d" % [response.code])
66
+ UI.message("Response body:")
67
+ UI.message(JSON.pretty_generate(response.body))
68
+ end
69
+
70
+ if response.code != 200
71
+ UI.user_error!("There was an error in finding app versions. One possible reason is that an app with the bundle identifier given does not exist on Console.")
72
+ exit
73
+ end
74
+
75
+ json = JSON.parse(response.body)
76
+ return json
77
+ end
78
+
79
+ def self.delete_app(app_version, host_url, aw_tenant_code, b64_encoded_auth, debug)
80
+ require 'rest-client'
81
+ require 'json'
82
+
83
+ UI.message("Starting to delete app version: %s" % [app_version['Version']])
84
+ response = RestClient.delete(host_url + INTERNAL_APP_DELETE_SUFFIX % [app_version['Id']], {accept: :json, 'aw-tenant-code': aw_tenant_code, 'Authorization': "Basic " + b64_encoded_auth})
85
+
86
+ if debug
87
+ UI.message("Response code: %d" % [response.code])
88
+ end
89
+
90
+ if response.code == 204
91
+ UI.message("Successfully deleted app version: %s" % [app_version['Version']])
92
+ else
93
+ UI.message("Failed to delete app version: %s" % [app_version['Version']])
94
+ end
95
+ end
96
+
97
+ def self.retire_app(app_version, host_url, aw_tenant_code, b64_encoded_auth, debug)
98
+ require 'rest-client'
99
+ require 'json'
100
+
101
+ body = {
102
+ "applicationid" => app_version['Id']
103
+ }
104
+
105
+ UI.message("Starting to retire app version: %s" % [app_version['Version']])
106
+ response = RestClient.post(host_url + INTERNAL_APP_RETIRE_SUFFIX % [app_version['Id']], body.to_json, {accept: :json, 'aw-tenant-code': aw_tenant_code, 'Authorization': "Basic " + b64_encoded_auth})
107
+
108
+ if debug
109
+ UI.message("Response code: %d" % [response.code])
110
+ end
111
+
112
+ if response.code == 202
113
+ UI.message("Successfully retired app version: %s" % [app_version['Version']])
114
+ else
115
+ json = JSON.parse(response.body)
116
+ UI.message("Failed to retire app version: %s" % [app_version['Version']])
117
+ end
118
+ end
119
+
120
+ def self.unretire_app(app_version, host_url, aw_tenant_code, b64_encoded_auth, debug)
121
+ require 'rest-client'
122
+ require 'json'
123
+
124
+ body = {
125
+ "applicationid" => app_version['Id']
126
+ }
127
+
128
+ UI.message("Starting to unretire app version: %s" % [app_version['Version']])
129
+ response = RestClient.post(host_url + INTERNAL_APP_UNRETIRE_SUFFIX % [app_version['Id']], body.to_json, {accept: :json, 'aw-tenant-code': aw_tenant_code, 'Authorization': "Basic " + b64_encoded_auth})
130
+
131
+ if debug
132
+ UI.message("Response code: %d" % [response.code])
133
+ end
134
+
135
+ if response.code == 202
136
+ UI.message("Successfully unretired app version: %s" % [app_version['Version']])
137
+ else
138
+ json = JSON.parse(response.body)
139
+ UI.message("Failed to unretire app version: %s" % [app_version['Version']])
140
+ end
141
+ end
142
+
14
143
  end
15
144
  end
16
- end
145
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AirwatchWorkspaceone
3
- VERSION = "2.0.0"
3
+ VERSION = "2.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-airwatch_workspaceone
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ram Awadhesh Sharan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2020-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: 2.123.0
167
- description:
167
+ description:
168
168
  email: ram.awadhesh1.618@gmail.com
169
169
  executables: []
170
170
  extensions: []
@@ -177,16 +177,18 @@ files:
177
177
  - lib/fastlane/plugin/airwatch_workspaceone/actions/delete_previous_versions_action.rb
178
178
  - lib/fastlane/plugin/airwatch_workspaceone/actions/delete_specific_version_action.rb
179
179
  - lib/fastlane/plugin/airwatch_workspaceone/actions/deploy_build_action.rb
180
+ - lib/fastlane/plugin/airwatch_workspaceone/actions/latest_version_action.rb
180
181
  - lib/fastlane/plugin/airwatch_workspaceone/actions/retire_previous_versions_action.rb
181
182
  - lib/fastlane/plugin/airwatch_workspaceone/actions/retire_specific_version_action.rb
182
183
  - lib/fastlane/plugin/airwatch_workspaceone/actions/unretire_all_versions.rb
184
+ - lib/fastlane/plugin/airwatch_workspaceone/actions/unretire_specific_version_action.rb
183
185
  - lib/fastlane/plugin/airwatch_workspaceone/helper/airwatch_workspaceone_helper.rb
184
186
  - lib/fastlane/plugin/airwatch_workspaceone/version.rb
185
187
  homepage: https://github.com/letsbondiway/fastlane-plugin-airwatch_workspaceone
186
188
  licenses:
187
189
  - MIT
188
190
  metadata: {}
189
- post_install_message:
191
+ post_install_message:
190
192
  rdoc_options: []
191
193
  require_paths:
192
194
  - lib
@@ -201,8 +203,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
203
  - !ruby/object:Gem::Version
202
204
  version: '0'
203
205
  requirements: []
204
- rubygems_version: 3.0.3
205
- signing_key:
206
+ rubygems_version: 3.1.2
207
+ signing_key:
206
208
  specification_version: 4
207
209
  summary: The main purpose of this plugin is to upload an IPA or an APK file to an
208
210
  AirWatch or Workspace ONE enterprise instance/console.