Class: OpsWorks::App

Inherits:
Resource show all
Defined in:
lib/opsworks/app.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

account, #initialize

Constructor Details

This class inherits a constructor from OpsWorks::Resource

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/opsworks/app.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/opsworks/app.rb', line 3

def name
  @name
end

#revisionObject

Returns the value of attribute revision.



3
4
5
# File 'lib/opsworks/app.rb', line 3

def revision
  @revision
end

Class Method Details

.from_collection_response(client, response) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/opsworks/app.rb', line 5

def self.from_collection_response(client, response)
  response.data[:apps].map do |app|
    hash = app.to_h
    revision = hash[:app_source][:revision] if hash[:app_source]
    new(client, id: hash[:app_id], name: hash[:name], revision: revision)
  end
end

Instance Method Details

#deploymentsObject



13
14
15
# File 'lib/opsworks/app.rb', line 13

def deployments
  @deployments ||= initialize_deployments
end

#last_deploymentObject



17
18
19
# File 'lib/opsworks/app.rb', line 17

def last_deployment
  deployments.find(&:success?)
end

#update_revision(revision) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/opsworks/app.rb', line 21

def update_revision(revision)
  client.update_app(
    app_id: id,
    app_source: { revision: revision }
  )

  self.revision = revision
end