Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spaceship] Add retrieve-create of iap shared secret to Spaceship::Tunes #16326

Merged
merged 3 commits into from
Apr 29, 2020

Conversation

piechart
Copy link
Contributor

@piechart piechart commented Apr 17, 2020

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

I was working on iOS project in a remote team. Once someone was implementing in-app purchases functionality and regenerated shared secret key. Unluckily, at the same time I was testing other iaps in the app. Having fastlane as a helping tool which lanes prevent a lot of other cases of such scenarios in the project, I thought being able to retrieve actual shared secret via Spaceship and set in the project somehow would be a useful feature.

Description

Retrieve currently existing shared secret (or create if does not exist)

Spaceship::Tunes.login
app = Spaceship::Tunes::Application.find('bundle_identifier')
secret = app.in_app_purchases.get_shared_secret(create: true)

Generate (or regenerate if exists) new app-specific shared secret

Spaceship::Tunes.login
app = Spaceship::Tunes::Application.find('bundle_identifier')
secret = app.in_app_purchases.generate_shared_secret

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@piechart
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea this was a thing 🙃 Thanks for the PR for this! I requested one little change to split the tunes client method into two methods. Would you also be able to add some tests for this as well?

Comment on lines 1427 to 1431
def handle_shared_secret(method: nil, app_id: nil)
r = request(method, "ra/apps/#{app_id}/iaps/appSharedSecret")
data = parse_response(r, 'data')
data['sharedSecret']
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we actually split this into two methods? One for the :get and one for the :post. I’d just like this to follow the rest of the conventions in this class and keep the :get and :post encapsulated into this file 😇

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review, totally agree. Have done this! 👍

@joshdholtz joshdholtz requested a review from max-ott April 19, 2020 14:53
@joshdholtz
Copy link
Member

@max-ott Can you take a look at these changes too? 😊

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Thanks for making those changes ❤️ I’ll wait for @max-ott’s review before merging 😊

@max-ott
Copy link
Contributor

max-ott commented Apr 24, 2020

Works like a charm! Thanks for the addition.

Copy link
Contributor

@max-ott max-ott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and everything is working as intended!

@piechart
Copy link
Contributor Author

@max-ott thank you for review!
@joshdholtz seems like it is ready to be merged now 😃

@joshdholtz joshdholtz merged commit 40fdd51 into fastlane:master Apr 29, 2020
@fastlane-bot
Copy link

Hey @piechart 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations! 🎉 This was released as part of fastlane 2.147.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Jul 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants