Class: Dependabot::PullRequestUpdater

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/pull_request_updater.rb,
lib/dependabot/pull_request_updater/azure.rb,
lib/dependabot/pull_request_updater/github.rb,
lib/dependabot/pull_request_updater/gitlab.rb

Defined Under Namespace

Classes: Azure, BranchProtected, Github, Gitlab

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, base_commit:, old_commit:, files:, credentials:, pull_request_number:, author_details: nil, signature_key: nil, provider_metadata: {}) ⇒ PullRequestUpdater

Returns a new instance of PullRequestUpdater.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/dependabot/pull_request_updater.rb', line 57

def initialize(source:, base_commit:, old_commit:, files:,
               credentials:, pull_request_number:,
               author_details: nil, signature_key: nil,
               provider_metadata: {})
  @source              = source
  @base_commit         = base_commit
  @old_commit          = old_commit
  @files               = files
  @credentials         = credentials
  @pull_request_number = pull_request_number
  @author_details      = author_details
  @signature_key       = signature_key
  @provider_metadata   = 
end

Instance Attribute Details

#author_detailsObject (readonly)

Returns the value of attribute author_details.



35
36
37
# File 'lib/dependabot/pull_request_updater.rb', line 35

def author_details
  @author_details
end

#base_commitObject (readonly)

Returns the value of attribute base_commit.



23
24
25
# File 'lib/dependabot/pull_request_updater.rb', line 23

def base_commit
  @base_commit
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



29
30
31
# File 'lib/dependabot/pull_request_updater.rb', line 29

def credentials
  @credentials
end

#filesObject (readonly)

Returns the value of attribute files.



20
21
22
# File 'lib/dependabot/pull_request_updater.rb', line 20

def files
  @files
end

#old_commitObject (readonly)

Returns the value of attribute old_commit.



26
27
28
# File 'lib/dependabot/pull_request_updater.rb', line 26

def old_commit
  @old_commit
end

#provider_metadataObject (readonly)

Returns the value of attribute provider_metadata.



41
42
43
# File 'lib/dependabot/pull_request_updater.rb', line 41

def 
  @provider_metadata
end

#pull_request_numberObject (readonly)

Returns the value of attribute pull_request_number.



32
33
34
# File 'lib/dependabot/pull_request_updater.rb', line 32

def pull_request_number
  @pull_request_number
end

#signature_keyObject (readonly)

Returns the value of attribute signature_key.



38
39
40
# File 'lib/dependabot/pull_request_updater.rb', line 38

def signature_key
  @signature_key
end

#sourceObject (readonly)

Returns the value of attribute source.



17
18
19
# File 'lib/dependabot/pull_request_updater.rb', line 17

def source
  @source
end

Instance Method Details

#updateObject



75
76
77
78
79
80
81
82
# File 'lib/dependabot/pull_request_updater.rb', line 75

def update
  case source.provider
  when "github" then github_updater.update
  when "gitlab" then gitlab_updater.update
  when "azure" then azure_updater.update
  else raise "Unsupported provider #{source.provider}"
  end
end