Class: ChangelogGenerator::PullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/changelog_generator/pull_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ PullRequest

Returns a new instance of PullRequest.



22
23
24
25
26
# File 'lib/changelog_generator/pull_request.rb', line 22

def initialize(args)
  args.each do |k,v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/changelog_generator/pull_request.rb', line 4

def body
  @body
end

#changelog_textObject

Returns the value of attribute changelog_text.



6
7
8
# File 'lib/changelog_generator/pull_request.rb', line 6

def changelog_text
  @changelog_text
end

#head_shaObject

Returns the value of attribute head_sha.



7
8
9
# File 'lib/changelog_generator/pull_request.rb', line 7

def head_sha
  @head_sha
end

#issuesObject

Returns the value of attribute issues.



9
10
11
# File 'lib/changelog_generator/pull_request.rb', line 9

def issues
  @issues
end

#merged_atObject

Returns the value of attribute merged_at.



8
9
10
# File 'lib/changelog_generator/pull_request.rb', line 8

def merged_at
  @merged_at
end

#numberObject

Returns the value of attribute number.



5
6
7
# File 'lib/changelog_generator/pull_request.rb', line 5

def number
  @number
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/changelog_generator/pull_request.rb', line 3

def title
  @title
end

Class Method Details

.from_github_pr(github_pr) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/changelog_generator/pull_request.rb', line 11

def self.from_github_pr(github_pr)
  self.new({
    title: github_pr['title'],
    body: github_pr.body.body,
    number: github_pr['number'],
    changelog_text: changelog_from_pr(github_pr),
    head_sha: github_pr.head.sha,
    merged_at: github_pr.merged_at
    })
end