zendeath 0.0.2 → 0.0.3

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. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/lib/commands.rb +6 -7
  4. data/lib/zendeath.rb +12 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b4a4219b3e41a6d6909d0d51a3111522430c95f
4
- data.tar.gz: 9c7e4ac11893c29aaf97688f66b25cbff1469a53
3
+ metadata.gz: 18d92dfbbaf0e992e0ea315f8e3a76bf74bc1731
4
+ data.tar.gz: 04fbe5b36919231e81086c3491b66dc5224afb91
5
5
  SHA512:
6
- metadata.gz: 5d85b1a84b7d88406ac286568a294a8a2a538eb8f117d31a08d00f60f24d2f13ce00d9ef8c44421cdba68689fbf429a43ba6ea07da33ad54486e6edfa5dfc5f6
7
- data.tar.gz: b67f96b206898114b52df03df34df00e4d2f31a66ef6cc6a6576371838a31ceba1463378eb7612175fbfb2d0ad62de36b905ae6db22a859152724b516686d07f
6
+ metadata.gz: 4b6fe7d8436cce82a825489961bc3b434ffbd91bfa8edc9adda298929c537516106e254ea61755c023f64bf8f9ed5a9f2d2571dcccf25694e503c35ff61170cd
7
+ data.tar.gz: d81f9bfae71ce9d32d1e62c71152c856a15b7316b5e43d5aaf9ace1e33f3023c9e7cbf8f4af87aac060ae02975f3cd68ec7f38c889b9edfbe58e9aa31afc0be7
data/README.md CHANGED
@@ -28,3 +28,5 @@ No tests because I don't know how to write tests yet.
28
28
  - [ ] showticket should left/right justify for requester/agent
29
29
  - [ ] Ability to post updates to tickets
30
30
  - [ ] Ability to change status of tickets
31
+
32
+ [![Gem Version](https://badge.fury.io/rb/zendeath.png)](http://badge.fury.io/rb/zendeath)
@@ -22,7 +22,8 @@ class Commands
22
22
  @request = Net::HTTP::Get.new(@uri.request_uri)
23
23
  elsif type == 'Put'
24
24
  @request = Net::HTTP::Put.new(@uri.request_uri)
25
- @reqest.body = body
25
+ @request['Content-Type'] = 'application/json'
26
+ @request.body = body
26
27
  else
27
28
  raise ArgumentError.new('Unrecognized HTTP request type.')
28
29
  end
@@ -118,16 +119,14 @@ class Commands
118
119
  end
119
120
  end
120
121
 
121
- def updateticket(ticketid, comment, status='open', is_public='true')
122
+ def updateticket(ticketid, comment, status='open', is_public='false')
122
123
  # https://support.puppetlabs.com/api/v2/tickets/3717.json
123
124
  @uri.path = "/api/v2/tickets/#{ticketid.to_s}.json"
124
- unless status == ('pending' || 'open' || 'on-hold' || 'solved')
125
- raise ArgumentError.new('Valid ticket status is pending, on-hold, open, or solved.')
126
- end
125
+
127
126
  updatearray = {
128
127
  'ticket' => {
129
- 'comment' => { 'body' => comment, 'public' => is_public },
130
- 'status' => status
128
+ 'status' => status,
129
+ 'comment' => { 'body' => comment, 'public' => is_public }
131
130
  }
132
131
  }
133
132
  updatearray_json = updatearray.to_json
@@ -31,7 +31,18 @@ module Zendeath
31
31
  when 'update'
32
32
  # def updateticket(ticketid, comment, status='open', is_public='true')
33
33
 
34
- command.updateticket(ARGV[1])
34
+ updatearray = {
35
+ 'ticketid' => ARGV[1],
36
+ 'comment' => (STDIN.tty? ? ARGV[4] : STDIN.read),
37
+ 'status' => ARGV[2],
38
+ 'public' => ARGV[3],
39
+ }
40
+
41
+ command.updateticket(updatearray['ticketid'],
42
+ updatearray['comment'],
43
+ updatearray['status'],
44
+ updatearray['public'])
45
+
35
46
  when 'showticket'
36
47
  unless ARGV.length == 2
37
48
  raise ArgumentError.new('showticket requires a ticket number')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendeath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Alex Stern
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2013-12-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Zendeath is a command line client for Zendesk, primarily focused on Puppet
14
- Labs' use case, but may be made more generic in the future.
14
+ Labs' use case. It may be made more generic in the future.
15
15
  email: zacharyalexstern@gmail.com
16
16
  executables:
17
17
  - zendeath