Class: Lita::Handlers::Digitalocean::Image
- Defined in:
- lib/lita/handlers/digitalocean/image.rb
Instance Method Summary collapse
Instance Method Details
#delete(response) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/lita/handlers/digitalocean/image.rb', line 19 def delete(response) image_id = response.args[2] do_response = do_call(response) do |client| client.images.delete(image_id) end or return response.reply(t("images.delete.deleted", image_id: image_id)) end |
#list(response) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/lita/handlers/digitalocean/image.rb', line 29 def list(response) filter = response.args[2] normalized_filter = filter.to_s.downcase = {} if filter && %(global my_images).include?(normalized_filter) [:filter] = normalized_filter end do_response = do_call(response) do |client| client.images.list() end or return = do_response[:images].map { |image| t("images.details", formatted_image(image)) } response.reply(*) end |
#show(response) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/lita/handlers/digitalocean/image.rb', line 47 def show(response) image_id = response.args[2] do_response = do_call(response) do |client| client.images.show(image_id) end or return response.reply(t("images.details", formatted_image(do_response[:image]))) end |