evertils-gist 5.1.3 → 5.1.5

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/egist.rb +19 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a9d30f08465aba86213b758eedd92b6d653024e59a84d03184f121f1624014a
4
- data.tar.gz: ca7afab8f9c861ca597a305b9332466f7e2ce52f4a33968a7fe0694775cd31c4
3
+ metadata.gz: 353e47b5d69774e3a9009cee7ff67f7ab3820e132308cd526f6dc269ea112dda
4
+ data.tar.gz: 0cd2fe9e97b13f041b19d9a5dcc549eac90ee696766027e27fce7c24a1f008ee
5
5
  SHA512:
6
- metadata.gz: 9680248c0c32a88ae2587443e813cbdf78aefae4fb7460803c03c4c5426c097d3ee8578529ed0890dfd31d0d7740b3df4a1643de82625ab1e3f774725b799fae
7
- data.tar.gz: 82612e2a0f633aee973ce6322fb27d7feb7bb5f4bb41eea7f11a98cbfa233cd0ec2759d863f2bfacfd78f0a7c5ba7f017188edc35a225abd1f3c5c71f9d3a9cc
6
+ metadata.gz: 49d3f0d3aea9075f98a970e515f82ddb11f838df39ec4e8ed762625ad93f8157ccd6a93b28675c5644d36d3dfdc03162d394eb7b92ab27e9e6355c13470d5b30
7
+ data.tar.gz: d133cf571e245c09af35164df0b5d037173fa7d8f55f0f4b657133925fc843c55fb9d1b6186a4d14867e8da2ee989d73819434f7391eb2a006c687d374a5030a
@@ -12,7 +12,7 @@ end
12
12
  module Gist
13
13
  extend self
14
14
 
15
- VERSION = '5.1.3'
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.code == 200
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evertils-gist
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.3
4
+ version: 5.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conrad Irwin