Class: DemoApiScalarGalaxy::Resources::Planets
- Inherits:
-
Object
- Object
- DemoApiScalarGalaxy::Resources::Planets
- Defined in:
- lib/amritk-galaxy-staging/resources/planets.rb,
sig/amritk-galaxy-staging/resources/planets.rbs
Overview
Everything about planets
Instance Method Summary collapse
-
#create(id:, name:, type:, 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, request_options: {}) ⇒ DemoApiScalarGalaxy::Models::Planet
Time to play god and create a new planet.
-
#delete(planet_id, request_options: {}) ⇒ nil
This endpoint was used to delete planets.
-
#initialize(client:) ⇒ Planets
constructor
private
A new instance of Planets.
-
#list(limit: nil, offset: nil, request_options: {}) ⇒ DemoApiScalarGalaxy::Models::PlanetListResponse
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: {}) ⇒ DemoApiScalarGalaxy::Models::Planet
You'll better learn a little bit more about the planets.
-
#update(planet_id, id:, name:, type:, 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, request_options: {}) ⇒ DemoApiScalarGalaxy::Models::Planet
Sometimes you make mistakes, that's fine.
-
#upload_image(planet_id, image: nil, request_options: {}) ⇒ DemoApiScalarGalaxy::Models::PlanetUploadImageResponse
Got a crazy good photo of a planet? Share it with the world!.
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/amritk-galaxy-staging/resources/planets.rb', line 210 def initialize(client:) @client = client end |
Instance Method Details
#create(id:, name:, type:, 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, request_options: {}) ⇒ DemoApiScalarGalaxy::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/amritk-galaxy-staging/resources/planets.rb', line 47 def create(params) parsed, = DemoApiScalarGalaxy::PlanetCreateParams.dump_request(params) @client.request( method: :post, path: "planets", body: parsed, model: DemoApiScalarGalaxy::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.
171 172 173 174 175 176 177 178 |
# File 'lib/amritk-galaxy-staging/resources/planets.rb', line 171 def delete(planet_id, params = {}) @client.request( method: :delete, path: ["planets/%1$s", planet_id], model: NilClass, options: params[:request_options] ) end |
#list(limit: nil, offset: nil, request_options: {}) ⇒ DemoApiScalarGalaxy::Models::PlanetListResponse
It's easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/amritk-galaxy-staging/resources/planets.rb', line 146 def list(params = {}) parsed, = DemoApiScalarGalaxy::PlanetListParams.dump_request(params) query = DemoApiScalarGalaxy::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "planets", query: query, model: DemoApiScalarGalaxy::Models::PlanetListResponse, options: ) end |
#retrieve(planet_id, request_options: {}) ⇒ DemoApiScalarGalaxy::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/amritk-galaxy-staging/resources/planets.rb', line 70 def retrieve(planet_id, params = {}) @client.request( method: :get, path: ["planets/%1$s", planet_id], model: DemoApiScalarGalaxy::Planet, options: params[:request_options] ) end |
#update(planet_id, id:, name:, type:, 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, request_options: {}) ⇒ DemoApiScalarGalaxy::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/amritk-galaxy-staging/resources/planets.rb', line 121 def update(planet_id, params) parsed, = DemoApiScalarGalaxy::PlanetUpdateParams.dump_request(params) @client.request( method: :put, path: ["planets/%1$s", planet_id], body: parsed, model: DemoApiScalarGalaxy::Planet, options: ) end |
#upload_image(planet_id, image: nil, request_options: {}) ⇒ DemoApiScalarGalaxy::Models::PlanetUploadImageResponse
Got a crazy good photo of a planet? Share it with the world!
193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/amritk-galaxy-staging/resources/planets.rb', line 193 def upload_image(planet_id, params = {}) parsed, = DemoApiScalarGalaxy::PlanetUploadImageParams.dump_request(params) @client.request( method: :post, path: ["planets/%1$s/image", planet_id], headers: { "content-type" => "multipart/form-data" }, body: parsed, model: DemoApiScalarGalaxy::Models::PlanetUploadImageResponse, options: ) end |