Sixeight-giic 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/README.rdoc +30 -7
  2. data/bin/giic +4 -2
  3. data/lib/giic.rb +18 -20
  4. data/spec/spec_helper.rb +1 -1
  5. metadata +2 -2
data/README.rdoc CHANGED
@@ -1,26 +1,36 @@
1
1
  = Giic
2
2
 
3
- == DESCRIPTION:
3
+ == Description
4
4
 
5
5
  Giic is a client of the github-issues API interface.
6
6
 
7
- == FEATURES:
7
+ == Features
8
8
 
9
- search, list, show, open, clone, reopen, edit, label, comment
9
+ Giic can issue following query:
10
10
 
11
- == USAGE:
11
+ search, list, show, open, clone, reopen, edit, label, comment
12
+
13
+ check <tt>http://develop.github.com/p/issues.html</tt> to read API document.
14
+
15
+ == Installation
16
+
17
+ You can install Giic using Rubygems:
18
+
19
+ $ sudo gem install sixeight-giic -s http://gems.github.com
20
+
21
+ == Usage
12
22
 
13
23
  require 'giic'
14
24
 
15
25
  giic = Giic.new('Sixeight', 'giic')
16
- giic.list.each do |issue|
26
+ giic.list.issues.each do |issue|
17
27
  puts issue.title
18
28
  end
19
29
 
20
30
  giic.login!('login name', 'api token')
21
31
 
22
- res = giic.login.open('awsome idea', 'I found that an awsome idea ...')
23
- p res.number
32
+ res = giic.login.open('awesome idea', 'I found that an awesome idea ...')
33
+ p res.issues.number
24
34
 
25
35
  giic.login.with_project(onother) do |user|
26
36
  p user.add_label('bug', 5)
@@ -41,3 +51,16 @@ Install:
41
51
  * Error handling
42
52
  * and more more more
43
53
 
54
+ == LICENSE
55
+
56
+ (The MIT License)
57
+
58
+ Copyright© 2009:
59
+
60
+ Tomohiro Nishimura
61
+
62
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
65
+
66
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/giic CHANGED
@@ -36,7 +36,8 @@ loop do
36
36
  next
37
37
  end
38
38
  action, *args = command.split
39
- pp @giic.__send__(action, *args)
39
+ res = @giic.__send__(action, *args)
40
+ pp res.__send__(res.keys.first)
40
41
  when 'help'
41
42
  @help ||= %w[
42
43
  set login help exit quit
@@ -52,7 +53,8 @@ loop do
52
53
  next
53
54
  end
54
55
  action, *args = command.split
55
- pp @giic.login.__send__(action, *args)
56
+ res = @giic.login.__send__(action, *args)
57
+ pp res.__send__(res.keys.first)
56
58
  else
57
59
  warn "no such command: #{command}"
58
60
  end
data/lib/giic.rb CHANGED
@@ -1,6 +1,12 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
+ #
5
+ # == Giic
6
+ #
7
+ # Giic is a client of the github-issues API interface.
8
+ #
9
+
4
10
  require 'rubygems'
5
11
  require 'typhoeus'
6
12
  require 'yaml'
@@ -18,14 +24,9 @@ class Hash # :nodoc:
18
24
  include CoreExt
19
25
  end
20
26
 
21
- #
22
- # == Giic
23
- #
24
- # Giic is a client of the github-issues API interface.
25
- #
26
27
  class Giic
27
28
 
28
- VERSION = '0.0.1'
29
+ VERSION = '0.0.2'
29
30
 
30
31
  attr_reader :user, :repo
31
32
 
@@ -45,19 +46,19 @@ class Giic
45
46
  # search issue
46
47
  # #=> issues
47
48
  def search(query, state = 'open')
48
- back :issues, Core.search(:user => @user, :repo => @repo, :state => state, :search_term => query)
49
+ Core.search(:user => @user, :repo => @repo, :state => state, :search_term => query)
49
50
  end
50
51
 
51
52
  # list issues
52
53
  # #=> issues
53
54
  def list(state = 'open')
54
- back :issues, Core.list(:user => @user, :repo => @repo, :state => state)
55
+ Core.list(:user => @user, :repo => @repo, :state => state)
55
56
  end
56
57
 
57
58
  # show specific issue
58
59
  # #=> issue
59
60
  def show(number)
60
- back :issue, Core.show(:user => @user, :repo => @repo, :number => number)
61
+ Core.show(:user => @user, :repo => @repo, :number => number)
61
62
  end
62
63
 
63
64
  # get user instance for POST request
@@ -75,7 +76,8 @@ class Giic
75
76
  @login_user = login(login, token)
76
77
  end
77
78
 
78
- def back(default, result) # :nodoc:
79
+ # take values or error from responce
80
+ def self.take(default, result)
79
81
  if result.has_key? 'error'
80
82
  raise APIError.new(result, caller)
81
83
  end
@@ -91,21 +93,21 @@ class Giic
91
93
  # open new issue
92
94
  # #=> issue
93
95
  def open(title, body)
94
- back :issue, Giic::Core.open(:user => @project.user, :repo => @project.repo,
96
+ Giic::Core.open(:user => @project.user, :repo => @project.repo,
95
97
  :params => { :title => title, :body => body }.merge(authentication_data))
96
98
  end
97
99
 
98
100
  # close issue
99
101
  # #=> issue
100
102
  def close(number)
101
- back :issue, Giic::Core.close(:user => @project.user, :repo => @project.repo, :number => number,
103
+ Giic::Core.close(:user => @project.user, :repo => @project.repo, :number => number,
102
104
  :params => authentication_data)
103
105
  end
104
106
 
105
107
  # reopen issue
106
108
  # #=> issue
107
109
  def reopen(number)
108
- back :issue, Giic::Core.reopen(:user => @project.user, :repo => @project.repo, :number => number,
110
+ Giic::Core.reopen(:user => @project.user, :repo => @project.repo, :number => number,
109
111
  :params => authentication_data)
110
112
  end
111
113
 
@@ -114,14 +116,14 @@ class Giic
114
116
  def edit(number, body, title = nil)
115
117
  edit_data = { :body => body }
116
118
  edit_data.merge!(:title => title) if title
117
- back :issue, Giic::Core.edit(:user => @project.user, :repo => @project.repo, :number => number,
119
+ Giic::Core.edit(:user => @project.user, :repo => @project.repo, :number => number,
118
120
  :params => edit_data.merge(authentication_data))
119
121
  end
120
122
 
121
123
  # to operate label for issue
122
124
  # #=> labels
123
125
  def label(operate, label, number)
124
- back :labels, Giic::Core.label(:user => @project.user, :repo => @project.repo, :number => number,
126
+ Giic::Core.label(:user => @project.user, :repo => @project.repo, :number => number,
125
127
  :operate => operate, :label => label,
126
128
  :params => authentication_data)
127
129
  end
@@ -141,7 +143,7 @@ class Giic
141
143
  # post comment to issue
142
144
  # #=> comment
143
145
  def comment(number, comment)
144
- back :comment, Giic::Core.comment(:user => @project.user, :repo => @project.repo, :number => number,
146
+ Giic::Core.comment(:user => @project.user, :repo => @project.repo, :number => number,
145
147
  :params => { :comment => comment }.merge(authentication_data))
146
148
  end
147
149
 
@@ -177,10 +179,6 @@ class Giic
177
179
  def authentication_data # :nodoc:
178
180
  { :login => @login, :token => @token }
179
181
  end
180
-
181
- def back(default, result) # :nodoc:
182
- @project.back default, result
183
- end
184
182
  end
185
183
 
186
184
  # Core class is the Giic core that using Typhoeus library
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
- require File.dirname(__FILE__) + '/../giic'
1
+ require File.dirname(__FILE__) + '/../lib/giic'
2
2
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Sixeight-giic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomohiro Nishimura
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-08 00:00:00 -07:00
12
+ date: 2009-05-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency