ulule 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ulule.rb +33 -31
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ced3ecfd6958e19c23d609574c4909d37d025e5
|
4
|
+
data.tar.gz: 850f5d94dfa447e152bf9a809efde2a9a0dc265c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5202a89166e513cd3c5c10145f2f2c10784a5795a99ca55c40a463bad450fac5646ec8b9fd4fa93ea060b4422eb153caa68f953da2f705823ac3236c66c9ebb
|
7
|
+
data.tar.gz: 185464e68dce16592262cdf99e1ed9195cc5644317274c0b6cf3ebff1cb2ee59ad47ae01c3aa59bf257629d47ea54d407cedc81dc5e88a4871c1b7bb4b65e12e
|
data/lib/ulule.rb
CHANGED
@@ -1,35 +1,37 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
1
|
class Ulule
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
attr_accessor :username
|
7
|
+
attr_accessor :apikey
|
8
|
+
|
9
|
+
def initialize(username, apikey)
|
10
|
+
@username = username
|
11
|
+
@apikey = apikey
|
12
|
+
end
|
13
|
+
|
14
|
+
def project(url)
|
15
|
+
if (name = url.match(/.*\/(.*)\/$/)).nil?
|
16
|
+
return puts "Wrong url !"
|
17
|
+
end
|
18
|
+
output = send_request name[1]
|
19
|
+
if output.empty?
|
20
|
+
return puts "Wrong username/apikey or url !"
|
21
|
+
end
|
22
|
+
JSON.parse(output)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def send_request name
|
28
|
+
uri = URI("https://api.ulule.com/v1/projects/#{name}")
|
29
|
+
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
30
|
+
request = Net::HTTP::Get.new uri
|
31
|
+
request.add_field( 'Authorization', "ApiKey #{username}:#{apikey}" )
|
32
|
+
response = http.request request
|
33
|
+
response.body
|
34
|
+
end
|
35
|
+
end
|
34
36
|
|
35
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ulule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Puyet
|
@@ -27,17 +27,17 @@ require_paths:
|
|
27
27
|
- lib
|
28
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|
39
39
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.
|
40
|
+
rubygems_version: 2.2.2
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
43
|
summary: Ulule api for rails
|