-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a very basic history endpoint as described in the issue #39 This doesn't support all the filters that are described in the documentation provided here https://documenter.getpostman.com/view/2025350/RWaEzAiG#9f1dfdc0-fbe8-4ae5-9209-7f3d649a627c but it does support the basic functionality of retrieving all the historical events or a specific historical event by passing an id
- Loading branch information
Showing
5 changed files
with
188 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module SPACEX | ||
module History | ||
def self.info(id = nil) | ||
SPACEX::BaseRequest.info("history/#{id}") | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'spec_helper' | ||
|
||
describe SPACEX::History do | ||
context '#info', vcr: { cassette_name: 'history/info' } do | ||
subject do | ||
SPACEX::History.info | ||
end | ||
|
||
it 'returns all historical events when no id is passed' do | ||
first_subject = subject.first | ||
expect(first_subject.id).to eq 1 | ||
expect(first_subject.title).to eq 'Falcon 1 Makes History' | ||
expect(first_subject.event_date_utc).to eq '2008-09-28T23:15:00Z' | ||
expect(first_subject.event_date_unix).to eq 1_222_643_700 | ||
expect(first_subject.flight_number).to eq 4 | ||
expect(first_subject.details).to eq( | ||
'Falcon 1 becomes the first privately '\ | ||
'developed liquid fuel rocket to reach Earth orbit.' | ||
) | ||
expect(first_subject.links).to eq( | ||
'reddit' => nil, | ||
'article' => 'http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0', | ||
'wikipedia' => 'https://en.wikipedia.org/wiki/Falcon_1' | ||
) | ||
end | ||
end | ||
|
||
context "#info('4')", vcr: { cassette_name: 'history/info/4' } do | ||
subject do | ||
SPACEX::History.info(4) | ||
end | ||
|
||
it 'returns Historical event info for event id 4' do | ||
expect(subject.id).to eq 4 | ||
expect(subject.title).to eq 'Falcon 9 First Flight' | ||
expect(subject.event_date_utc).to eq '2010-06-04T18:45:00Z' | ||
expect(subject.event_date_unix).to eq 1_275_677_100 | ||
expect(subject.flight_number).to eq 6 | ||
expect(subject.details).to eq( | ||
'Met 100% of mission objectives on the first flight!' | ||
) | ||
expect(subject.links).to eq( | ||
'reddit' => nil, | ||
'article' => 'http://www.bbc.com/news/10209704', | ||
'wikipedia' => | ||
'https://en.wikipedia.org/wiki/Dragon_Spacecraft_Qualification_Unit' | ||
) | ||
end | ||
end | ||
end |