-
Notifications
You must be signed in to change notification settings - Fork 0
/
zendesk.rb
51 lines (40 loc) · 1.09 KB
/
zendesk.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'rubygems'
require 'httparty'
require 'json'
require 'pp'
class Zendesk
attr_accessor :response
include HTTParty
default_params :output => 'json'
format :json
#base_uri = "https://nitrousio.zendesk.com/api/v2"
def initialize
auth = {:username => ENV['ZENDESK_USERNAME'], :password => ENV['ZENDESK_PASSWORD']}
@response = HTTParty.get("https://nitrousio.zendesk.com/api/v2/tickets.json", :basic_auth => auth)
end
end
bug_hash = {}
feedback_hash = {}
issue_hash = {}
zendesk = Zendesk.new.response
#all_tags = zendesk.body["tags"].map
parsed = JSON.parse(zendesk.body)
pp parsed
# parsed.each do |ticket|
# name = tag.name
# if status = "pending"
# if bug_hash.has_key?(name)
# bug_hash[name] = bug_hash[name] + 1
# elsif feedback_hash.has_key?(name)
# feedback_hash[name] = feedback_hash[name] + 1
# elsif issue_hash.has_key?(name)
# issue_hash[name] = issue_hash[name] + 1
# elsif category = "bug"
# bug_hash[tag] = 0
# elsif category = "feedback"
# feedback_hash[tag] = 0
# elsif category = "issue"
# issue_hash[tag] = 0
# end
# end
# end