-
Notifications
You must be signed in to change notification settings - Fork 20
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
Implement Specific (One) Launch #48
Implement Specific (One) Launch #48
Conversation
mtking2
commented
Oct 20, 2018
- Fixes one of the items described in Implement Remaining Launches Endpoints #47
- Implements the One Launch ability of the Launches endpoint that allows you to request a specific launch by flight number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you much for implementing these!
lib/spacex/launches.rb
Outdated
@@ -12,8 +12,8 @@ def self.all | |||
SPACEX::BaseRequest.info('launches') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can now just call info
CHANGELOG.md
Outdated
@@ -1,7 +1,6 @@ | |||
### 1.0.1 (next) | |||
* [#45](https://github.com/rodolfobandeira/spacex/pull/45): Implement History endpoint [@invacuo](http://github.com/invacuo). | |||
|
|||
* Your contribution here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we want to keep this line in the end.
README.md
Outdated
@@ -27,6 +27,7 @@ A Ruby library that consumes the [SpaceX API](https://github.com/r-spacex/SpaceX | |||
- `SPACEX::History.info(4)` | |||
- [Launches](#launches) | |||
- `SPACEX::Launches.info` | |||
- `SPACEX::Launches.info('68')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably also add SPACEX::Launches.all
spec/spacex/launches_spec.rb
Outdated
expect(subject.rocket.rocket_name).to eq 'Falcon 9' | ||
expect(subject.rocket.rocket_type).to eq 'FT' | ||
expect(subject.rocket.first_stage.cores.first.core_serial).to eq 'B1049' | ||
expect(subject.rocket.first_stage.cores.first.flight).to eq 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works but in other tests we have been simply comparing the entire hash instead of verifying each key value pair.
@invacuo I think I've taken care of each of your comments. Can you double check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mtking2
Thanks for your pull request! I added some suggestions. Would you mind to also update README.md with an example like we did with all other methods?
If you still have warnings after running Rubocop that you can't fix (bundle exec rubocop
), try: bundle exec rubocop --auto-gen-config
Thanks again!
README.md
Outdated
- `SPACEX::Launches.info` | ||
- `SPACEX::Launches.info('68')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `SPACEX::Launches.info('68')` | |
SPACEX::Launches.info(68) |
README.md
Outdated
@@ -203,7 +205,8 @@ first_event.links['wikipedia'] # https://en.wikipedia.org/wiki/Falcon_1 | |||
|
|||
### Launches | |||
|
|||
- Get information on all launches: `SPACEX::Launches.info` | |||
- Get information on all launches: `SPACEX::Launches.all` or `SPACEX::Launches.info` | |||
- Get information on a specific launch (by flight number): `SPACEX::Launches.info('68')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Get information on a specific launch (by flight number): `SPACEX::Launches.info('68')` | |
- Get information for a specific launch (by flight number): `SPACEX::Launches.info(68)` |
spec/spacex/launches_spec.rb
Outdated
@@ -208,6 +208,119 @@ | |||
end | |||
end | |||
|
|||
context "#info('68')", vcr: { cassette_name: 'launches/68' } do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context "#info('68')", vcr: { cassette_name: 'launches/68' } do | |
context '#info(68)', vcr: { cassette_name: 'launches/68' } do |
spec/spacex/launches_spec.rb
Outdated
@@ -208,6 +208,119 @@ | |||
end | |||
end | |||
|
|||
context "#info('68')", vcr: { cassette_name: 'launches/68' } do | |||
subject do | |||
SPACEX::Launches.info('68') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SPACEX::Launches.info('68') | |
SPACEX::Launches.info(68) |
'tentative_max_precision' => 'hour', | ||
'rocket' => { | ||
'rocket_id' => 'falcon9', | ||
'rocket_name' => 'Falcon 9', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're trying to test here not only the response but how we can access this information via SPACEX gem.
I would add at least another test in addition to this (doesn't need to have all the fields. but at least two or three.) Something to test like:
expect(subject.rocket.rocket_name).to eq('Falcon 9')
No problem @rodolfobandeira! I made changes for all of your suggestions and added some more tests. Let me know what you think. As for updating README.md with an example, do you mean there should there be another code snippet under the launches section like so?: require 'spacex'
launch_68 = SPACEX::Launches.info(68)
launch_68.flight_number # 68
launch_68.mission_name # 'Telstar 18V'
... And if so should I list out every single field in that snippet or just a few? |
@mtking2 Perfect. Just a few lines like your example sounds great! |
@rodolfobandeira Example has been added 👍 |
Hey @mtking2 I created a PR on your branch to fix these remaining Rubocop issues. Please merge that and we're good to go! Cheers |
Fix implement one launch Rubocop