-
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 Rockets endpoint #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module SPACEX | ||
class Rockets < Hashie::Trash | ||
include Hashie::Extensions::IgnoreUndeclared | ||
|
||
property 'id' | ||
property 'active' | ||
property 'stages' | ||
property 'boosters' | ||
property 'cost_per_launch' | ||
property 'success_rate_pct' | ||
property 'first_flight' | ||
property 'country' | ||
property 'company' | ||
property 'height' | ||
property 'diameter' | ||
property 'mass' | ||
property 'payload_weights' | ||
property 'first_stage' | ||
property 'second_stage' | ||
property 'engines' | ||
property 'landing_legs' | ||
property 'wikipedia' | ||
property 'description' | ||
property 'rocket_id' | ||
property 'rocket_name' | ||
property 'rocket_type' | ||
|
||
class << self | ||
def info(rocket_id = nil) | ||
get(rocket_id) | ||
end | ||
|
||
private | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason some endpoints have this I saw your other comments regarding this and I agree with you specially because our release is still at minor versions By the way, I got your twitter message. You're more than welcome to help out! |
||
|
||
def retrieve_all | ||
data = SPACEX::BaseRequest.call_api('rockets') | ||
data.get.body.map { |k| SPACEX::Rockets.new(k) } | ||
end | ||
|
||
def get(rocket_id = nil) | ||
return retrieve_all if rocket_id.nil? | ||
|
||
data = SPACEX::BaseRequest.get("rockets/#{rocket_id}") | ||
SPACEX::Rockets.new(data) | ||
end | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Any reason for skipping the example like we did with all methods? Do you feel that it is an overhead adding examples for each method?