Class: ScalarGalaxy::Resources::Planets
- Inherits:
-
Object
- Object
- ScalarGalaxy::Resources::Planets
- Defined in:
- lib/galaxy-ruby/resources/planets.rb,
sig/galaxy-ruby/resources/planets.rbs
Overview
Everything about planets
Instance Method Summary collapse
-
#create(id:, name:, atmosphere: nil, creator: nil, description: nil, discovered_at: nil, failure_callback_url: nil, habitability_index: nil, image: nil, last_updated: nil, physical_properties: nil, satellites: nil, success_callback_url: nil, tags: nil, type: nil, request_options: {}) ⇒ ScalarGalaxy::Models::Planet
Time to play god and create a new planet.
-
#delete(planet_id, request_options: {}) ⇒ nil
This endpoint was used to delete planets.
-
#delte_image(planet_id, image: nil, request_options: {}) ⇒ ScalarGalaxy::Models::PlanetDelteImageResponse
Got a crazy good photo of a planet? Share it with the world!.
-
#initialize(client:) ⇒ Planets
constructor
private
A new instance of Planets.
-
#list_all_data(limit: nil, offset: nil, request_options: {}) ⇒ ScalarGalaxy::Models::PlanetListAllDataResponse
It's easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.
-
#retrieve(planet_id, request_options: {}) ⇒ ScalarGalaxy::Models::Planet
You'll better learn a little bit more about the planets.
-
#update(planet_id, id:, name:, atmosphere: nil, creator: nil, description: nil, discovered_at: nil, failure_callback_url: nil, habitability_index: nil, image: nil, last_updated: nil, physical_properties: nil, satellites: nil, success_callback_url: nil, tags: nil, type: nil, request_options: {}) ⇒ ScalarGalaxy::Models::Planet
Sometimes you make mistakes, that's fine.
Constructor Details
#initialize(client:) ⇒ Planets
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Planets.
210 211 212 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 210 def initialize(client:) @client = client end |
Instance Method Details
#create(id:, name:, atmosphere: nil, creator: nil, description: nil, discovered_at: nil, failure_callback_url: nil, habitability_index: nil, image: nil, last_updated: nil, physical_properties: nil, satellites: nil, success_callback_url: nil, tags: nil, type: nil, request_options: {}) ⇒ ScalarGalaxy::Models::Planet
Time to play god and create a new planet. What do you think? Ah, don't think too much. What could go wrong anyway?
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 47 def create(params) parsed, = ScalarGalaxy::PlanetCreateParams.dump_request(params) @client.request( method: :post, path: "planets", body: parsed, model: ScalarGalaxy::Planet, options: ) end |
#delete(planet_id, request_options: {}) ⇒ nil
This endpoint was used to delete planets. Unfortunately, that caused a lot of trouble for planets with life. So, this endpoint is now deprecated and should not be used anymore.
145 146 147 148 149 150 151 152 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 145 def delete(planet_id, params = {}) @client.request( method: :delete, path: ["planets/%1$s", planet_id], model: NilClass, options: params[:request_options] ) end |
#delte_image(planet_id, image: nil, request_options: {}) ⇒ ScalarGalaxy::Models::PlanetDelteImageResponse
Got a crazy good photo of a planet? Share it with the world!
167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 167 def delte_image(planet_id, params = {}) parsed, = ScalarGalaxy::PlanetDelteImageParams.dump_request(params) @client.request( method: :post, path: ["planets/%1$s/image", planet_id], headers: { "content-type" => "multipart/form-data" }, body: parsed, model: ScalarGalaxy::Models::PlanetDelteImageResponse, options: ) end |
#list_all_data(limit: nil, offset: nil, request_options: {}) ⇒ ScalarGalaxy::Models::PlanetListAllDataResponse
It's easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.
195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 195 def list_all_data(params = {}) parsed, = ScalarGalaxy::PlanetListAllDataParams.dump_request(params) query = ScalarGalaxy::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "planets", query: query, model: ScalarGalaxy::Models::PlanetListAllDataResponse, options: ) end |
#retrieve(planet_id, request_options: {}) ⇒ ScalarGalaxy::Models::Planet
You'll better learn a little bit more about the planets. It might come in handy once space travel is available for everyone.
70 71 72 73 74 75 76 77 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 70 def retrieve(planet_id, params = {}) @client.request( method: :get, path: ["planets/%1$s", planet_id], model: ScalarGalaxy::Planet, options: params[:request_options] ) end |
#update(planet_id, id:, name:, atmosphere: nil, creator: nil, description: nil, discovered_at: nil, failure_callback_url: nil, habitability_index: nil, image: nil, last_updated: nil, physical_properties: nil, satellites: nil, success_callback_url: nil, tags: nil, type: nil, request_options: {}) ⇒ ScalarGalaxy::Models::Planet
Sometimes you make mistakes, that's fine. No worries, you can update all planets.
121 122 123 124 125 126 127 128 129 130 |
# File 'lib/galaxy-ruby/resources/planets.rb', line 121 def update(planet_id, params) parsed, = ScalarGalaxy::PlanetUpdateParams.dump_request(params) @client.request( method: :put, path: ["planets/%1$s", planet_id], body: parsed, model: ScalarGalaxy::Planet, options: ) end |