Class: GitWand::GitHub::Resource::PullRequest
- Inherits:
-
Object
- Object
- GitWand::GitHub::Resource::PullRequest
- Defined in:
- lib/git_wand/github/resource/pull_request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#closed_at ⇒ Object
Returns the value of attribute closed_at.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#head_sha ⇒ Object
Returns the value of attribute head_sha.
-
#html_url ⇒ Object
Returns the value of attribute html_url.
-
#issue_url ⇒ Object
Returns the value of attribute issue_url.
-
#locked ⇒ Object
Returns the value of attribute locked.
-
#merged_at ⇒ Object
Returns the value of attribute merged_at.
-
#number ⇒ Object
Returns the value of attribute number.
-
#state ⇒ Object
Returns the value of attribute state.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
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_at ⇒ Object
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_at ⇒ Object
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_sha ⇒ Object
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_url ⇒ Object
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_url ⇒ Object
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 |
#locked ⇒ Object
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_at ⇒ Object
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 |
#number ⇒ Object
Returns the value of attribute number.
7 8 9 |
# File 'lib/git_wand/github/resource/pull_request.rb', line 7 def number @number end |
#state ⇒ Object
Returns the value of attribute state.
7 8 9 |
# File 'lib/git_wand/github/resource/pull_request.rb', line 7 def state @state end |
#title ⇒ Object
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_at ⇒ Object
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 |
#user ⇒ Object
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
35 36 37 |
# File 'lib/git_wand/github/resource/pull_request.rb', line 35 def closed? self.state == "closed" end |
#open? ⇒ Boolean
31 32 33 |
# File 'lib/git_wand/github/resource/pull_request.rb', line 31 def open? self.state == "open" end |