Class: Crowbar::Client::Command::Batch::Export

Inherits:
Crowbar::Client::Command::Base show all
Defined in:
lib/crowbar/client/command/batch/export.rb

Overview

Implementation for the batch export command

Instance Attribute Summary

Attributes inherited from Crowbar::Client::Command::Base

#args, #options, #stderr, #stdin, #stdout

Instance Method Summary collapse

Methods inherited from Crowbar::Client::Command::Base

#initialize

Constructor Details

This class inherits a constructor from Crowbar::Client::Command::Base

Instance Method Details

#executeObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/crowbar/client/command/batch/export.rb', line 39

def execute
  request.process do |request|
    case request.code
    when 200
      if write(request.parsed_response)
        say "Successfully exported batch"
      else
        err "Failed to export batch"
      end
    else
      err request.parsed_response["error"]
    end
  end
end

#requestObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/crowbar/client/command/batch/export.rb', line 28

def request
  args.easy_merge!(
    includes: options.includes,
    excludes: options.excludes
  )

  @request ||= Request::Batch::Export.new(
    args
  )
end