tiny_appstore_connect 0.1.3 → 0.1.4
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 +4 -4
- data/.rubocop.yml +23 -2
- data/Gemfile +1 -0
- data/Rakefile +21 -16
- data/lib/tiny_appstore_connect/client.rb +36 -23
- data/lib/tiny_appstore_connect/clients/app.rb +17 -17
- data/lib/tiny_appstore_connect/clients/app_store_version.rb +2 -2
- data/lib/tiny_appstore_connect/clients/build.rb +6 -6
- data/lib/tiny_appstore_connect/clients/certificate.rb +24 -0
- data/lib/tiny_appstore_connect/clients/device.rb +2 -2
- data/lib/tiny_appstore_connect/clients/user.rb +16 -0
- data/lib/tiny_appstore_connect/model.rb +2 -0
- data/lib/tiny_appstore_connect/models/certificate.rb +56 -0
- data/lib/tiny_appstore_connect/models/pre_release_version.rb +1 -1
- data/lib/tiny_appstore_connect/models/user.rb +37 -0
- data/lib/tiny_appstore_connect/response.rb +2 -2
- data/lib/tiny_appstore_connect/version.rb +1 -1
- data/lib/tiny_appstore_connect.rb +19 -20
- data/tiny_appstore_connect.gemspec +1 -1
- metadata +26 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 494a8a5e708cbb4977b5a615695320ef043acf68d412478bd8a9d611ca4ff849
|
4
|
+
data.tar.gz: f3305e5be3e62211f6136f2c020d969f5f9961845e760e6aba1aba9d981a33f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f12fc5faf9af9374bf8466cae721dd18996ab6e0752a55a88562f41063d605600046d11745342e2ccddf0319c50dd75303821935d9f8b80710d43c8b420c163f
|
7
|
+
data.tar.gz: 5003210e7e350583f15d2e021ad0248712abc7645092c91949259a93862be712574cc0ae4984ffda05be075fbe5c36245026303fecd993932d340ac69dd88274
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,34 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.6
|
3
|
+
SuggestExtensions: false
|
4
|
+
NewCops: disable
|
5
|
+
Exclude:
|
6
|
+
- 'bin/*'
|
7
|
+
- 'spec/**/*'
|
8
|
+
- '*.rb'
|
3
9
|
|
4
10
|
Style/StringLiterals:
|
5
11
|
Enabled: true
|
6
|
-
EnforcedStyle:
|
12
|
+
EnforcedStyle: single_quotes
|
7
13
|
|
8
14
|
Style/StringLiteralsInInterpolation:
|
9
15
|
Enabled: true
|
10
|
-
EnforcedStyle:
|
16
|
+
EnforcedStyle: single_quotes
|
11
17
|
|
12
18
|
Layout/LineLength:
|
13
19
|
Max: 120
|
20
|
+
|
21
|
+
Bundler/OrderedGems:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/Documentation:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Lint/NonDeterministicRequireOrder:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Lint/AssignmentInCondition:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Layout/TrailingEmptyLines:
|
34
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
@@ -11,7 +11,6 @@ RuboCop::RakeTask.new
|
|
11
11
|
|
12
12
|
task default: %i[spec rubocop]
|
13
13
|
|
14
|
-
|
15
14
|
namespace :github do
|
16
15
|
task :release do
|
17
16
|
Rake::Task['build'].invoke
|
@@ -22,18 +21,24 @@ namespace :github do
|
|
22
21
|
|
23
22
|
task :push do
|
24
23
|
helper = Bundler::GemHelper.new
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
gem_base = helper.base
|
25
|
+
gem_name = helper.send(:name)
|
26
|
+
gem_version = helper.send(:version)
|
27
|
+
gem_key = 'github'
|
28
|
+
allowed_push_host = 'https://rubygems.pkg.github.com/icyleaf'
|
29
|
+
|
30
|
+
gem_file = Gem::Util.glob_files_in_dir("#{gem_name}-*.gem", File.join(gem_base, 'pkg'))
|
31
|
+
.max_by { |f| File.mtime(f) }
|
32
|
+
|
33
|
+
cmd = ['gem', 'push', gem_file]
|
34
|
+
cmd << '--key' << gem_key
|
35
|
+
cmd << '--host' << allowed_push_host
|
36
|
+
|
37
|
+
Bundler.ui.debug(cmd)
|
38
|
+
Bundler::SharedHelpers.chdir(gem_base) do
|
39
|
+
abort unless Kernel.system(*cmd)
|
40
|
+
end
|
41
|
+
|
42
|
+
Bundler.ui.confirm "Pushed #{gem_name} #{gem_version} to #{gem_file}"
|
38
43
|
end
|
39
44
|
end
|
@@ -4,20 +4,24 @@
|
|
4
4
|
# License by fastlane team (https://github.com/fastlane/fastlane)
|
5
5
|
|
6
6
|
require 'faraday'
|
7
|
-
if Gem::Dependency.new('', '< 2.0.0').match?('', Faraday::VERSION)
|
8
|
-
|
9
|
-
|
7
|
+
require 'faraday_middleware' if Gem::Dependency.new('', '< 2.0.0').match?('', Faraday::VERSION)
|
8
|
+
require 'tiny_appstore_connect/clients/app_store_version'
|
9
|
+
require 'tiny_appstore_connect/clients/app'
|
10
|
+
require 'tiny_appstore_connect/clients/build'
|
11
|
+
require 'tiny_appstore_connect/clients/device'
|
12
|
+
require 'tiny_appstore_connect/clients/certificate'
|
13
|
+
require 'tiny_appstore_connect/clients/user'
|
10
14
|
|
11
15
|
module TinyAppstoreConnect
|
12
16
|
class Client
|
13
|
-
Dir[File.expand_path('clients/*.rb', __dir__)].each { |f| require f }
|
14
|
-
|
15
17
|
ENDPOINT = 'https://api.appstoreconnect.apple.com/v1'
|
16
18
|
|
17
19
|
include App
|
18
20
|
include AppStoreVersion
|
19
21
|
include Build
|
20
22
|
include Device
|
23
|
+
include Certificate
|
24
|
+
include User
|
21
25
|
|
22
26
|
attr_reader :connection
|
23
27
|
|
@@ -43,7 +47,6 @@ module TinyAppstoreConnect
|
|
43
47
|
private
|
44
48
|
|
45
49
|
def validates(response)
|
46
|
-
puts response.body
|
47
50
|
case response.status
|
48
51
|
when 200, 201, 204
|
49
52
|
# 200: get requests
|
@@ -67,29 +70,39 @@ module TinyAppstoreConnect
|
|
67
70
|
end
|
68
71
|
|
69
72
|
def configure_connection(**kargs)
|
70
|
-
@token = Token.new(**kargs)
|
71
73
|
endpoint = kargs[:endpoint] || ENDPOINT
|
74
|
+
options = connection_options(**kargs)
|
72
75
|
|
73
|
-
|
76
|
+
@connection = Faraday.new(endpoint, options) do |builder|
|
77
|
+
configure_builder_common(builder, **kargs)
|
78
|
+
configure_builder_debug(builder, **kargs)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def connection_options(**kargs)
|
83
|
+
{
|
74
84
|
request: {
|
75
|
-
timeout:
|
76
|
-
open_timeout:
|
85
|
+
timeout: (kargs[:timeout] || 300).to_i,
|
86
|
+
open_timeout: (kargs[:timeout] || 300).to_i
|
77
87
|
}
|
78
88
|
}
|
89
|
+
end
|
79
90
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
91
|
+
def configure_builder_common(builder, **kargs)
|
92
|
+
@token = Token.new(**kargs)
|
93
|
+
|
94
|
+
builder.headers[:user_agent] = "TinyAppstoreConnect v#{TinyAppstoreConnect::VERSION}"
|
95
|
+
builder.request :url_encoded
|
96
|
+
builder.request :authorization, 'Bearer', -> { @token.token }
|
97
|
+
builder.response :json, content_type: /\bjson$/
|
98
|
+
end
|
99
|
+
|
100
|
+
def configure_builder_debug(builder, **kargs)
|
101
|
+
return unless kargs[:debug] || ENV['ASC_DEBUG']
|
102
|
+
|
103
|
+
builder.proxy = kargs[:proxy] || ENV['ASC_PROXY'] || 'https://127.0.0.1:8888'
|
104
|
+
builder.ssl[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
|
105
|
+
builder.response :logger, nil, { log_level: :debug }
|
93
106
|
end
|
94
107
|
end
|
95
108
|
end
|
@@ -5,38 +5,38 @@
|
|
5
5
|
|
6
6
|
class TinyAppstoreConnect::Client
|
7
7
|
module App
|
8
|
-
def apps(query
|
9
|
-
get('apps', query)
|
8
|
+
def apps(**query)
|
9
|
+
get('apps', **query)
|
10
10
|
end
|
11
11
|
|
12
|
-
def app(id, query
|
13
|
-
get("apps/#{id}", query).to_model
|
12
|
+
def app(id, **query)
|
13
|
+
get("apps/#{id}", **query).to_model
|
14
14
|
end
|
15
15
|
|
16
|
-
def app_versions(id, query
|
17
|
-
get("apps/#{id}/appStoreVersions", query)
|
16
|
+
def app_versions(id, **query)
|
17
|
+
get("apps/#{id}/appStoreVersions", **query)
|
18
18
|
end
|
19
19
|
|
20
|
-
def app_edit_version(id, includes: AppStoreVersion::ESSENTIAL_INCLUDES)
|
20
|
+
def app_edit_version(id, includes: TinyAppstoreConnect::Model::AppStoreVersion::ESSENTIAL_INCLUDES)
|
21
21
|
filters = {
|
22
22
|
appStoreState: [
|
23
|
-
AppStoreState::PREPARE_FOR_SUBMISSION,
|
24
|
-
AppStoreState::DEVELOPER_REJECTED,
|
25
|
-
AppStoreState::REJECTED,
|
26
|
-
AppStoreState::METADATA_REJECTED,
|
27
|
-
AppStoreState::WAITING_FOR_REVIEW,
|
28
|
-
AppStoreState::INVALID_BINARY,
|
29
|
-
AppStoreState::IN_REVIEW,
|
30
|
-
AppStoreState::PENDING_DEVELOPER_RELEASE
|
23
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::PREPARE_FOR_SUBMISSION,
|
24
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED,
|
25
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::REJECTED,
|
26
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::METADATA_REJECTED,
|
27
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW,
|
28
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::INVALID_BINARY,
|
29
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::IN_REVIEW,
|
30
|
+
TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
|
31
31
|
].join(',')
|
32
32
|
}
|
33
33
|
|
34
34
|
app_versions(id, include: includes, filter: filters).to_model
|
35
35
|
end
|
36
36
|
|
37
|
-
def app_live_version(id, includes: ESSENTIAL_INCLUDES)
|
37
|
+
def app_live_version(id, includes: TinyAppstoreConnect::Model::AppStoreVersion::ESSENTIAL_INCLUDES)
|
38
38
|
filters = {
|
39
|
-
appStoreState: AppStoreState::READY_FOR_SALE
|
39
|
+
appStoreState: TinyAppstoreConnect::Model::AppStoreVersion::AppStoreState::READY_FOR_SALE
|
40
40
|
}
|
41
41
|
|
42
42
|
app_versions(id, include: includes, filter: filters).to_model
|
@@ -9,8 +9,8 @@ class TinyAppstoreConnect::Client
|
|
9
9
|
# get('appStoreVersions', query)
|
10
10
|
# end
|
11
11
|
|
12
|
-
def version(id, query
|
13
|
-
get("appStoreVersions/#{id}", query)
|
12
|
+
def version(id, **query)
|
13
|
+
get("appStoreVersions/#{id}", **query)
|
14
14
|
end
|
15
15
|
|
16
16
|
def select_version_build(id, build_id:)
|
@@ -9,20 +9,20 @@ class TinyAppstoreConnect::Client
|
|
9
9
|
app_builds(id, limit: 1).to_model
|
10
10
|
end
|
11
11
|
|
12
|
-
def app_builds(id, **
|
13
|
-
|
14
|
-
builds(**
|
12
|
+
def app_builds(id, **query)
|
13
|
+
query = query.merge(filter: { app: id })
|
14
|
+
builds(**query)
|
15
15
|
end
|
16
16
|
|
17
17
|
def builds(limit: 200, sort: '-uploadedDate',
|
18
18
|
includes: TinyAppstoreConnect::Model::Build::ESSENTIAL_INCLUDES,
|
19
|
-
**
|
19
|
+
**query)
|
20
20
|
|
21
|
-
|
21
|
+
query = query.merge(limit: limit)
|
22
22
|
.merge(sort: sort)
|
23
23
|
.merge(include: includes)
|
24
24
|
|
25
|
-
get('builds', **
|
25
|
+
get('builds', **query)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Inspried from fastlane/spaceship
|
4
|
+
# License by fastlane team (https://github.com/fastlane/fastlane)
|
5
|
+
|
6
|
+
class TinyAppstoreConnect::Client
|
7
|
+
module Certificate
|
8
|
+
def certificates(**query)
|
9
|
+
get('certificates', **query)
|
10
|
+
end
|
11
|
+
|
12
|
+
def certificate(id, **query)
|
13
|
+
get("certificates/#{id}", **query).to_model
|
14
|
+
end
|
15
|
+
|
16
|
+
def distribution_certificates(**query)
|
17
|
+
query[:filter] = {
|
18
|
+
certificateType: TinyAppstoreConnect::Model::Certificate::CertificateType::DISTRIBUTION,
|
19
|
+
}
|
20
|
+
|
21
|
+
certificates(**query)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -6,13 +6,13 @@
|
|
6
6
|
class TinyAppstoreConnect::Client
|
7
7
|
module Device
|
8
8
|
def devices(filter: {}, includes: nil, limit: nil, sort: nil)
|
9
|
-
|
9
|
+
query = {
|
10
10
|
include: includes,
|
11
11
|
limit: limit,
|
12
12
|
sort: sort
|
13
13
|
}.delete_if { |_, v| v.nil? }
|
14
14
|
|
15
|
-
get('devices', **
|
15
|
+
get('devices', **query)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Inspried from fastlane/spaceship
|
4
|
+
# License by fastlane team (https://github.com/fastlane/fastlane)
|
5
|
+
|
6
|
+
class TinyAppstoreConnect::Client
|
7
|
+
module User
|
8
|
+
def users(**query)
|
9
|
+
get('users', **query)
|
10
|
+
end
|
11
|
+
|
12
|
+
def user(id, **query)
|
13
|
+
get("users/#{id}", **query).to_model
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Inspried from fastlane/spaceship
|
4
|
+
# License by fastlane team (https://github.com/fastlane/fastlane)
|
5
|
+
|
6
|
+
module TinyAppstoreConnect::Model
|
7
|
+
class Certificate
|
8
|
+
include TinyAppstoreConnect::Model
|
9
|
+
|
10
|
+
attr_accessor :name
|
11
|
+
attr_accessor :certificate_type
|
12
|
+
attr_accessor :display_name
|
13
|
+
attr_accessor :serial_number
|
14
|
+
attr_accessor :platform
|
15
|
+
attr_accessor :expiratio_date
|
16
|
+
attr_accessor :certificate_content
|
17
|
+
|
18
|
+
module CertificateType
|
19
|
+
DISTRIBUTION = 'DISTRIBUTION'
|
20
|
+
DEVELOPMENT = 'DEVELOPMENT'
|
21
|
+
|
22
|
+
IOS_DEVELOPMENT = 'IOS_DEVELOPMENT'
|
23
|
+
IOS_DISTRIBUTION = 'IOS_DISTRIBUTION'
|
24
|
+
MAC_APP_DISTRIBUTION = 'MAC_APP_DISTRIBUTION'
|
25
|
+
MAC_INSTALLER_DISTRIBUTION = 'MAC_INSTALLER_DISTRIBUTION'
|
26
|
+
MAC_APP_DEVELOPMENT = 'MAC_APP_DEVELOPMENT'
|
27
|
+
DEVELOPER_ID_KEXT = 'DEVELOPER_ID_KEXT'
|
28
|
+
DEVELOPER_ID_APPLICATION = 'DEVELOPER_ID_APPLICATION'
|
29
|
+
PASS_TYPE_ID = 'PASS_TYPE_ID'
|
30
|
+
PASS_TYPE_ID_WITH_NFC = 'PASS_TYPE_ID_WITH_NFC'
|
31
|
+
end
|
32
|
+
|
33
|
+
def team_id
|
34
|
+
certificate.subject
|
35
|
+
.to_a
|
36
|
+
.find {|n, _, _| n == 'OU'}[1]
|
37
|
+
.force_encoding('UTF-8')
|
38
|
+
end
|
39
|
+
|
40
|
+
def certificate
|
41
|
+
require 'openssl'
|
42
|
+
|
43
|
+
data = [
|
44
|
+
'-----BEGIN CERTIFICATE-----',
|
45
|
+
certificate_content,
|
46
|
+
'-----END CERTIFICATE-----'
|
47
|
+
].join("\n")
|
48
|
+
|
49
|
+
OpenSSL::X509::Certificate.new(data)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.type
|
53
|
+
'certificates'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Inspried from fastlane/spaceship
|
4
|
+
# License by fastlane team (https://github.com/fastlane/fastlane)
|
5
|
+
|
6
|
+
module TinyAppstoreConnect::Model
|
7
|
+
class User
|
8
|
+
include TinyAppstoreConnect::Model
|
9
|
+
|
10
|
+
attr_accessor :username
|
11
|
+
attr_accessor :first_name
|
12
|
+
attr_accessor :last_name
|
13
|
+
attr_accessor :roles
|
14
|
+
attr_accessor :all_apps_visible
|
15
|
+
attr_accessor :provisioning_allowed
|
16
|
+
|
17
|
+
module UserRole
|
18
|
+
ADMIN = 'ADMIN'
|
19
|
+
FINANCE = 'FINANCE'
|
20
|
+
ACCOUNT_HOLDER = 'ACCOUNT_HOLDER'
|
21
|
+
SALES = 'SALES'
|
22
|
+
MARKETING = 'MARKETING'
|
23
|
+
APP_MANAGER = 'APP_MANAGER'
|
24
|
+
DEVELOPER = 'DEVELOPER'
|
25
|
+
ACCESS_TO_REPORTS = 'ACCESS_TO_REPORTS'
|
26
|
+
CUSTOMER_SUPPORT = 'CUSTOMER_SUPPORT'
|
27
|
+
IMAGE_MANAGER = 'IMAGE_MANAGER'
|
28
|
+
CREATE_APPS = 'CREATE_APPS'
|
29
|
+
CLOUD_MANAGED_DEVELOPER_ID = 'CLOUD_MANAGED_DEVELOPER_ID'
|
30
|
+
CLOUD_MANAGED_APP_DISTRIBUTION = 'CLOUD_MANAGED_APP_DISTRIBUTION'
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.type
|
34
|
+
'users'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -7,7 +7,7 @@ require 'forwardable'
|
|
7
7
|
|
8
8
|
module TinyAppstoreConnect
|
9
9
|
class Response
|
10
|
-
include Enumerable
|
10
|
+
# include Enumerable
|
11
11
|
extend Forwardable
|
12
12
|
|
13
13
|
attr_reader :response, :connection
|
@@ -95,7 +95,7 @@ module TinyAppstoreConnect
|
|
95
95
|
|
96
96
|
def each(&block)
|
97
97
|
to_models.each do |model|
|
98
|
-
|
98
|
+
block.call(model)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -12,26 +12,7 @@ module TinyAppstoreConnect
|
|
12
12
|
class ConnectAPIError < Error
|
13
13
|
class << self
|
14
14
|
def parse(response)
|
15
|
-
|
16
|
-
case response.status
|
17
|
-
when 401
|
18
|
-
# Unauthorized
|
19
|
-
InvalidUserCredentialsError.from_errors(errors)
|
20
|
-
when 403
|
21
|
-
# The API key in use does not allow this request
|
22
|
-
ForbiddenError.from_errors(errors)
|
23
|
-
when 404
|
24
|
-
# Not found resource
|
25
|
-
NotFoundError.from_errors(errors)
|
26
|
-
when 409
|
27
|
-
# Invaild request entity
|
28
|
-
InvalidEntityError.from_errors(errors)
|
29
|
-
when 429
|
30
|
-
# 429 Rate Limit Exceeded
|
31
|
-
RateLimitExceededError.from_errors(errors)
|
32
|
-
else
|
33
|
-
ConnectAPIError.from_errors(errors)
|
34
|
-
end
|
15
|
+
handel_error(response.status, response.body['errors'])
|
35
16
|
end
|
36
17
|
|
37
18
|
def from_errors(errors)
|
@@ -42,6 +23,24 @@ module TinyAppstoreConnect
|
|
42
23
|
|
43
24
|
new(message)
|
44
25
|
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def handel_error(status_code, errors)
|
30
|
+
case status_code
|
31
|
+
# Unauthorized
|
32
|
+
when 401 then InvalidUserCredentialsError.from_errors(errors)
|
33
|
+
# The API key in use does not allow this request
|
34
|
+
when 403 then ForbiddenError.from_errors(errors)
|
35
|
+
# Not found resource
|
36
|
+
when 404 then NotFoundError.from_errors(errors)
|
37
|
+
# Invaild request entity
|
38
|
+
when 409 then InvalidEntityError.from_errors(errors)
|
39
|
+
# 429 Rate Limit Exceeded
|
40
|
+
when 429 then RateLimitExceededError.from_errors(errors)
|
41
|
+
else ConnectAPIError.from_errors(errors)
|
42
|
+
end
|
43
|
+
end
|
45
44
|
end
|
46
45
|
end
|
47
46
|
|
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
18
|
spec.metadata['github_repo'] = 'ssh://github.com/icyleaf/tiny_appstore_connect'
|
19
19
|
|
20
|
-
|
21
20
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
21
|
`git ls-files -z`.split("\x0").reject do |f|
|
23
22
|
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
@@ -29,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
29
28
|
|
30
29
|
spec.add_dependency 'faraday', '>= 1.10.0', '< 3.0'
|
31
30
|
spec.add_dependency 'jwt', '>= 1.4', '<= 2.2.1'
|
31
|
+
spec.add_dependency 'openssl', '>= 3.0.0', '< 4'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_appstore_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -50,6 +50,26 @@ dependencies:
|
|
50
50
|
- - "<="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 2.2.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: openssl
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 3.0.0
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '4'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.0.0
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '4'
|
53
73
|
description: Tiny AppStore Connect API
|
54
74
|
email:
|
55
75
|
- icyleaf.cn@gmail.com
|
@@ -69,14 +89,18 @@ files:
|
|
69
89
|
- lib/tiny_appstore_connect/clients/app.rb
|
70
90
|
- lib/tiny_appstore_connect/clients/app_store_version.rb
|
71
91
|
- lib/tiny_appstore_connect/clients/build.rb
|
92
|
+
- lib/tiny_appstore_connect/clients/certificate.rb
|
72
93
|
- lib/tiny_appstore_connect/clients/device.rb
|
94
|
+
- lib/tiny_appstore_connect/clients/user.rb
|
73
95
|
- lib/tiny_appstore_connect/model.rb
|
74
96
|
- lib/tiny_appstore_connect/models/app.rb
|
75
97
|
- lib/tiny_appstore_connect/models/app_store_version.rb
|
76
98
|
- lib/tiny_appstore_connect/models/app_store_version_submission.rb
|
77
99
|
- lib/tiny_appstore_connect/models/build.rb
|
100
|
+
- lib/tiny_appstore_connect/models/certificate.rb
|
78
101
|
- lib/tiny_appstore_connect/models/device.rb
|
79
102
|
- lib/tiny_appstore_connect/models/pre_release_version.rb
|
103
|
+
- lib/tiny_appstore_connect/models/user.rb
|
80
104
|
- lib/tiny_appstore_connect/response.rb
|
81
105
|
- lib/tiny_appstore_connect/token.rb
|
82
106
|
- lib/tiny_appstore_connect/version.rb
|