Module: Jets::Command::ApiHelpers

Extended by:
ActiveSupport::Concern
Includes:
Api
Included in:
Jets::Cfn::Deployment, Base, Release, Rollback
Defined in:
lib/jets/command/api_helpers.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#check_for_error_message!(resp) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/jets/command/api_helpers.rb', line 15

def check_for_error_message!(resp)
  # IE: {"error":"Invalid token. Please check your token in ~/.jets/config.yml"}
  if resp && resp["error"]
    $stderr.puts "ERROR: #{resp["error"]}"
    exit 1
  end
  resp
end

#no_token_exit!Object



8
9
10
11
12
13
# File 'lib/jets/command/api_helpers.rb', line 8

def no_token_exit!
  return if Jets::Api.token
  puts "ERROR: This command requires Jets Api".color(:red)
  puts "Please run `jets configure` first"
  exit 1
end

#paging_paramsObject



24
25
26
27
28
29
30
# File 'lib/jets/command/api_helpers.rb', line 24

def paging_params
  Jets.boot
  params = {}
  params[:page] = @options[:page] if @options[:page]
  params[:order] = @options[:order] if @options[:order]
  params
end