Skip to content

Commit

Permalink
Add new endpoints and remove MixPanel (#123)
Browse files Browse the repository at this point in the history
* Remove MixPanel as a dependency [RM-167]

* Add phased release management endpoints [RA-313]

* Fix endpoint errors [RA-336]

* Make the gem Rails 6.0 compatible [RA-336]

* Add build update endpoint [RA-364]

* Small fixes (tests, documentation)
  • Loading branch information
Zoltán Ormándi authored Oct 28, 2022
1 parent 348ccb7 commit 69d3a39
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 84 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ result = app_store_connect.create_device(
puts JSON.pretty_generate(result)
```

### Update an App Store Version

```ruby
app_store_connect.update_app_store_version id: '<app-store-version-id>', version_string: '1.0'
```

### Link a Build to an App Store Version

```ruby
app_store_connect.update_app_store_version_build id: '<app-store-version-id>', build_id: '<build-id>'
```

### Create a Review Submission Item

```ruby
app_store_connect.create_review_submission_item relationships: {reviewSubmission: {data: {id: '<review-submission-id>', type: 'reviewSubmissions'}},
appStoreVersion: {data: {id: '<app-store-version-id>', type: 'appStoreVersions'}}}
```

## Q&A

Expand Down
1 change: 0 additions & 1 deletion app_store_connect.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Gem::Specification.new do |spec|

spec.add_runtime_dependency 'activesupport', '>= 6.0.0'
spec.add_runtime_dependency 'jwt', '>= 1.4', '<= 2.5.0'
spec.add_runtime_dependency 'mixpanel-ruby', '<= 2.2.0'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'factory_bot', '~> 6.2.1'
Expand Down
3 changes: 3 additions & 0 deletions lib/app_store_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

require 'app_store_connect/app_store_version_build_linkage_request'
require 'app_store_connect/app_store_version_create_request'
require 'app_store_connect/app_store_version_phased_release_create_request'
require 'app_store_connect/app_store_version_phased_release_update_request'
require 'app_store_connect/app_store_version_update_request'
require 'app_store_connect/build_update_request'
require 'app_store_connect/bundle_id_capability_create_request'
require 'app_store_connect/bundle_id_create_request'
require 'app_store_connect/certificate_create_request'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require 'app_store_connect/create_request'

module AppStoreConnect
class AppStoreVersionPhasedReleaseCreateRequest < CreateRequest
data do
type 'appStoreVersionPhasedReleases'

attributes do
property :phased_release_state
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'app_store_connect/create_request'

module AppStoreConnect
class AppStoreVersionPhasedReleaseUpdateRequest < CreateRequest
data do
id
type 'appStoreVersionPhasedReleases'

attributes do
property :phased_release_state
end
end
end
end
17 changes: 17 additions & 0 deletions lib/app_store_connect/build_update_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require 'app_store_connect/create_request'

module AppStoreConnect
class BuildUpdateRequest < CreateRequest
data do
id
type 'builds'

attributes do
property :expired
property :uses_non_exempt_encryption
end
end
end
end
3 changes: 0 additions & 3 deletions lib/app_store_connect/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
require 'app_store_connect/schema'
require 'app_store_connect/client/authorization'
require 'app_store_connect/client/options'
require 'app_store_connect/client/usage'
require 'app_store_connect/client/registry'
require 'app_store_connect/client/utils'

module AppStoreConnect
class Client
def initialize(**kwargs)
@options = Options.new(kwargs)
@usage = Usage.new(@options.slice(*Usage::OPTIONS))
@authorization = Authorization.new(@options.slice(*Authorization::OPTIONS))
@registry = Registry.new(@options.slice(*Registry::OPTIONS))
end
Expand Down Expand Up @@ -48,7 +46,6 @@ def call(web_service_endpoint, **kwargs)

request = build_request(web_service_endpoint, **kwargs)

@usage.track
response = request.execute

Utils.decode(response.body, response.content_type) if response.body
Expand Down
28 changes: 0 additions & 28 deletions lib/app_store_connect/client/usage.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/app_store_connect/object/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def to_h
type: type
}
props[:id] = @id if id?
props.compact
props.reject { |_k, v| v.blank? }
end
end

Expand Down
36 changes: 35 additions & 1 deletion lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,13 @@
"alias": "beta_app_review_submission_build"
},

{
"http_method": "patch",
"url": "https://api.appstoreconnect.apple.com/v1/builds/{id}",
"http_body_type": "BuildUpdateRequest",
"alias": "update_build"
},

{
"url": "https://api.appstoreconnect.apple.com/v1/appStoreVersions",
"http_body_type": "AppStoreVersionCreateRequest",
Expand Down Expand Up @@ -707,6 +714,24 @@
"alias": "app_store_version"
},

{
"url": "https://api.appstoreconnect.apple.com/v1/appStoreVersionPhasedReleases",
"http_body_type": "AppStoreVersionPhasedReleaseCreateRequest",
"http_method": "post",
"alias": "create_app_store_version_phased_release"
},
{
"http_method": "patch",
"url": "https://api.appstoreconnect.apple.com/v1/appStoreVersionPhasedReleases/{id}",
"http_body_type": "AppStoreVersionPhasedReleaseUpdateRequest",
"alias": "update_app_store_version_phased_release"
},
{
"http_method": "delete",
"url": "https://api.appstoreconnect.apple.com/v1/appStoreVersionPhasedReleases/{id}",
"alias": "delete_app_store_version_phased_release"
},

{
"url": "https://api.appstoreconnect.apple.com/v1/reviewSubmissions",
"http_body_type": "ReviewSubmissionCreateRequest",
Expand Down Expand Up @@ -736,7 +761,7 @@
},

{
"url": "https://api.appstoreconnect.apple.com/v1/reviewSubmissionsItems",
"url": "https://api.appstoreconnect.apple.com/v1/reviewSubmissionItems",
"http_body_type": "ReviewSubmissionItemCreateRequest",
"http_method": "post",
"alias": "create_review_submission_item"
Expand Down Expand Up @@ -803,6 +828,15 @@
"TV_OS"
]
},
{
"type": "PhasedReleaseState",
"values": [
"INACTIVE",
"ACTIVE",
"PAUSED",
"COMPLETE"
]
},
{
"type": "UserRole",
"values": [
Expand Down
45 changes: 0 additions & 45 deletions spec/app_store_connect/client/usage_spec.rb

This file was deleted.

6 changes: 2 additions & 4 deletions spec/bundle_id_create_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
identifier: attributes.identifier,
name: attributes.name,
platform: attributes.platform
},
relationships: {}
}
}
)
end
Expand All @@ -36,8 +35,7 @@
name: attributes.name,
seed_id: attributes.seed_id,
platform: attributes.platform
},
relationships: {}
}
}
)
end
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
end

config.before(:each) do
stub_request(:post, 'https://api.mixpanel.com/track')
stub_request(:any, /api.appstoreconnect.apple.com/).to_return(body: '{}')
end

Expand Down

0 comments on commit 69d3a39

Please sign in to comment.