Class: NewsStand::Github
- Inherits:
-
Object
- Object
- NewsStand::Github
- Defined in:
- lib/news_stand/github.rb,
lib/news_stand/github/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #all(state = 'open') ⇒ Object
- #get(number) ⇒ Object
-
#initialize(options = {}) ⇒ Github
constructor
A new instance of Github.
- #set(attributes = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Github
Returns a new instance of Github.
7 8 9 10 11 12 |
# File 'lib/news_stand/github.rb', line 7 def initialize( = {}) @user = ['user'] @repo = ['repo'] @access_token = ['access_token'] @issue_api = ::Github.new(oauth_token: access_token).issues end |
Instance Method Details
#all(state = 'open') ⇒ Object
14 15 16 |
# File 'lib/news_stand/github.rb', line 14 def all(state = 'open') @issue_api.list(user: user, repo: repo, state: state) end |
#get(number) ⇒ Object
18 19 20 |
# File 'lib/news_stand/github.rb', line 18 def get(number) @issue_api.find(user, repo, number) end |
#set(attributes = {}) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/news_stand/github.rb', line 22 def set(attributes = {}) if attributes['number'] number = attributes.delete('number') @issue_api.edit(user, repo, number, attributes) else @issue_api.create(user, repo, attributes) end end |