app_store_connect 0.8.0 → 0.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 828bfc36ad01d4b563b45842227d5a6bdb8174e5861ff697d7cf44fe208dbd0a
4
- data.tar.gz: a46feefa242d7cbd7a250864b02c279cb5ccbabd8f3ec455fb4a9432f85d879c
3
+ metadata.gz: e3a6c4da8390a3b6dca010f45a62823c88f0df8ae02e1355570a8614c04eca84
4
+ data.tar.gz: e29dba8d0cf6b9e2b12810acff277f63ba51c90d062a4a4811c098d77071c015
5
5
  SHA512:
6
- metadata.gz: 0b4e5e5be24f9b2a82bc64c75ece2b2e5f5aaa41042320216b72bf692226cbe542d4d24485220c5f9de2b05bf0b310a700f2ba8e6bf2ea51c4c13ce0229c74cf
7
- data.tar.gz: bbb0c90614528a5efd338f27ac418995673f084fe6bb1892e48849d1eed836a670d4e8b85aad1c699cb33f8ccbc94969be974c61d860de41dc2a3fab8843d271
6
+ metadata.gz: 2b3c79b6fa5279f6894dd5b4011e79df3531ff16f5d059808c3ad218e630bca2ab0fdbb244efd626ebba9602e625d792cc034006a6c8a756649c6d01db9e8039
7
+ data.tar.gz: 801cbb6947f81fc0d6d663ce2fb045f8760d2b6a15188a317689458db40bb0542e24634b15bcb175f78957c6fa3034eb732268ba18b6107c0cbdc6268869a1c6
data/.rubocop.yml CHANGED
@@ -21,5 +21,6 @@ Style/Documentation:
21
21
  Metrics/LineLength:
22
22
  Enabled: false
23
23
 
24
- Style/StructInheritance:
24
+ Metrics/ClassLength:
25
25
  Enabled: false
26
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_store_connect (0.7.0)
4
+ app_store_connect (0.9.0)
5
5
  activesupport (~> 5.2.3)
6
6
  jwt (~> 2.1)
7
7
 
@@ -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 request
79
+ def net_http_request_class
74
80
  case http_method
75
- when :get
76
- Net::HTTP::Get.new(uri, headers)
77
- when :post
78
- Net::HTTP::Post.new(uri, headers).tap do |request|
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 "unsupported http method: #{http_method}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppStoreConnect
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
data/lib/config/api.json CHANGED
@@ -1,5 +1,30 @@
1
1
  {
2
- "web_service_endpoints": [
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.8.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-14 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport