rgist 0.0.2 → 0.0.3

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: 65b65fb3e607dad2178a78ebaac62e6ae9f6e97e
4
- data.tar.gz: 74855df39bd296981005552875b3e0edfba7b938
3
+ metadata.gz: b420fb9c9887a6add868a5de29364499711fb831
4
+ data.tar.gz: 6ad40039937f8f7437cd079f288093ba311061fb
5
5
  SHA512:
6
- metadata.gz: 4523a30f003ffe66f58c0a24b1dcfe90b9ad20812d87920ddb2610243800e58fa8664e28fe86639280ccf32e1d17c279a8d53134ecee1738d0cd408c849d1596
7
- data.tar.gz: fe4cf82a8ba85515d5498d7d556c14197b38ef1e735e50f7433fa9d18a3ccb2b7ad6866887ef96488c7037aa31ff9ba78b3b328255e4732f5a1d24b726a558fb
6
+ metadata.gz: 34f2c59811ca44632fcc7309d6e4ab4ed8d9bcd2f8b34b69c08bf470160fc6b14f5c134c42fabc6a0d188b20b7b39a3c5a81f9683a4b71f6a288b202a7a5f794
7
+ data.tar.gz: c2136971839a894e6c9ed3b1dc1534d8799bb68c383ff53faaa9d94e20033c89ee5bd5a06758ecbd585974a72030ab5ca4a625cb78ededebad5726d7a19307aa
@@ -5,19 +5,24 @@ module Gist
5
5
 
6
6
  def get(user, file)
7
7
  begin
8
- response = execute("curl #{PATH % user}")
8
+ response = curl(PATH % user)
9
9
  json = JSON.parse(response)
10
10
 
11
11
  result = nil
12
12
 
13
13
  json.each do |gist|
14
14
  files = gist['files']
15
+
15
16
  if files.keys.include?(file)
16
17
  result = files[file]['raw_url']
17
18
  end
18
19
  end
19
20
 
20
- puts result
21
+ if result
22
+ puts curl(result)
23
+ else
24
+ # Raise content not found
25
+ end
21
26
  rescue Exception => exception
22
27
  raise exception
23
28
  end
@@ -25,6 +30,10 @@ module Gist
25
30
 
26
31
  private
27
32
 
33
+ def curl(path)
34
+ execute("curl #{path}")
35
+ end
36
+
28
37
  def execute(cmd)
29
38
  response = nil
30
39
 
@@ -1,3 +1,3 @@
1
1
  module Gist
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Ifran