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

Implement Specific (One) Launch #48

Merged
merged 18 commits into from
Oct 23, 2018

Conversation

mtking2
Copy link
Contributor

@mtking2 mtking2 commented Oct 20, 2018

Copy link
Collaborator

@invacuo invacuo left a 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!

@@ -12,8 +12,8 @@ def self.all
SPACEX::BaseRequest.info('launches')
Copy link
Collaborator

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.
Copy link
Collaborator

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')`
Copy link
Collaborator

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

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
Copy link
Collaborator

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.

@mtking2
Copy link
Contributor Author

mtking2 commented Oct 20, 2018

@invacuo I think I've taken care of each of your comments. Can you double check spec/spacex/launches_spec.rb and make sure that will work? Running that test with the entire hash seems to work great.

Copy link
Owner

@rodolfobandeira rodolfobandeira left a 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')`
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
- `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')`
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
- 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)`

@@ -208,6 +208,119 @@
end
end

context "#info('68')", vcr: { cassette_name: 'launches/68' } do
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
context "#info('68')", vcr: { cassette_name: 'launches/68' } do
context '#info(68)', vcr: { cassette_name: 'launches/68' } do

@@ -208,6 +208,119 @@
end
end

context "#info('68')", vcr: { cassette_name: 'launches/68' } do
subject do
SPACEX::Launches.info('68')
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
SPACEX::Launches.info('68')
SPACEX::Launches.info(68)

'tentative_max_precision' => 'hour',
'rocket' => {
'rocket_id' => 'falcon9',
'rocket_name' => 'Falcon 9',
Copy link
Owner

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')

@mtking2
Copy link
Contributor Author

mtking2 commented Oct 20, 2018

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?

@rodolfobandeira
Copy link
Owner

@mtking2 Perfect. Just a few lines like your example sounds great!

@mtking2
Copy link
Contributor Author

mtking2 commented Oct 21, 2018

@rodolfobandeira Example has been added 👍

@rodolfobandeira
Copy link
Owner

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

@rodolfobandeira rodolfobandeira merged commit 2889aa7 into rodolfobandeira:master Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants