domoscio_rails 0.0.3 → 0.0.5
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/domoscio_rails.rb +3 -2
- data/lib/domoscio_rails/data/knowledge_node_student.rb +1 -0
- data/lib/domoscio_rails/http_calls.rb +13 -0
- data/lib/domoscio_rails/resource.rb +4 -1
- data/lib/domoscio_rails/utils/review_util.rb +6 -0
- data/lib/domoscio_rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a4e6040ff1863d92f10beba3851e728573e1c7
|
4
|
+
data.tar.gz: 421c65794fee6d6ca04027cdad2c2109c6646242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 514047ba81f8df95d3bfb72325fc03a9b32fc801e65120842319cf39c7a303e7726ef9ae84c875dbf0d91b5b0e3451f985808f2378a25fa3d1cd6829068aaa1e
|
7
|
+
data.tar.gz: 214f475ea990e6c7585466ebb4bd815fc8f23df1c93af788c4f6f4f9356fd7e88f05987bac4b51a47e2c2f5a9954489d7e6619b0f98c8a101186735a40051133
|
data/lib/domoscio_rails.rb
CHANGED
@@ -19,6 +19,7 @@ require 'domoscio_rails/knowledge/knowledge_edge'
|
|
19
19
|
require 'domoscio_rails/knowledge/knowledge_node'
|
20
20
|
require 'domoscio_rails/data/knowledge_node_student'
|
21
21
|
require 'domoscio_rails/data/result'
|
22
|
+
require 'domoscio_rails/utils/review_util'
|
22
23
|
|
23
24
|
|
24
25
|
module DomoscioRails
|
@@ -33,7 +34,7 @@ module DomoscioRails
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def root_url
|
36
|
-
@root_url || (@preproduction == true ? "http://
|
37
|
+
@root_url || (@preproduction == true ? "http://stats-engine.domoscio.com/" : "http://localhost:3000/")
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -62,7 +63,7 @@ module DomoscioRails
|
|
62
63
|
#
|
63
64
|
def self.request(method, url, params={}, filters={}, headers = request_headers, before_request_proc = nil)
|
64
65
|
uri = api_uri(url)
|
65
|
-
uri.query = URI.encode_www_form(filters) unless filters.empty?
|
66
|
+
uri.query = URI.encode_www_form(filters) unless filters.empty?
|
66
67
|
|
67
68
|
res = Net::HTTP.start(uri.host, uri.port) do |http| # , use_ssl: uri.scheme == 'https') do |http|
|
68
69
|
req = Net::HTTP::const_get(method.capitalize).new(uri.request_uri, headers)
|
@@ -55,5 +55,18 @@ module DomoscioRails
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
module Util
|
59
|
+
module ClassMethods
|
60
|
+
def util(id = nil, util_name = nil, params = {})
|
61
|
+
DomoscioRails.request(:get, url(id, util_name), params)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.included(base)
|
66
|
+
base.extend(ClassMethods)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
58
71
|
end
|
59
72
|
end
|
@@ -6,13 +6,16 @@ module DomoscioRails
|
|
6
6
|
name.split('::')[-1]
|
7
7
|
end
|
8
8
|
|
9
|
-
def url(id = nil,
|
9
|
+
def url(id = nil, util_name = nil)
|
10
10
|
if self == Resource
|
11
11
|
raise NotImplementedError.new('Resource is an abstract class. Do not use it directly.')
|
12
12
|
end
|
13
13
|
|
14
14
|
build_url = "/v1/companies/#{DomoscioRails.configuration.client_id}"
|
15
15
|
build_url << "/#{class_name.underscore}s"
|
16
|
+
if util_name
|
17
|
+
build_url << "/#{util_name}"
|
18
|
+
end
|
16
19
|
if id
|
17
20
|
build_url << "/#{CGI.escape(id.to_s)}"
|
18
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domoscio_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benoit Praly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/domoscio_rails/knowledge/knowledge_node.rb
|
50
50
|
- lib/domoscio_rails/resource.rb
|
51
51
|
- lib/domoscio_rails/student/student.rb
|
52
|
+
- lib/domoscio_rails/utils/review_util.rb
|
52
53
|
- lib/domoscio_rails/version.rb
|
53
54
|
- lib/tasks/domoscio_rails_tasks.rake
|
54
55
|
homepage: http://www.domoscio.com
|