Sha256: 12d9927cc03ac6c58dc35f146f7a453b7e52c55145a95781aa66f61d31905648

Contents?: true

Size: 685 Bytes

Versions: 17

Compression:

Stored size: 685 Bytes

Contents

# -*- coding: utf-8 -*-
require "magellan/cli/resources"

module Magellan
  module Cli
    module Resources

      module Deletable

        def self.included(klass)
          klass.module_eval do

            desc "delete NAME", I18n.t(:delete, scope: [:resources, :common, :cmd], resource_name: resource_name)
            def delete(name)
              q = build_query("name" => name).update(default_query)
              r = get_first_result!(self.class.resource_name, name, "/admin/#{resource_key}.json", q)
              super("/admin/#{resource_key}/#{r['id']}/delete.json")
              log_success("OK")
            end

          end
        end

      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
magellan-cli-0.11.1 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.11.0 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.10.0 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.9.1 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.9.0 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.8.3 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.8.2 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.8.1 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.8.0 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.11 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.10 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.9 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.8 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.7 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.6 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.5 lib/magellan/cli/resources/deletable.rb
magellan-cli-0.7.4 lib/magellan/cli/resources/deletable.rb