Class: PullRequest

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

Overview

This class represents GitHub Pull Request abstraction. In the future, it might be any Pull or Merge request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, title, description, url: 'undefined') ⇒ PullRequest

Returns a new instance of PullRequest.



30
31
32
33
34
35
# File 'lib/newsman/pull_request.rb', line 30

def initialize(repository, title, description, url: 'undefined')
  @repository = repository
  @title = title
  @description = description
  @url = url
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



27
28
29
# File 'lib/newsman/pull_request.rb', line 27

def description
  @description
end

#repositoryObject

Returns the value of attribute repository.



27
28
29
# File 'lib/newsman/pull_request.rb', line 27

def repository
  @repository
end

#titleObject

Returns the value of attribute title.



27
28
29
# File 'lib/newsman/pull_request.rb', line 27

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



28
29
30
# File 'lib/newsman/pull_request.rb', line 28

def url
  @url
end

Instance Method Details

#detailed_titleObject



50
51
52
# File 'lib/newsman/pull_request.rb', line 50

def detailed_title
  "title: #{@title}, repo: #{@repository}, url: #{@url}"
end

#to_json(*_args) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/newsman/pull_request.rb', line 37

def to_json(*_args)
  {
    title: @title,
    description: @description,
    repository: @repository,
    url: @url
  }.to_json
end

#to_sObject



46
47
48
# File 'lib/newsman/pull_request.rb', line 46

def to_s
  "title: ```#{@title}```,\ndescription: ```#{@description}```,\nrepo: ```#{@repository}```\n"
end