Class: BeamUp::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/beam_up/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, deploy_id: nil, url: nil, error: nil, api_key: nil) ⇒ Result

Returns a new instance of Result.



7
8
9
10
11
12
13
# File 'lib/beam_up/result.rb', line 7

def initialize(provider:, deploy_id: nil, url: nil, error: nil, api_key: nil)
  @provider = provider
  @deploy_id = deploy_id
  @url = url
  @error = error
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



5
6
7
# File 'lib/beam_up/result.rb', line 5

def api_key
  @api_key
end

#deploy_idObject (readonly)

Returns the value of attribute deploy_id.



5
6
7
# File 'lib/beam_up/result.rb', line 5

def deploy_id
  @deploy_id
end

#errorObject (readonly)

Returns the value of attribute error.



5
6
7
# File 'lib/beam_up/result.rb', line 5

def error
  @error
end

#providerObject (readonly)

Returns the value of attribute provider.



5
6
7
# File 'lib/beam_up/result.rb', line 5

def provider
  @provider
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


17
# File 'lib/beam_up/result.rb', line 17

def failure? = !success?

#messageObject



19
20
21
22
23
24
25
# File 'lib/beam_up/result.rb', line 19

def message
  if success?
    "Successfully deployed to #{@provider}#{" at #{@url}" if @url}"
  else
    "Deployment to #{@provider} failed: #{@error}"
  end
end

#success?Boolean

Returns:

  • (Boolean)


15
# File 'lib/beam_up/result.rb', line 15

def success? = @error.nil?