Class: GitWand::GitHub::Resource::Issue

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#assigneeObject

Returns the value of attribute assignee.



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

def assignee
  @assignee
end

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/git_wand/github/resource/issue.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/issue.rb', line 7

def closed_at
  @closed_at
end

#comments_countObject

Returns the value of attribute comments_count.



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

def comments_count
  @comments_count
end

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#html_urlObject

Returns the value of attribute html_url.



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

def html_url
  @html_url
end

#labelsObject

Returns the value of attribute labels.



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

def labels
  @labels
end

#lockedObject

Returns the value of attribute locked.



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

def locked
  @locked
end

#numberObject

Returns the value of attribute number.



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

def number
  @number
end

#pull_request_referenceObject

Returns the value of attribute pull_request_reference.



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

def pull_request_reference
  @pull_request_reference
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/git_wand/github/resource/issue.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/issue.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/issue.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/issue.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
30
31
# File 'lib/git_wand/github/resource/issue.rb', line 14

def self.build_from_result_body(result_body)
  resource = new
  resource.html_url = result_body["html_url"]
  resource.number = result_body["number"]
  resource.state = result_body["state"]
  resource.locked = result_body["locked"]
  resource.title = result_body["title"]
  resource.body = result_body["body"]
  resource.user = result_body["user"] # TODO: convert into a User resource
  resource.labels = result_body["labels"] # TODO: convert into a Label resource
  resource.assignee = result_body["assignee"] # TODO: convert into a User resource
  resource.comments_count = result_body["comments"]
  resource.pull_request_reference = result_body["pull_request"]
  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
end

Instance Method Details

#closed?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/git_wand/github/resource/issue.rb', line 37

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

#open?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/git_wand/github/resource/issue.rb', line 33

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