Class: Heroku::Model::App

Inherits:
Struct
  • Object
show all
Includes:
ModelHelper
Defined in:
lib/heroku/model/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ModelHelper

#identifier, #struct_init_from_hash, #sub_struct_as_hash

Constructor Details

#initialize(params = {}) ⇒ App

Returns a new instance of App.



31
32
33
# File 'lib/heroku/model/app.rb', line 31

def initialize(params = {})
  super(*struct_init_from_hash(params))
end

Instance Attribute Details

#archived_atObject

Returns the value of attribute archived_at

Returns:

  • (Object)

    the current value of archived_at



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def archived_at
  @archived_at
end

#buildpack_provided_descriptionObject

Returns the value of attribute buildpack_provided_description

Returns:

  • (Object)

    the current value of buildpack_provided_description



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def buildpack_provided_description
  @buildpack_provided_description
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def created_at
  @created_at
end

#git_urlObject

Returns the value of attribute git_url

Returns:

  • (Object)

    the current value of git_url



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def git_url
  @git_url
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def id
  @id
end

#maintenanceObject

Returns the value of attribute maintenance

Returns:

  • (Object)

    the current value of maintenance



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def maintenance
  @maintenance
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def name
  @name
end

#ownerObject

Returns the value of attribute owner

Returns:

  • (Object)

    the current value of owner



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def owner
  @owner
end

#parentObject

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def parent
  @parent
end

#regionObject

Returns the value of attribute region

Returns:

  • (Object)

    the current value of region



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def region
  @region
end

#released_atObject

Returns the value of attribute released_at

Returns:

  • (Object)

    the current value of released_at



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def released_at
  @released_at
end

#repo_sizeObject

Returns the value of attribute repo_size

Returns:

  • (Object)

    the current value of repo_size



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def repo_size
  @repo_size
end

#slug_sizeObject

Returns the value of attribute slug_size

Returns:

  • (Object)

    the current value of slug_size



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def slug_size
  @slug_size
end

#stackObject

Returns the value of attribute stack

Returns:

  • (Object)

    the current value of stack



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def stack
  @stack
end

#updated_atObject

Returns the value of attribute updated_at

Returns:

  • (Object)

    the current value of updated_at



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def updated_at
  @updated_at
end

#web_urlObject

Returns the value of attribute web_url

Returns:

  • (Object)

    the current value of web_url



6
7
8
# File 'lib/heroku/model/app.rb', line 6

def web_url
  @web_url
end

Instance Method Details

#destroyObject



65
66
67
# File 'lib/heroku/model/app.rb', line 65

def destroy
  parent.delete_app(self)
end

#end_pointObject



57
58
59
# File 'lib/heroku/model/app.rb', line 57

def end_point
  "/apps/#{id}"
end

#identifiableObject



53
54
55
# File 'lib/heroku/model/app.rb', line 53

def identifiable
  sub_struct_as_hash(:id, :name)
end

#inspectObject



27
28
29
# File 'lib/heroku/model/app.rb', line 27

def inspect
  "#<#{self.class.name} #{identifier}>"
end

#patchableObject



49
50
51
# File 'lib/heroku/model/app.rb', line 49

def patchable
  sub_struct_as_hash(:maintenance, :name)
end

#push(dir) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/heroku/model/app.rb', line 35

def push(dir)
  begin
    Git.open(dir, log: Heroku::Properties.logger).push(git_url)
    true
  rescue => e
    Heroku::Properties.logger.error(e.message)
    e.backtrace.each do |line|
      Heroku::Properties.logger.error(line)
    end

    false
  end
end

#saveObject



61
62
63
# File 'lib/heroku/model/app.rb', line 61

def save
  parent.update_app(self)
end