climine 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71c5ec923fc8ef50b38a99b1dc54d66c302d563
4
- data.tar.gz: 6df0751757a301c4f0bb64c5591b703b509bf5a0
3
+ metadata.gz: 65fcd07b96263bf848c1884078e1a917aaaeee83
4
+ data.tar.gz: abc153e244ef0df65f7669f059818d5cc7ba9760
5
5
  SHA512:
6
- metadata.gz: b234eab4fa83f16984bd3fd22ec8dc1ae4a378ea497e9189626f691025c5f9f45b9d86b7143e33353cdd3fe4811e20ea1af5f0effb5a19e0deccf0b03dbf6074
7
- data.tar.gz: 9ce03d17057fe3a9c4f643f0159c3f1ab42fcc19c39dc5f23ffbb40f238ff77f76cf73eda9051d837bf7553520de2dd7fbd146ef019defd2733ddcbbc15588da
6
+ metadata.gz: 11d495370524d67a9f5dd7bf0b8ba32c2a6e79b4d359331ee328c0c6cf9df7ab09f949dcee4317ce8e71f05c8b5620ef32c050748574dbcaee690b8034f216c4
7
+ data.tar.gz: cc9e45d16bed3577c8d3bd41d7670aec31cfb9a71d8617b1082d1e1978040e2b3bcd60e40f2e7445fe1e0e3c092dfe38570aaf0109a520d57c854195ee0a7868
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- climine (0.0.4)
4
+ climine (0.0.5)
5
5
  hashie (~> 2.0.5)
6
6
  hirb (~> 0.7)
7
7
  hirb-unicode (~> 0.0.5)
data/README.md CHANGED
@@ -117,6 +117,55 @@ Options:
117
117
  create Issue
118
118
  ```
119
119
 
120
+ #### update issue
121
+
122
+ ```
123
+ Usage:
124
+ climine issue update [TICKET_NO]
125
+
126
+ Options:
127
+ -t, [--tracker-id=TRACKER_ID] # tracker_id (search by `tracker` command)
128
+ -s, [--status-id=STATUS_ID] # status_id (search by `status` command)
129
+ -u, [--user-id=USER_ID] # user_id (search by `user` command)
130
+
131
+ update Redmine Issues. see) http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue
132
+ ```
133
+
134
+ #### update issue status
135
+
136
+
137
+ ```
138
+ Usage:
139
+ climine issue start [TICKET_NO]
140
+
141
+ Options:
142
+ -t, [--tracker-id=TRACKER_ID] # tracker_id (search by `tracker` command)
143
+ -u, [--user-id=USER_ID] # user_id (search by `user` command)
144
+
145
+ update status of issue to ID:2.
146
+ ```
147
+
148
+ ```
149
+ Usage:
150
+ climine issue close [TICKET_NO]
151
+
152
+ update status of issue to ID:5.
153
+ ```
154
+
155
+ ```
156
+ Usage:
157
+ climine issue finish [TICKET_NO]
158
+
159
+ alias for close
160
+ ```
161
+
162
+ ```
163
+ Usage:
164
+ climine issue reject [TICKET_NO]
165
+
166
+ update status of issue to ID:6.
167
+ ```
168
+
120
169
  ### Users
121
170
 
122
171
  ```
@@ -78,6 +78,44 @@ module Climine::Command
78
78
  end
79
79
  end
80
80
 
81
+ desc "update [TICKET_NO]", "update Redmine Issues. see) http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue"
82
+ option :tracker_id, type: :numeric, aliases: '-t', banner: "TRACKER_ID", desc: "tracker_id (search by `tracker` command)"
83
+ option :status_id, type: :numeric, aliases: '-s', banner: "STATUS_ID", desc: "status_id (search by `status` command)"
84
+ option :user_id, type: :numeric, aliases: '-u', banner: "USER_ID", desc: "user_id (search by `user` command)"
85
+ def update(id=nil)
86
+ say("required ticket number!", :red) and return unless id
87
+ redmine.update_issue id, options
88
+ render :issue, redmine.issue(id)
89
+ end
90
+
91
+ desc "start [TICKET_NO]", "update status of issue to ID:2."
92
+ option :tracker_id, type: :numeric, aliases: '-t', banner: "TRACKER_ID", desc: "tracker_id (search by `tracker` command)"
93
+ option :user_id, type: :numeric, aliases: '-u', banner: "USER_ID", desc: "user_id (search by `user` command)"
94
+ def start(id=nil)
95
+ say("required ticket number!", :red) and return unless id
96
+ redmine.update_issue id, options.merge({status_id: 2})
97
+ render :issue, redmine.issue(id)
98
+ end
99
+
100
+ desc "close [TICKET_NO]", "update status of issue to ID:5."
101
+ def close(id=nil)
102
+ say("required ticket number!", :red) and return unless id
103
+ redmine.update_issue id, {status_id: 5}
104
+ render :issue, redmine.issue(id)
105
+ end
106
+
107
+ desc "finish [TICKET_NO]", "alias for close"
108
+ def finish(id=nil)
109
+ close(id)
110
+ end
111
+
112
+ desc "reject [TICKET_NO]", "update status of issue to ID:6."
113
+ def reject(id=nil)
114
+ say("required ticket number!", :red) and return unless id
115
+ redmine.update_issue id, {status_id: 6}
116
+ render :issue, redmine.issue(id)
117
+ end
118
+
81
119
  no_commands {
82
120
  def before_weeek_to_update_date option
83
121
  if weeks = option["before_week"]
@@ -20,6 +20,9 @@ class Climine::Redmine
20
20
  def create_issue issue
21
21
  post(build_url("/issues.json"), {issue: issue})
22
22
  end
23
+ def update_issue id, issue
24
+ put(build_url("/issues/#{id}.json"), {issue: issue})
25
+ end
23
26
  def user id, query={}
24
27
  get(build_url("/users/#{id}.json", query))
25
28
  end
@@ -54,9 +57,16 @@ class Climine::Redmine
54
57
  Hashie::Mash.new json
55
58
  end
56
59
  def post url, content
60
+ request Net::HTTP::Post, url, content
61
+ end
62
+ def put url, content
63
+ request Net::HTTP::Put, url, content
64
+ end
65
+
66
+ def request method, url, content
57
67
  uri = URI(url)
58
68
 
59
- req = Net::HTTP::Post.new uri, initheader = {'Content-Type' =>'application/json'}
69
+ req = method.new uri, initheader = {'Content-Type' =>'application/json'}
60
70
  req.body = content.to_json
61
71
 
62
72
  res = Net::HTTP.start(uri.host, uri.port, use_ssl: (uri.scheme == "https")) do |http|
@@ -1,3 +1,3 @@
1
1
  module Climine
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: climine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - yagince
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor