lita-zendesk 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b10b5b00ca9242332338a1f6db58649ce4dea82c
4
- data.tar.gz: 59664b2616af985a7050a74ebb697da11562d52d
3
+ metadata.gz: 9c98df925470543243c15a83d4fdcfb992700608
4
+ data.tar.gz: 5e6e5433eb861b713218f3d484baa41850bd0848
5
5
  SHA512:
6
- metadata.gz: c9e0973398b2aaec6c4cdb32e87fee5bb4e0b170759bed0f08567308abcae664e05e8ddd8d4ba64bfeeef3071ff7255b962a704a747c650ddeeae66e6a760393
7
- data.tar.gz: 708c04937632b5109af5526ae4110e07dbb6dd5f486691783d82c068dae5808ac101f56d98b2355c196a9da779ec69411ee483b9961d9f7c1d9779b75f0921d4
6
+ metadata.gz: e63a6e6268461a45dc92601236f85db370df275e52fde5c1f418f3513835598e7a73052d81900555c663b26cf4db412b43460b43ce30e8062db8c595054378a5
7
+ data.tar.gz: 76230b57b6a39cb7a72c3f911a4fda96bb3040eba1589d3d5911d3d829f266c825568f410d1d4971d3c8a91ea7cbcd21f7c6df1115d483f1ce449b619dde403b
@@ -0,0 +1,16 @@
1
+ ---
2
+ languages:
3
+ Ruby: true
4
+ JavaScript: false
5
+ PHP: false
6
+ Python: false
7
+ engines:
8
+ rubocop:
9
+ enabled: true
10
+ ratings:
11
+ paths:
12
+ - "**.rb"
13
+ exclude_paths:
14
+ - docs/**/*
15
+ - scripts/**/*
16
+ - test/**/*
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ lita_config.rb
@@ -0,0 +1,6 @@
1
+ require 'coveralls'
2
+
3
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
4
+ SimpleCov.start do
5
+ add_filter "/test/"
6
+ end
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ rvm:
5
+ - 2.3.1
6
+ - 2.2.2
7
+ script: bundle exec rspec
8
+ before_install:
9
+ - gem update --system
10
+ - gem update bundler
11
+ services:
12
+ - redis-server
13
+ notifications:
14
+ email: false
@@ -1,7 +1,6 @@
1
1
  require 'base64'
2
2
  require 'faraday'
3
3
  require 'faraday_middleware'
4
- require 'pp'
5
4
 
6
5
  module Lita
7
6
  module Handlers
@@ -25,9 +24,9 @@ module Lita
25
24
  config :password, type: String, default: ''
26
25
 
27
26
  def init
28
- @base_url = "https://#{config.subdomain.to_s}.zendesk.com"
29
- @version_url = "https://#{config.subdomain.to_s}.zendesk.com/#{VERSION_URL}"
30
- @tickets_url = "https://#{config.subdomain.to_s}.zendesk.com/tickets"
27
+ @base_url = base_url
28
+ @version_url = "#{@base_url}/#{VERSION_URL}"
29
+ @tickets_url = "#{@base_url}/tickets"
31
30
 
32
31
  if config.auth_type == 'password'
33
32
  @conn = Faraday.new(url: @version_url) do |faraday|
@@ -46,12 +45,16 @@ module Lita
46
45
  end
47
46
  end
48
47
 
48
+ def base_url
49
+ "https://#{config.subdomain.to_s}.zendesk.com"
50
+ end
51
+
49
52
  def basic_credentials
50
53
  Base64.encode64("#{config.user}:#{config.password}").gsub(/\s/,'')
51
54
  end
52
55
 
53
56
  def zendesk_request(url)
54
- init unless @conn
57
+ init unless @conn
55
58
  if url.index('http') != 0
56
59
  url = "#{@version_url}/#{url}"
57
60
  end
@@ -67,7 +70,7 @@ module Lita
67
70
  end
68
71
 
69
72
  def ticket_list(response, url, ticket_type = '')
70
- res = zendesk_request url
73
+ res = zendesk_request url
71
74
  tickets = res.body['results']
72
75
  tickets.each do |ticket|
73
76
  response.reply "Ticket #{ticket['id']} is #{ticket['status']}: #{@tickets_url}/#{ticket['id']} - #{ticket['subject']}"
@@ -83,6 +86,13 @@ module Lita
83
86
  count == 1 ? 'ticket' : 'tickets'
84
87
  end
85
88
 
89
+ # Info
90
+
91
+ route(/^(?:zd|zendesk)\s+connection\s*$/, :zd_instance_info, command: true, help: { 'zd connection' => 'returns information on the Zendesk connection' })
92
+ def zd_instance_info(response)
93
+ response.reply "Using Zendesk instance at: #{base_url}"
94
+ end
95
+
86
96
  # Ticket Counts
87
97
 
88
98
  route(/^(?:zd|zendesk)(\s+unsolved)?\s+tickets?\s*$/, :unsolved_tickets, command: true, help: { 'zd tickets' => 'returns the total count of all unsolved tickets' })
@@ -124,7 +134,7 @@ module Lita
124
134
 
125
135
  route(/^(?:zd|zendesk)\s+list(\s+unsolved)?\s+tickets?\s*$/, :unsolved_tickets_list, command: true, help: { 'zd list tickets' => 'returns a list of unsolved tickets' })
126
136
  def unsolved_tickets_list(response)
127
- ticket_list response, QUERY_TICKETS_UNSOLVED, 'unsolved'
137
+ ticket_list response, QUERY_TICKETS_UNSOLVED, 'unsolved'
128
138
  end
129
139
 
130
140
  route(/^(?:zd|zendesk)\s+list\s+(all|total)\s+tickets?\s*$/, :total_tickets_list, command: true, help: { 'zd list all tickets' => 'returns a list of all tickets' })
@@ -161,18 +171,18 @@ module Lita
161
171
 
162
172
  route(/^(?:zd|zendesk)\s+ticket\s+(\d+)\s*$/, :ticket_details, command: true, help: { 'zd ticket <ID>' => 'returns information about the specified ticket' })
163
173
  def ticket_details(response)
164
- ticket_id = response.matches[0][0]
165
- url = "#{QUERY_TICKETS_ALL}/#{ticket_id}.json"
166
- res = zendesk_request url
167
- data = res.body
168
-
169
- message = "Ticket #{data['ticket']['id']}: #{@tickets_url}/#{data['ticket']['id']}"
170
- message += "\nStatus: #{data['ticket']['status'].upcase}"
171
- message += "\nUpdated: " + data['ticket']['updated_at']
172
- message += "\nAdded: #{data['ticket']['created_at']}"
173
- message += "\nSubject: #{data['ticket']['subject']}"
174
- message += "\nDescription:\n-----\n#{data['ticket']['description']}\n-----\n"
175
- response.reply message
174
+ ticket_id = response.matches[0][0]
175
+ url = "#{QUERY_TICKETS_ALL}/#{ticket_id}.json"
176
+ res = zendesk_request url
177
+ data = res.body
178
+
179
+ message = "Ticket #{data['ticket']['id']}: #{@tickets_url}/#{data['ticket']['id']}"
180
+ message += "\nStatus: #{data['ticket']['status'].upcase}"
181
+ message += "\nUpdated: " + data['ticket']['updated_at']
182
+ message += "\nAdded: #{data['ticket']['created_at']}"
183
+ message += "\nSubject: #{data['ticket']['subject']}"
184
+ message += "\nDescription:\n-----\n#{data['ticket']['description']}\n-----\n"
185
+ response.reply message
176
186
  end
177
187
  end
178
188
 
@@ -0,0 +1,29 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'lita-zendesk'
3
+ spec.date = '2016-08-31'
4
+ spec.version = '0.0.4'
5
+ spec.authors = ['John Wang']
6
+ spec.email = ["johncwang@gmail.com"]
7
+ spec.description = %q{A Zendesk handler for Lita.}
8
+ spec.summary = %q{A Zendesk handler for the Lita chatbot.}
9
+ spec.homepage = 'https://github.com/grokify/lita-zendesk'
10
+ spec.license = 'MIT'
11
+ spec.metadata = { 'lita_plugin_type' => 'handler' }
12
+
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_runtime_dependency 'faraday', '~> 0.9', '>= 0.9'
19
+ spec.add_runtime_dependency 'faraday_middleware', '~> 0', '>= 0'
20
+ spec.add_runtime_dependency 'lita', '>= 4.4.3'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'pry-byebug'
24
+ spec.add_development_dependency 'rack-test'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
27
+ spec.add_development_dependency 'simplecov', '>= 0.9.2'
28
+ spec.add_development_dependency 'coveralls'
29
+ end
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ adapters:
4
+ zendesk:
metadata CHANGED
@@ -1,15 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-zendesk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: '0.9'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.9'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0.9'
33
+ - !ruby/object:Gem::Dependency
34
+ name: faraday_middleware
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
13
53
  - !ruby/object:Gem::Dependency
14
54
  name: lita
15
55
  requirement: !ruby/object:Gem::Requirement
@@ -129,14 +169,19 @@ executables: []
129
169
  extensions: []
130
170
  extra_rdoc_files: []
131
171
  files:
172
+ - ".codeclimate.yml"
173
+ - ".gitignore"
174
+ - ".simplecov"
175
+ - ".travis.yml"
132
176
  - CHANGELOG.md
133
177
  - Gemfile
134
- - Gemfile.lock
135
178
  - LICENSE.txt
136
179
  - README.md
137
180
  - Rakefile
138
181
  - lib/lita-zendesk.rb
139
182
  - lib/lita/handlers/zendesk.rb
183
+ - lita-zendesk.gemspec
184
+ - locales/en.yml
140
185
  - spec/spec_helper.rb
141
186
  homepage: https://github.com/grokify/lita-zendesk
142
187
  licenses:
@@ -1,99 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- lita-zendesk (0.0.1)
5
- lita (>= 4.4.3)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- byebug (9.0.5)
11
- coderay (1.1.1)
12
- coveralls (0.8.15)
13
- json (>= 1.8, < 3)
14
- simplecov (~> 0.12.0)
15
- term-ansicolor (~> 1.3)
16
- thor (~> 0.19.1)
17
- tins (>= 1.6.0, < 2)
18
- diff-lcs (1.2.5)
19
- docile (1.1.5)
20
- faraday (0.9.2)
21
- multipart-post (>= 1.2, < 3)
22
- http_router (0.11.2)
23
- rack (>= 1.0.0)
24
- url_mount (~> 0.2.1)
25
- i18n (0.7.0)
26
- ice_nine (0.11.2)
27
- json (1.8.3)
28
- lita (4.7.0)
29
- bundler (>= 1.3)
30
- faraday (>= 0.8.7)
31
- http_router (>= 0.11.2)
32
- i18n (>= 0.6.9)
33
- ice_nine (>= 0.11.0)
34
- multi_json (>= 1.7.7)
35
- puma (>= 2.7.1)
36
- rack (>= 1.5.2)
37
- rb-readline (>= 0.5.1)
38
- redis-namespace (>= 1.3.0)
39
- thor (>= 0.18.1)
40
- method_source (0.8.2)
41
- multi_json (1.12.1)
42
- multipart-post (2.0.0)
43
- pry (0.10.4)
44
- coderay (~> 1.1.0)
45
- method_source (~> 0.8.1)
46
- slop (~> 3.4)
47
- pry-byebug (3.4.0)
48
- byebug (~> 9.0)
49
- pry (~> 0.10)
50
- puma (3.6.0)
51
- rack (2.0.1)
52
- rack-test (0.6.3)
53
- rack (>= 1.0)
54
- rake (11.2.2)
55
- rb-readline (0.5.3)
56
- redis (3.3.1)
57
- redis-namespace (1.5.2)
58
- redis (~> 3.0, >= 3.0.4)
59
- rspec (3.5.0)
60
- rspec-core (~> 3.5.0)
61
- rspec-expectations (~> 3.5.0)
62
- rspec-mocks (~> 3.5.0)
63
- rspec-core (3.5.2)
64
- rspec-support (~> 3.5.0)
65
- rspec-expectations (3.5.0)
66
- diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.5.0)
68
- rspec-mocks (3.5.0)
69
- diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.5.0)
71
- rspec-support (3.5.0)
72
- simplecov (0.12.0)
73
- docile (~> 1.1.0)
74
- json (>= 1.8, < 3)
75
- simplecov-html (~> 0.10.0)
76
- simplecov-html (0.10.0)
77
- slop (3.6.0)
78
- term-ansicolor (1.3.2)
79
- tins (~> 1.0)
80
- thor (0.19.1)
81
- tins (1.12.0)
82
- url_mount (0.2.1)
83
- rack
84
-
85
- PLATFORMS
86
- ruby
87
-
88
- DEPENDENCIES
89
- bundler (~> 1.3)
90
- coveralls
91
- lita-zendesk!
92
- pry-byebug
93
- rack-test
94
- rake
95
- rspec (>= 3.0.0)
96
- simplecov (>= 0.9.2)
97
-
98
- BUNDLED WITH
99
- 1.12.5