app_store_connect 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/Gemfile.lock +1 -1
- data/lib/app_store_connect/client.rb +15 -1
- data/lib/app_store_connect/request.rb +18 -8
- data/lib/app_store_connect/version.rb +1 -1
- data/lib/config/api.json +26 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a6c4da8390a3b6dca010f45a62823c88f0df8ae02e1355570a8614c04eca84
|
4
|
+
data.tar.gz: e29dba8d0cf6b9e2b12810acff277f63ba51c90d062a4a4811c098d77071c015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b3c79b6fa5279f6894dd5b4011e79df3531ff16f5d059808c3ad218e630bca2ab0fdbb244efd626ebba9602e625d792cc034006a6c8a756649c6d01db9e8039
|
7
|
+
data.tar.gz: 801cbb6947f81fc0d6d663ce2fb045f8760d2b6a15188a317689458db40bb0542e24634b15bcb175f78957c6fa3034eb732268ba18b6107c0cbdc6268869a1c6
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -42,7 +42,7 @@ module AppStoreConnect
|
|
42
42
|
|
43
43
|
def call(web_service_endpoint, **kwargs)
|
44
44
|
parser = proc do |response|
|
45
|
-
JSON.parse(response.body)
|
45
|
+
JSON.parse(response.body) if response.body
|
46
46
|
end
|
47
47
|
|
48
48
|
case web_service_endpoint.http_method
|
@@ -50,6 +50,8 @@ module AppStoreConnect
|
|
50
50
|
get(web_service_endpoint, **kwargs, &parser)
|
51
51
|
when :post
|
52
52
|
post(web_service_endpoint, **kwargs, &parser)
|
53
|
+
when :delete
|
54
|
+
delete(web_service_endpoint, **kwargs, &parser)
|
53
55
|
else
|
54
56
|
raise "invalid http method: #{web_service_endpoint.http_method}"
|
55
57
|
end
|
@@ -106,6 +108,18 @@ module AppStoreConnect
|
|
106
108
|
.to_json
|
107
109
|
end
|
108
110
|
|
111
|
+
def delete(web_service_endpoint, **kwargs, &block)
|
112
|
+
request = Request.new(
|
113
|
+
web_service_endpoint: web_service_endpoint,
|
114
|
+
kwargs: kwargs,
|
115
|
+
http_method: :delete,
|
116
|
+
uri: build_uri(web_service_endpoint, **kwargs),
|
117
|
+
headers: headers
|
118
|
+
)
|
119
|
+
|
120
|
+
request.execute(&block) || true
|
121
|
+
end
|
122
|
+
|
109
123
|
def post(web_service_endpoint, **kwargs, &block)
|
110
124
|
request = Request.new(
|
111
125
|
web_service_endpoint: web_service_endpoint,
|
@@ -5,6 +5,12 @@ require 'net/http'
|
|
5
5
|
module AppStoreConnect
|
6
6
|
attr_reader :uri
|
7
7
|
|
8
|
+
class UnsupportedHTTPMethod < ArgumentError
|
9
|
+
def initialize(http_method)
|
10
|
+
super "Unsupported HTTP Method: #{http_method}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
8
14
|
class Request
|
9
15
|
def initialize(**options)
|
10
16
|
@uri = options.fetch(:uri)
|
@@ -70,17 +76,21 @@ module AppStoreConnect
|
|
70
76
|
.map { |_, n| n.to_sym }
|
71
77
|
end
|
72
78
|
|
73
|
-
def
|
79
|
+
def net_http_request_class
|
74
80
|
case http_method
|
75
|
-
when :get
|
76
|
-
|
77
|
-
when :
|
78
|
-
|
79
|
-
request.body = body
|
80
|
-
end
|
81
|
+
when :get then Net::HTTP::Get
|
82
|
+
when :post then Net::HTTP::Post
|
83
|
+
when :delete then Net::HTTP::Delete
|
84
|
+
when :patch then Net::HTTP::Patch
|
81
85
|
else
|
82
|
-
raise
|
86
|
+
raise UnsupportedHTTPMethod, http_method
|
83
87
|
end
|
84
88
|
end
|
89
|
+
|
90
|
+
def request
|
91
|
+
net_http_request_class
|
92
|
+
.new(uri, headers)
|
93
|
+
.tap { |r| r.body = body if r.request_body_permitted? }
|
94
|
+
end
|
85
95
|
end
|
86
96
|
end
|
data/lib/config/api.json
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
{
|
2
|
-
|
2
|
+
"web_service_endpoints": [
|
3
|
+
{
|
4
|
+
"alias": "device",
|
5
|
+
"http_method": "get",
|
6
|
+
"url": "https://api.appstoreconnect.apple.com/v1/devices/{id}"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"alias": "devices",
|
10
|
+
"http_method": "get",
|
11
|
+
"url": "https://api.appstoreconnect.apple.com/v1/devices"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"alias": "delete_user_invitation",
|
15
|
+
"http_method": "delete",
|
16
|
+
"url": "https://api.appstoreconnect.apple.com/v1/userInvitations/{id}"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"alias": "delete_bundle_id",
|
20
|
+
"http_method": "delete",
|
21
|
+
"url": "https://api.appstoreconnect.apple.com/v1/bundleIds"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"alias": "bundle_ids",
|
25
|
+
"http_method": "get",
|
26
|
+
"url": "https://api.appstoreconnect.apple.com/v1/bundleIds"
|
27
|
+
},
|
3
28
|
{
|
4
29
|
"alias": "apps",
|
5
30
|
"http_method": "get",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_store_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Decot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|