ulule 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ulule.rb +46 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aed0b681e7c9f848f8b6cb20bd0b95dbfaea57d7
|
4
|
+
data.tar.gz: 6664efb638eff95fbb894ea54d2990becbeca3de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b3029ceb15b9c73c3719b03d2924529568208f97bcd030f57dbf8d5a05da8800488080007cdf4457fc144b353a6efc50daf6ba5e6509742f31ef01c0ac7ae72
|
7
|
+
data.tar.gz: bc06dabaeba26f700839d08a5e28e804ebe905610519d2989ca03d509bb23ddaa5542a4be2f70fa941afa8299a08ad8aef24774dcefa964e045e77d12230c9b6
|
data/lib/ulule.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class Ulule
|
4
|
+
def initialize(username, apikey)
|
5
|
+
@username = username
|
6
|
+
@apikey = apikey
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_project(url)
|
10
|
+
name = check_url(url)
|
11
|
+
if name.nil?
|
12
|
+
return put_error("Wrong url !")
|
13
|
+
end
|
14
|
+
command = generate_command(name)
|
15
|
+
output = `#{command}`
|
16
|
+
if output.length == 0
|
17
|
+
return put_error("Wrong username/apikey or url !")
|
18
|
+
end
|
19
|
+
JSON.parse(output)
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_command name
|
23
|
+
"curl -H" + '"Authorization: ApiKey '+ "#{@username}:#{@apikey}" +'" ' + "https://api.ulule.com/v1/projects/#{name}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def put_error msg
|
27
|
+
puts msg
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def check_url url
|
32
|
+
name = url.match(/.*\/(.*)\/$/)
|
33
|
+
if name.nil?
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
name[1]
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_username username
|
40
|
+
@username = username
|
41
|
+
end
|
42
|
+
|
43
|
+
def update_apikey apikey
|
44
|
+
@apikey = apikey
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ulule
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sebastien Puyet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2012-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple gem for fetch datas projects from Ulule's API
|
14
|
+
email: sebastienpuyet@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/ulule.rb
|
20
|
+
homepage: https://github.com/spuyet/gem-ulule
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.1
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Ulule api for rails
|
44
|
+
test_files: []
|