mumukit-bridge 1.1.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzlhMWNiYTI4NjUwMzI4OWM2YjY5ZjFkMTNkZTBhMzMxZjI2ZjJjZg==
4
+ NjcxMjNjOWI0MGQ4OTJkYjUxNDc4OGY3YTNiYWY4YzA3YmExMmNkNw==
5
5
  data.tar.gz: !binary |-
6
- ZTAyZjk1ODYxY2EwMDY0ZWQyMmJiNmUyMWJlOGZlOGM4NGVjMjBlZg==
6
+ OGIyZDJlMWZiODM0NDgyZmJiYWNkYTc0ZDQ1OGM5MWEyM2JlNDhmMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2YyZjFkOTIxMjM5ODI1Njc2MDZmNjU0MDc2NGY2MmNkZGIzNTMyOWEwZjYy
10
- OGY3OGI1MTI1NzkxNDM3ZjQ4YjAyMDBkMTMwMzE2ZDZlZTIyNmM3YWRhMmZj
11
- MmZmYjMxMzZkYTNiY2EwNzhiNWRjZDRjNjIzN2FiNzY5ZGVlMTg=
9
+ ZDg2YTQyNjllZDRkMzdmMGI4NTU5YTAyNmJhZGMzYjA2NGE1ZjZjNzMzMDIx
10
+ YWU1MmU3ZGYwZTQ5NWEzYzRhNjRmYTZjMjVhNzc4YTZiNjg3NjVhM2Q1Yzhl
11
+ ZmNjYmI2OWUxYzEyYTcxZjYwODhlYWY0YmY2ZmYxOGI1MjdlYzk=
12
12
  data.tar.gz: !binary |-
13
- MGI1NzllN2Y2ZmI0ZjI1OTg2NWJhMTEzNTc2ZTliOThhZGNjNTdmZjIwYzc0
14
- NmNjZDMzYTg4ZWY1ZmJmNzEzMmEyYTM3OGYwN2E5MTlmNTMxMWE3OTQ0MmM4
15
- ZDUwYTJkYzdmMWYxMTkzMzg5ZTNhMmI5NmJlZDUxZmZjYjljNjA=
13
+ YmQ4NGZlMWU5Yjk2ZjQ1OWQxMDQ0ZGVhOTlkNDE1MWI5ODFmYzIyMmMzZDQz
14
+ YzJmNGQ1Yjk5NzdiODlhODliM2M5MDMzMzJlZGMwOGJlNjI5MzYxMmRiNzJj
15
+ MWU5ZTkzYzNmMjUyMzc0MWQwMjFmMjRmYjJiYWRlZjNlODgwZWM=
@@ -1,5 +1,6 @@
1
1
  require 'rest_client'
2
- require 'active_support/core_ext/object'
2
+
3
+ require 'active_support/all'
3
4
 
4
5
  require_relative './bridge/version'
5
6
  require_relative './bridge/runner'
@@ -28,11 +28,17 @@ module Mumukit
28
28
  end
29
29
 
30
30
  def run_query!(request)
31
- with_sever_response request, 'query' do | it |
31
+ with_sever_response request, 'query' do |it|
32
32
  {status: it['exit'].to_sym, result: it['out']}
33
33
  end
34
34
  end
35
35
 
36
+ def info
37
+ JSON.parse RestClient.get(
38
+ "#{test_runner_url}/info",
39
+ content_type: :json)
40
+ end
41
+
36
42
  def with_sever_response(request, route, &action)
37
43
  response = post_to_server(request, route)
38
44
  action.call(response)
@@ -40,12 +46,16 @@ module Mumukit
40
46
  {result: e.message, status: :errored}
41
47
  end
42
48
 
43
- def post_to_server(request, route)
44
- JSON.parse RestClient.post(
45
- "#{test_runner_url}/#{route}",
46
- request.to_json,
47
- content_type: :json)
49
+ def post_to_server(request, route, timeout=10)
50
+ JSON.parse RestClient::Request.new(
51
+ method: :post,
52
+ url: "#{test_runner_url}/#{route}",
53
+ payload: request.to_json,
54
+ timeout: timeout,
55
+ open_timeout: timeout,
56
+ headers: {content_type: :json}).execute()
48
57
  end
58
+
49
59
  end
50
60
  end
51
61
  end
@@ -3,21 +3,18 @@ module Mumukit
3
3
  class Thesaurus
4
4
  attr_accessor :url
5
5
 
6
- def initialize(url = 'http://bibliotheca.mumuki.io')
6
+ def initialize(url = 'http://thesaurus.mumuki.io')
7
7
  @url = url
8
- @language = {}
9
8
  end
10
9
 
11
- def languages
12
- @languages ||= get('languages')['languages']
10
+ def runners
11
+ @runners ||= JSON.parse(get('runners'))['runners']
13
12
  end
14
13
 
15
- def language(name)
16
- @language[name] ||= get "languages/#{name}"
17
- end
14
+ private
18
15
 
19
- def get(path)
20
- JSON.parse RestClient.get("#{url}/#{path}")
16
+ def get(resource)
17
+ RestClient.get("#{url}/#{resource}")
21
18
  end
22
19
  end
23
20
  end
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Bridge
3
- VERSION = '1.1.0'
3
+ VERSION = '1.3.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-05 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: activesupport
70
+ name: mumukit-core
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.1'
83
83
  description:
84
84
  email:
85
85
  - flbulgarelli@yahoo.com.ar