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

Inherits:
ResourceProxy show all
Defined in:
lib/ghee/api/issues.rb,
lib/ghee/api/search.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from ResourceProxy

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

Instance Method Summary collapse

Methods inherited from ResourceProxy

accept_header, #all, #all_parallel, #build_prefix, #initialize, #method_missing, #paginate, #raw, #subject

Methods included from CUD

#create, #destroy, #patch

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 Attribute Details

#repoObject

Returns the value of attribute repo.



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

def repo
  @repo
end

Instance Method Details

#assignees(&block) ⇒ Object



129
130
131
132
# File 'lib/ghee/api/issues.rb', line 129

def assignees(&block)
  prefix = "#{path_prefix}/assignees"
  Ghee::API::Repos::Issues::Assignees::Proxy.new(connection, prefix, &block)
end

#closeObject

Close issue - closed issue by id

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

returns boolean



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

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

#closedObject

Returns closed issues

Returns json



102
103
104
105
106
107
# File 'lib/ghee/api/issues.rb', line 102

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



111
112
113
114
# File 'lib/ghee/api/issues.rb', line 111

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



124
125
126
127
# File 'lib/ghee/api/issues.rb', line 124

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



118
119
120
# File 'lib/ghee/api/issues.rb', line 118

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

#search(term, state = "open") ⇒ Object



12
13
14
15
# File 'lib/ghee/api/search.rb', line 12

def search(term, state = "open")
  url = "./legacy/issues/search/#{@repo.repo_name}/#{state}/#{term}"
  Ghee::API::Search::Issues::Proxy.new(connection, url)
end