Class: Honeybadger::Api::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger-api/deploy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Deploy

Public: Build a new instance of Deploy

opts - A Hash of attributes to initialize a Deploy

Returns a new Deploy



12
13
14
15
16
17
18
19
20
# File 'lib/honeybadger-api/deploy.rb', line 12

def initialize(opts)
  @id = opts[:id]
  @project_id = opts[:project_id]
  @repository = opts[:repository]
  @revision = opts[:revision]
  @environment = opts[:environment]
  @local_username = opts[:local_username]
  @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def created_at
  @created_at
end

#environmentObject (readonly)

Returns the value of attribute environment.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def id
  @id
end

#local_usernameObject (readonly)

Returns the value of attribute local_username.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def local_username
  @local_username
end

#project_idObject (readonly)

Returns the value of attribute project_id.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def project_id
  @project_id
end

#repositoryObject (readonly)

Returns the value of attribute repository.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def repository
  @repository
end

#revisionObject (readonly)

Returns the value of attribute revision.



5
6
7
# File 'lib/honeybadger-api/deploy.rb', line 5

def revision
  @revision
end

Class Method Details

.all(project_id) ⇒ Object

Public: Find all deploys for a given project.



23
24
25
26
# File 'lib/honeybadger-api/deploy.rb', line 23

def self.all(project_id)
  path = "projects/#{project_id}/deploys"
  Honeybadger::Api::Request.all(path, handler)
end

.find(project_id, deploy_id) ⇒ Object

Public: Find a deploy for a given project.



35
36
37
38
# File 'lib/honeybadger-api/deploy.rb', line 35

def self.find(project_id, deploy_id)
  path = "projects/#{project_id}/deploys/#{deploy_id}"
  Honeybadger::Api::Request.find(path, handler)
end

.handlerObject

Internal: The handler used to build objects from API responses.



41
42
43
# File 'lib/honeybadger-api/deploy.rb', line 41

def self.handler
  Proc.new { |response| Deploy.new(response) }
end

.paginate(project_id, filters = {}) ⇒ Object

Public: Paginate all deploys for a given project



29
30
31
32
# File 'lib/honeybadger-api/deploy.rb', line 29

def self.paginate(project_id, filters = {})
  path = "projects/#{project_id}/deploys"
  Honeybadger::Api::Request.paginate(path, handler, filters)
end