Sha256: 9425660e55ba8b1f6abbb5f8f7fee13cf9e719586ae23bbd44310294c98bbb3a

Contents?: true

Size: 651 Bytes

Versions: 5

Compression:

Stored size: 651 Bytes

Contents

require 'hammer_cli/output/dsl'

module HammerCLI::Apipie

  class ReadCommand < Command

      def execute
        d = retrieve_data
        logger.debug "Retrieved data: " + d.ai(:raw => true) if HammerCLI::Settings.get(:log_api_calls)
        print_data d
        return HammerCLI::EX_OK
      end

      protected
      def retrieve_data
        raise "resource or action not defined" unless self.class.resource_defined?
        resource.call(action, request_params)[0]
      end

      def print_data(records)
        print_collection(output_definition, records)
      end

      def request_params
        method_options
      end

  end

end


Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hammer_cli-0.0.16 lib/hammer_cli/apipie/read_command.rb
hammer_cli-0.0.15 lib/hammer_cli/apipie/read_command.rb
hammer_cli-0.0.14 lib/hammer_cli/apipie/read_command.rb
hammer_cli-0.0.13 lib/hammer_cli/apipie/read_command.rb
hammer_cli-0.0.12 lib/hammer_cli/apipie/read_command.rb