Class: GotFixed::Adapters::Github
- Inherits:
-
Object
- Object
- GotFixed::Adapters::Github
- Includes:
- HTTParty
- Defined in:
- lib/got_fixed/adapters/github.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#repo ⇒ Object
Returns the value of attribute repo.
Instance Method Summary collapse
- #create_hook(options = {}) ⇒ Object
- #hooks(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Github
constructor
A new instance of Github.
-
#issues(options = {}) ⇒ Object
Retrieve all issues of a given GitHub repository matching given labels Labels must be comma separated, e.g.
Constructor Details
#initialize(options = {}) ⇒ Github
11 12 13 |
# File 'lib/got_fixed/adapters/github.rb', line 11 def initialize( = {}) ensure_mandatory_parameters , true end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
9 10 11 |
# File 'lib/got_fixed/adapters/github.rb', line 9 def access_token @access_token end |
#owner ⇒ Object
Returns the value of attribute owner.
9 10 11 |
# File 'lib/got_fixed/adapters/github.rb', line 9 def owner @owner end |
#repo ⇒ Object
Returns the value of attribute repo.
9 10 11 |
# File 'lib/got_fixed/adapters/github.rb', line 9 def repo @repo end |
Instance Method Details
#create_hook(options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/got_fixed/adapters/github.rb', line 33 def create_hook( = {}) ensure_mandatory_parameters url = [:url] || "http://requestb.in/xy043uxy" secret = [:secret] # TODO(ssaunier): Raise error if secret not set. body = { :name => "web", :config => { :url => url, :content_type => "json", :secret => secret }, :events => [ 'issues' ] } self.class.post "/repos/#{@owner}/#{@repo}/hooks", :body => body.to_json, :headers => headers end |
#hooks(options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/got_fixed/adapters/github.rb', line 28 def hooks( = {}) ensure_mandatory_parameters self.class.get "/repos/#{@owner}/#{@repo}/hooks", :headers => headers end |
#issues(options = {}) ⇒ Object
Retrieve all issues of a given GitHub repository matching given labels Labels must be comma separated, e.g. “public,foo,bar”
Doc: developer.github.com/v3/issues/#list-issues-for-a-repository
19 20 21 22 23 24 25 26 |
# File 'lib/got_fixed/adapters/github.rb', line 19 def issues( = {}) ensure_mandatory_parameters labels = [:labels] opened = issues_with_state(labels, :open) closed = issues_with_state(labels, :closed) opened + closed end |