zend 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/zend/auth.rb +22 -8
- data/lib/zend/cli.rb +1 -1
- data/lib/zend/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1178446585c5f606205714915228b0fe248fcc
|
4
|
+
data.tar.gz: 97b9a0116551f9e79c7f1a5ed510b4c6b32703f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa7f07b87d15c27a2ffda1aa08217b5660fd504df39fedb0961d3fcabe99ade287fcc39f2a72a58a4ed4fd7ea20d9324e90267aaf821166a013701be6c7c06c0
|
7
|
+
data.tar.gz: 34b63cc227da84131d496aac3e6e6090799ad5c3f7ff4b894f967dfd36d8e624eb37cf6f26defe3cf5ba1de288506de4a3cf9389e0e843917184413149e5e5af
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.1.1 (September 7, 2013)
|
2
|
+
|
3
|
+
Bugfixes:
|
4
|
+
|
5
|
+
- show correct help message for `zend show`
|
6
|
+
- remove stored credentials on failed authentication
|
7
|
+
|
8
|
+
Features:
|
9
|
+
|
10
|
+
- use Zendesk user passwords instead of API token which are only
|
11
|
+
available to admins
|
12
|
+
- allow 3 authentication retries before exiting command
|
13
|
+
|
1
14
|
## 0.1.0 (September 7, 2013)
|
2
15
|
|
3
16
|
Features:
|
data/lib/zend/auth.rb
CHANGED
@@ -10,7 +10,7 @@ module Zend
|
|
10
10
|
@api = ZendeskAPI::Client.new do |config|
|
11
11
|
config.url = "https://#{domain}/api/v2"
|
12
12
|
config.username = user
|
13
|
-
config.
|
13
|
+
config.password = password
|
14
14
|
end
|
15
15
|
unauthorized_callback(@api)
|
16
16
|
end
|
@@ -47,9 +47,7 @@ module Zend
|
|
47
47
|
|
48
48
|
def unauthorized_callback(api)
|
49
49
|
api.insert_callback do |response|
|
50
|
-
if response[:status] == 401
|
51
|
-
Kernel.abort 'Incorrect Zendesk API authentication credentials'
|
52
|
-
end
|
50
|
+
authentication_failed if response[:status] == 401
|
53
51
|
end
|
54
52
|
end
|
55
53
|
|
@@ -91,7 +89,7 @@ module Zend
|
|
91
89
|
netrc.delete(domain)
|
92
90
|
netrc.save
|
93
91
|
end
|
94
|
-
@email, @
|
92
|
+
@email, @password = nil
|
95
93
|
end
|
96
94
|
|
97
95
|
def read_credentials
|
@@ -115,9 +113,9 @@ module Zend
|
|
115
113
|
say 'Enter your Zendesk credentials.' if ENV['ZEND_ACCOUNT']
|
116
114
|
|
117
115
|
email = ask 'E-mail address: '
|
118
|
-
|
116
|
+
password = ask_secret 'Password (typing will be hidden): '
|
119
117
|
|
120
|
-
[email,
|
118
|
+
[email, password]
|
121
119
|
end
|
122
120
|
|
123
121
|
def ask_for_and_save_credentials
|
@@ -128,11 +126,27 @@ module Zend
|
|
128
126
|
@credentials
|
129
127
|
end
|
130
128
|
|
131
|
-
def
|
129
|
+
def authentication_failed
|
130
|
+
say 'Authentication failed.'
|
131
|
+
if retry_login?
|
132
|
+
ask_for_and_save_credentials
|
133
|
+
else
|
134
|
+
delete_credentials
|
135
|
+
exit 1
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def ask_secret(message)
|
132
140
|
HighLine.new.ask(message) do |q|
|
133
141
|
q.echo = false
|
134
142
|
end
|
135
143
|
end
|
144
|
+
|
145
|
+
def retry_login?
|
146
|
+
@login_attempts ||= 0
|
147
|
+
@login_attempts += 1
|
148
|
+
@login_attempts < 3
|
149
|
+
end
|
136
150
|
end
|
137
151
|
end
|
138
152
|
end
|
data/lib/zend/cli.rb
CHANGED
data/lib/zend/version.rb
CHANGED