Sha256: 949de75fc0ad25907b09b2942292bb081caf3d818183a3de35b2adfc59f4cc3d

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 Bytes

Contents

module Localeapp
  module CLI
    class Rename < Command
      include ::Localeapp::ApiCall

      def execute(current_name, new_name,  *rest)
        @output.puts "Localeapp mv"
        @output.puts ""
        @output.puts "Renaming key: #{current_name} to #{new_name}"
        api_call :rename,
          :url_options => { :current_name => current_name },
          :payload => { :new_name => new_name },
          :success => :report_success,
          :failure => :report_failure,
          :max_connection_attempts => 1
      end

      def report_success(response)
        @output.puts "Success!"
      end

      def report_failure(response)
        @output.puts "Failed!"
        fail APIResponseError, "API returned #{response.code} status code"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
localeapp-3.3.0 lib/localeapp/cli/rename.rb
localeapp-3.2.0 lib/localeapp/cli/rename.rb
localeapp-3.1.3 lib/localeapp/cli/rename.rb
localeapp-3.1.2 lib/localeapp/cli/rename.rb
localeapp-3.1.1 lib/localeapp/cli/rename.rb
localeapp-3.1.0 lib/localeapp/cli/rename.rb
localeapp-3.0.1 lib/localeapp/cli/rename.rb
localeapp-3.0.0 lib/localeapp/cli/rename.rb
localeapp-2.5.0 lib/localeapp/cli/rename.rb
localeapp-2.4.0 lib/localeapp/cli/rename.rb
localeapp-2.3.0 lib/localeapp/cli/rename.rb
localeapp-2.2.0 lib/localeapp/cli/rename.rb