adsedare 0.0.1 → 0.0.2

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.
data/lib/starship.rb CHANGED
@@ -9,18 +9,18 @@ module Starship
9
9
  class Client
10
10
  DEV_SERVICES_V1 = "https://developer.apple.com/services-account/v1"
11
11
  DEV_SERVICES_QH65B2 = "https://developer.apple.com/services-account/QH65B2"
12
-
12
+
13
13
  class << self
14
14
  def auth_helper
15
15
  @auth_helper ||= AuthHelper.new
16
16
  end
17
-
17
+
18
18
  def get_bundle_ids(team_id)
19
19
  response = authenticated_request(
20
- DEV_SERVICES_V1 + "/bundleIds",
20
+ DEV_SERVICES_V1 + "/bundleIds",
21
21
  method: :post,
22
22
  body: { teamId: team_id, urlEncodedQueryParams: "limit=1000&sort=name&filter[platform]=IOS,MACOS" }.to_json,
23
- headers: { "Content-Type" => "application/vnd.api+json" }
23
+ headers: { "Content-Type" => "application/vnd.api+json" },
24
24
  )
25
25
 
26
26
  if response.status == 200
@@ -32,10 +32,10 @@ module Starship
32
32
 
33
33
  def get_devices(team_id)
34
34
  response = authenticated_request(
35
- DEV_SERVICES_V1 + "/devices",
35
+ DEV_SERVICES_V1 + "/devices",
36
36
  method: :post,
37
37
  body: { teamId: team_id, urlEncodedQueryParams: "limit=1000&sort=name" }.to_json,
38
- headers: { "Content-Type" => "application/vnd.api+json" }
38
+ headers: { "Content-Type" => "application/vnd.api+json" },
39
39
  )
40
40
 
41
41
  if response.status == 200
@@ -47,10 +47,10 @@ module Starship
47
47
 
48
48
  def get_profiles(team_id)
49
49
  response = authenticated_request(
50
- DEV_SERVICES_V1 + "/profiles",
50
+ DEV_SERVICES_V1 + "/profiles",
51
51
  method: :post,
52
52
  body: { teamId: team_id, urlEncodedQueryParams: "limit=1000&sort=name" }.to_json,
53
- headers: { "Content-Type" => "application/vnd.api+json" }
53
+ headers: { "Content-Type" => "application/vnd.api+json" },
54
54
  )
55
55
 
56
56
  if response.status == 200
@@ -69,7 +69,7 @@ module Starship
69
69
  "includeInactiveProfiles" => true,
70
70
  "provisioningProfileId" => profile_id,
71
71
  ),
72
- headers: { "Content-Type" => "application/x-www-form-urlencoded" }
72
+ headers: { "Content-Type" => "application/x-www-form-urlencoded" },
73
73
  )
74
74
 
75
75
  if response.status == 200
@@ -79,12 +79,12 @@ module Starship
79
79
  end
80
80
  end
81
81
 
82
- def get_bundle_info(bundle_id, team_id)
82
+ def get_bundle_info(bundle_id, team_id)
83
83
  response = authenticated_request(
84
- DEV_SERVICES_V1 + "/bundleIds/#{bundle_id}?include=bundleIdCapabilities,bundleIdCapabilities.capability,bundleIdCapabilities.appGroups",
84
+ DEV_SERVICES_V1 + "/bundleIds/#{bundle_id}?include=bundleIdCapabilities,bundleIdCapabilities.capability,bundleIdCapabilities.appGroups",
85
85
  method: :post,
86
86
  body: { teamId: team_id }.to_json,
87
- headers: { "Content-Type" => "application/vnd.api+json" }
87
+ headers: { "Content-Type" => "application/vnd.api+json" },
88
88
  )
89
89
 
90
90
  if response.status == 200
@@ -102,9 +102,9 @@ module Starship
102
102
  "teamId" => team_id,
103
103
  "pageSize" => 1000,
104
104
  "pageNumber" => 1,
105
- "sort" => "name%3Dasc"
105
+ "sort" => "name%3Dasc",
106
106
  ),
107
- headers: { "Content-Type" => "application/x-www-form-urlencoded" }
107
+ headers: { "Content-Type" => "application/x-www-form-urlencoded" },
108
108
  )
109
109
  if response.status == 200
110
110
  JSON.parse(response.body)["applicationGroupList"]
@@ -117,12 +117,12 @@ module Starship
117
117
  response = authenticated_request(
118
118
  DEV_SERVICES_QH65B2 + "/account/ios/identifiers/addApplicationGroup.action",
119
119
  method: :post,
120
- body: URI.encode_www_form(
120
+ body: URI.encode_www_form(
121
121
  "name" => generate_name_for(app_group),
122
122
  "identifier" => app_group,
123
123
  "teamId" => team_id,
124
124
  ),
125
- headers: { "Content-Type" => "application/x-www-form-urlencoded" }
125
+ headers: { "Content-Type" => "application/x-www-form-urlencoded" },
126
126
  )
127
127
  if response.status == 200
128
128
  JSON.parse(response.body)
@@ -135,26 +135,26 @@ module Starship
135
135
  response = authenticated_request(
136
136
  DEV_SERVICES_V1 + "/bundleIds",
137
137
  method: :post,
138
- body: {
138
+ body: {
139
139
  data: {
140
140
  type: "bundleIds",
141
141
  attributes: {
142
142
  identifier: bundle_identifier,
143
143
  name: generate_name_for(bundle_identifier),
144
144
  seedId: team_id,
145
- teamId: team_id
145
+ teamId: team_id,
146
146
  },
147
147
  relationships: {
148
148
  bundleIdCapabilities: {
149
- data: capabilities
150
- }
151
- }
152
- }
149
+ data: capabilities,
150
+ },
151
+ },
152
+ },
153
153
  }.to_json,
154
- headers: {
154
+ headers: {
155
155
  "Content-Type" => "application/vnd.api+json",
156
- "X-HTTP-Method-Override" => nil
157
- }
156
+ "X-HTTP-Method-Override" => nil,
157
+ },
158
158
  )
159
159
  if response.status == 201
160
160
  JSON.parse(response.body)
@@ -170,7 +170,7 @@ module Starship
170
170
  response = authenticated_request(
171
171
  DEV_SERVICES_V1 + "/bundleIds/#{bundle_id}",
172
172
  method: :patch,
173
- body: {
173
+ body: {
174
174
  data: {
175
175
  type: "bundleIds",
176
176
  id: bundle_id,
@@ -180,18 +180,18 @@ module Starship
180
180
  seedId: bundle_attributes["seedId"],
181
181
  name: bundle_attributes["name"],
182
182
  wildcard: bundle_attributes["wildcard"],
183
- teamId: team_id
183
+ teamId: team_id,
184
184
  },
185
185
  relationships: {
186
186
  bundleIdCapabilities: {
187
- data: capabilities
188
- }
189
- }
190
- }
187
+ data: capabilities,
188
+ },
189
+ },
190
+ },
191
191
  }.to_json,
192
- headers: { "Content-Type" => "application/vnd.api+json" }
192
+ headers: { "Content-Type" => "application/vnd.api+json" },
193
193
  )
194
-
194
+
195
195
  if response.status == 200
196
196
  JSON.parse(response.body)
197
197
  else
@@ -203,37 +203,37 @@ module Starship
203
203
  response = authenticated_request(
204
204
  DEV_SERVICES_V1 + "/profiles",
205
205
  method: :post,
206
- body: {
206
+ body: {
207
207
  data: {
208
208
  type: "profiles",
209
209
  attributes: {
210
210
  name: generate_name_for(bundle_identifier),
211
211
  profileType: "IOS_APP_ADHOC",
212
- teamId: team_id
212
+ teamId: team_id,
213
213
  },
214
214
  relationships: {
215
215
  bundleId: {
216
216
  data: {
217
217
  type: "bundleIds",
218
- id: bundle_id
219
- }
218
+ id: bundle_id,
219
+ },
220
220
  },
221
221
  certificates: {
222
- data: [{
223
- type: "certificates",
224
- id: certificate_id
225
- }]
222
+ data: [{
223
+ type: "certificates",
224
+ id: certificate_id,
225
+ }],
226
226
  },
227
227
  devices: {
228
- data: devices.map { |device| { type: "devices", id: device["id"] } }
229
- }
230
- }
231
- }
228
+ data: devices.map { |device| { type: "devices", id: device["id"] } },
229
+ },
230
+ },
231
+ },
232
232
  }.to_json,
233
- headers: {
233
+ headers: {
234
234
  "Content-Type" => "application/vnd.api+json",
235
- "X-HTTP-Method-Override" => nil
236
- }
235
+ "X-HTTP-Method-Override" => nil,
236
+ },
237
237
  )
238
238
  if response.status == 201
239
239
  JSON.parse(response.body)
@@ -255,9 +255,9 @@ module Starship
255
255
  "provisioningProfileName" => profile["provisioningProfile"]["name"],
256
256
  "certificateIds" => profile["provisioningProfile"]["certificateIds"].join(","),
257
257
  "deviceIds" => devices,
258
- "teamId" => team_id
258
+ "teamId" => team_id,
259
259
  ),
260
- headers: { "Content-Type" => "application/x-www-form-urlencoded" }
260
+ headers: { "Content-Type" => "application/x-www-form-urlencoded" },
261
261
  )
262
262
  if response.status == 200
263
263
  JSON.parse(response.body)
@@ -265,11 +265,11 @@ module Starship
265
265
  raise "Failed to regenerate profile: #{response.status}"
266
266
  end
267
267
  end
268
-
268
+
269
269
  private
270
-
270
+
271
271
  def generate_name_for(resource_id)
272
- latinized = resource_id.gsub(/[^0-9A-Za-z\d\s]/, ' ')
272
+ latinized = resource_id.gsub(/[^0-9A-Za-z\d\s]/, " ")
273
273
 
274
274
  return "ADSEDARE #{latinized}"
275
275
  end
@@ -278,15 +278,15 @@ module Starship
278
278
  unless auth_helper.validate_token
279
279
  auth_helper.sign_in
280
280
  end
281
-
281
+
282
282
  # Make the request
283
283
  return auth_helper.request(
284
- endpoint,
285
- method: method,
286
- params: params,
287
- body: body,
288
- headers: headers
289
- )
284
+ endpoint,
285
+ method: method,
286
+ params: params,
287
+ body: body,
288
+ headers: headers,
289
+ )
290
290
  end
291
291
  end
292
292
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adsedare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexstrnik
@@ -113,7 +113,10 @@ files:
113
113
  - exe/adsedare
114
114
  - lib/adsedare.rb
115
115
  - lib/adsedare/capabilities.rb
116
+ - lib/adsedare/export_options.rb
117
+ - lib/adsedare/keychain.rb
116
118
  - lib/adsedare/version.rb
119
+ - lib/adsedare/xcodeproj.rb
117
120
  - lib/appstoreconnect.rb
118
121
  - lib/logging.rb
119
122
  - lib/starship.rb