Class: Ghee::API::Repos::Issues::Proxy

Inherits:
ResourceProxy show all
Includes:
CUD
Defined in:
lib/ghee/api/issues.rb

Overview

Gists::Proxy inherits from Ghee::Proxy and enables defining methods on the proxy object

Instance Attribute Summary

Attributes inherited from ResourceProxy

#connection, #current_page, #pagination, #params, #path_prefix, #total

Instance Method Summary collapse

Methods included from CUD

#create, #destroy, #patch

Methods inherited from ResourceProxy

#all, #initialize, #method_missing, #paginate, #subject

Constructor Details

This class inherits a constructor from Ghee::ResourceProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ghee::ResourceProxy

Instance Method Details

#closeObject

Close issue - closed issue by id

usage - ghee.repos(“my_repo”).issues(1).close

returns boolean



76
77
78
# File 'lib/ghee/api/issues.rb', line 76

def close
  connection.patch(path_prefix,:state => "closed").body["state"] == "closed"
end

#closedObject

Returns closed issues

Returns json



84
85
86
87
88
89
# File 'lib/ghee/api/issues.rb', line 84

def closed
  response = connection.get path_prefix do |req|
    req.params["state"] = "closed"
  end
  response.body
end

#comments(id = nil) ⇒ Object

Returns issue comments for an issue or all of the comments for a repo



93
94
95
96
# File 'lib/ghee/api/issues.rb', line 93

def comments(id=nil)
  prefix = id ? "#{path_prefix}/comments/#{id}" : "#{path_prefix}/comments"
  Ghee::API::Repos::Issues::Comments::Proxy.new(connection,prefix)
end

#events(id = nil) ⇒ Object

Returns issue events for a repo or issue number



106
107
108
109
# File 'lib/ghee/api/issues.rb', line 106

def events(id=nil)
  prefix = id ? "#{path_prefix}/events/#{id}" : "#{path_prefix}/events"
  Ghee::API::Repos::Issues::Events::Proxy.new(connection,prefix)
end

#labelsObject

Returns all of the labels for repo



100
101
102
# File 'lib/ghee/api/issues.rb', line 100

def labels
  Ghee::API::Repos::Issues::Labels::Proxy.new(connection, "#{path_prefix}/labels")
end