Class: GitWand::GitHub::Resource::PullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/git_wand/github/resource/pull_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def body
  @body
end

#closed_atObject

Returns the value of attribute closed_at.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def closed_at
  @closed_at
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def created_at
  @created_at
end

#head_shaObject

Returns the value of attribute head_sha.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def head_sha
  @head_sha
end

#html_urlObject

Returns the value of attribute html_url.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def html_url
  @html_url
end

#issue_urlObject

Returns the value of attribute issue_url.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def issue_url
  @issue_url
end

#lockedObject

Returns the value of attribute locked.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def locked
  @locked
end

#merged_atObject

Returns the value of attribute merged_at.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def merged_at
  @merged_at
end

#numberObject

Returns the value of attribute number.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def number
  @number
end

#stateObject

Returns the value of attribute state.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def state
  @state
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def title
  @title
end

#updated_atObject

Returns the value of attribute updated_at.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def updated_at
  @updated_at
end

#userObject

Returns the value of attribute user.



7
8
9
# File 'lib/git_wand/github/resource/pull_request.rb', line 7

def user
  @user
end

Class Method Details

.build_from_api_result(result) ⇒ Object



9
10
11
12
# File 'lib/git_wand/github/resource/pull_request.rb', line 9

def self.build_from_api_result(result)
  return unless result.success?
  resource = build_from_result_body(result.body)
end

.build_from_result_body(result_body) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/git_wand/github/resource/pull_request.rb', line 14

def self.build_from_result_body(result_body)
  resource = new
  resource.html_url = result_body["html_url"]
  resource.issue_url = result_body["issue_url"]
  resource.number = result_body["number"]
  resource.title = result_body["title"]
  resource.state = result_body["state"]
  resource.locked = result_body["locked"]
  resource.body = result_body["body"]
  resource.created_at = convert_datetime(result_body["created_at"])
  resource.updated_at = convert_datetime(result_body["updated_at"])
  resource.closed_at = convert_datetime(result_body["closed_at"])
  resource.merged_at = convert_datetime(result_body["merged_at"])
  resource.head_sha = result_body["head"]["sha"]
  resource
end

Instance Method Details

#closed?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/git_wand/github/resource/pull_request.rb', line 35

def closed?
  self.state == "closed"
end

#open?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/git_wand/github/resource/pull_request.rb', line 31

def open?
  self.state == "open"
end