evertils-gist 5.1.3 → 5.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/egist.rb +19 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353e47b5d69774e3a9009cee7ff67f7ab3820e132308cd526f6dc269ea112dda
|
4
|
+
data.tar.gz: 0cd2fe9e97b13f041b19d9a5dcc549eac90ee696766027e27fce7c24a1f008ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49d3f0d3aea9075f98a970e515f82ddb11f838df39ec4e8ed762625ad93f8157ccd6a93b28675c5644d36d3dfdc03162d394eb7b92ab27e9e6355c13470d5b30
|
7
|
+
data.tar.gz: d133cf571e245c09af35164df0b5d037173fa7d8f55f0f4b657133925fc843c55fb9d1b6186a4d14867e8da2ee989d73819434f7391eb2a006c687d374a5030a
|
data/lib/egist.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
module Gist
|
13
13
|
extend self
|
14
14
|
|
15
|
-
VERSION = '5.1.
|
15
|
+
VERSION = '5.1.5'
|
16
16
|
|
17
17
|
# A list of clipboard commands with copy and paste support.
|
18
18
|
CLIPBOARD_COMMANDS = {
|
@@ -223,7 +223,24 @@ module Gist
|
|
223
223
|
request['Authorization'] = "token #{access_token}" if access_token.to_s != ''
|
224
224
|
response = http(api_url, request)
|
225
225
|
|
226
|
-
response.
|
226
|
+
body = JSON.parse(response.body)
|
227
|
+
body['id'] == id
|
228
|
+
end
|
229
|
+
|
230
|
+
def download(id)
|
231
|
+
url = "#{base_path}/gists/#{id}"
|
232
|
+
access_token = auth_token()
|
233
|
+
request = Net::HTTP::Get.new(url)
|
234
|
+
|
235
|
+
request['Authorization'] = "token #{access_token}" if access_token.to_s != ''
|
236
|
+
response = http(api_url, request)
|
237
|
+
|
238
|
+
if response.code == '200'
|
239
|
+
body = JSON.parse(response.body)
|
240
|
+
body['files']
|
241
|
+
else
|
242
|
+
raise Error, "Gist with id of #{id} does not exist."
|
243
|
+
end
|
227
244
|
end
|
228
245
|
|
229
246
|
def read_gist(id, file_name=nil)
|