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 to_json for ConnectAPI models #16422

Merged
merged 2 commits into from
May 12, 2020

Conversation

tbodt
Copy link
Contributor

@tbodt tbodt commented May 5, 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 wanted to write a script that dumps out the list of beta testers as JSON, but the ConnectAPI models didn't have to_json implemented, so I implemented it.

Description

Added a to_json method to ConnectAPI models that returns its attributes in JSON.

Testing Steps

bundle exec rspec spaceship/spec/connect_api/model_spec.rb

@max-ott
Copy link
Contributor

max-ott commented May 5, 2020

Hi @tbodt thanks for the PR! More than happy to test it, do you have some easy testing steps so I can review it and move things forward?

@janpio
Copy link
Member

janpio commented May 6, 2020

The test you added @tbodt (Thanks for that!) doesn't seem to be to happy:

`Failures:

  1) Spaceship::ConnectAPI::Model #to_json
     Failure/Error:
       expect(JSON.parse(test.to_json)).to eq({
         "id" => "id",
         "foo" => "foo",
         "foo_bar" => "foo_bar"
       })

     TypeError:
       wrong element type Symbol at 0 (expected array)
     # ./spaceship/lib/spaceship/connect_api/model.rb:54:in `to_h'
     # ./spaceship/lib/spaceship/connect_api/model.rb:54:in `to_json'
     # ./spaceship/spec/connect_api/model_spec.rb:17:in `block (2 levels) in <top (required)>'

@tbodt
Copy link
Contributor Author

tbodt commented May 6, 2020

It passed on my machine. Looks like it only works on ruby 2.6.

@tbodt tbodt force-pushed the connect-api-json branch 2 times, most recently from 357cf17 to 6b2f161 Compare May 9, 2020 16:40
@tbodt tbodt closed this May 9, 2020
@tbodt
Copy link
Contributor Author

tbodt commented May 9, 2020

Tests pass now :)

@tbodt tbodt reopened this May 9, 2020
@tbodt tbodt force-pushed the connect-api-json branch 2 times, most recently from 76fce98 to d46d890 Compare May 10, 2020 18:58
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.

Seems good to me! Thanks for the contribution 😊

@joshdholtz joshdholtz merged commit 7c35bb4 into fastlane:master May 12, 2020
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