ulule 0.0.2 → 0.0.3
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/lib/ulule.rb +15 -26
- 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: 302ec42636bd52092397d3e5cb80346e6a8d3dad
|
4
|
+
data.tar.gz: f6997aa37a40f9e8780f95b84ed3437690315492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fd4a6d8934472fad14a53a62a4e393f27c6f561c31e73bc6b2eea0d0b729495e25ada9b8162bac1769e83ccd2295c124f0215ea1154aa5845ea5900e339b9d7
|
7
|
+
data.tar.gz: 60911b1663551d6283e8b9aef10667d86723b82ce5715aa8a4ff15994a894ea32c803a27e07a846f140fa0d933f23fd07fce18652b3f57cf252e2929f034ff4c
|
data/lib/ulule.rb
CHANGED
@@ -1,46 +1,35 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
class Ulule
|
4
|
+
|
5
|
+
attr_accessor :username
|
6
|
+
attr_accessor :apikey
|
7
|
+
|
4
8
|
def initialize(username, apikey)
|
5
9
|
@username = username
|
6
10
|
@apikey = apikey
|
7
11
|
end
|
8
12
|
|
9
|
-
def
|
10
|
-
name = check_url(url)
|
11
|
-
|
12
|
-
return put_error("Wrong url !")
|
13
|
+
def project(url)
|
14
|
+
if (name = check_url(url)).nil?
|
15
|
+
return puts "Wrong url !"
|
13
16
|
end
|
14
|
-
command =
|
15
|
-
output = `#{command}`
|
16
|
-
|
17
|
-
return put_error("Wrong username/apikey or url !")
|
17
|
+
command = gcommand(name[1])
|
18
|
+
if (output = `#{command}`).length == 0
|
19
|
+
return puts "Wrong username/apikey or url !"
|
18
20
|
end
|
19
21
|
JSON.parse(output)
|
20
22
|
end
|
21
23
|
|
22
|
-
def generate_command name
|
23
|
-
"curl -H" + '"Authorization: ApiKey '+ "#{@username}:#{@apikey}" +'" ' + "https://api.ulule.com/v1/projects/#{name}"
|
24
|
-
end
|
25
24
|
|
26
|
-
|
27
|
-
puts msg
|
28
|
-
nil
|
29
|
-
end
|
25
|
+
private
|
30
26
|
|
31
|
-
def
|
32
|
-
|
33
|
-
if name.nil?
|
34
|
-
return nil
|
35
|
-
end
|
36
|
-
name[1]
|
27
|
+
def gcommand name
|
28
|
+
"curl -H 'Authorization: ApiKey #{@username}:#{@apikey}' https://api.ulule.com/v1/projects/#{name}"
|
37
29
|
end
|
38
30
|
|
39
|
-
def
|
40
|
-
|
31
|
+
def check_url url
|
32
|
+
url.match(/.*\/(.*)\/$/)
|
41
33
|
end
|
42
34
|
|
43
|
-
def update_apikey apikey
|
44
|
-
@apikey = apikey
|
45
|
-
end
|
46
35
|
end
|