desmoservice 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d18592e41ee622239d6903779ffb2e3b1d380780
4
- data.tar.gz: 75691f636a3a99a54fa005be1464d2db310b4e96
3
+ metadata.gz: 1b32465201fa7ff2a57da0df7cb1eadd2fe50826
4
+ data.tar.gz: 70579bf743f4bcee48d4180a332f01c306f4560b
5
5
  SHA512:
6
- metadata.gz: ab1a95e4776cc417f515c9a54f35258d38b15ca3f26f5448e94b1be2c4919f6324e817644b4d30da5427c021c6683a1842a68fe436c2391630ce0ff61206846b
7
- data.tar.gz: ea698075b4a1d8205dcdfda99db6aef288df7e0e89b48e28b5551cd1bd48d10be37340ce530ed2729af2da93d6a8c158e2755c28b70e2a18949df3b31e3175bf
6
+ metadata.gz: 78cec09e1583d2b4200fdd7901283d8eb7e6775e62c080e65dd1f5b9f2794450e31c4994e690972781b50b53fe656450f25a61b4f2f37e5b667928814ee379a0
7
+ data.tar.gz: 30759e51ce7903b992269c3af062c7859d547fe2232f52fe2f0f5f3001420f22ee42e8cd4f5057a906f5d2eef2a509cf9c77f6248dac49af5f6e9565e871b6bc
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'desmoservice'
3
- s.version = '0.2.1'
4
- s.date = '2015-11-09'
3
+ s.version = '0.2.2'
4
+ s.date = '2016-02-09'
5
5
  s.license = 'Ruby'
6
6
  s.summary = 'Read and write access to Desmoservice API'
7
7
  s.description = 'Manage the connection to Desmoservice server, convert JSON to ruby objects and build XML for edition'
data/lib/get.rb CHANGED
@@ -4,7 +4,7 @@ class Get
4
4
  def initialize
5
5
  end
6
6
 
7
- def self.families(desmoservice_conf, get_params, http=nil)
7
+ def self.families(desmoservice_conf, get_params, http: nil, log_handler: nil)
8
8
  options = get_params.to_h('familles')
9
9
  uri = desmoservice_conf.build_json_uri(options)
10
10
  if http.nil?
@@ -16,10 +16,15 @@ class Get
16
16
  end
17
17
  families = Families.new()
18
18
  families.parse_json(json_string)
19
+ if not log_handler.nil?
20
+ log_handler.add_log_message(uri.to_s)
21
+ log_handler.add_log_message(json_string.force_encoding("UTF-8"))
22
+ log_handler.new_line()
23
+ end
19
24
  return families
20
25
  end
21
26
 
22
- def self.ventilation(desmoservice_conf, get_params, http=nil)
27
+ def self.ventilation(desmoservice_conf, get_params, http: nil, log_handler: nil)
23
28
  options = get_params.to_h('ventilation')
24
29
  uri = desmoservice_conf.build_json_uri(options)
25
30
  if http.nil?
@@ -31,10 +36,15 @@ class Get
31
36
  end
32
37
  ventilation = Ventilation.new()
33
38
  ventilation.parse_json(json_string)
39
+ if not log_handler.nil?
40
+ log_handler.add_log_message(uri.to_s)
41
+ log_handler.add_log_message(json_string.force_encoding("UTF-8"))
42
+ log_handler.new_line()
43
+ end
34
44
  return ventilation
35
45
  end
36
46
 
37
- def self.word_distribution(desmoservice_conf, get_params, http=nil)
47
+ def self.word_distribution(desmoservice_conf, get_params, http: nil, log_handler: nil)
38
48
  options = get_params.to_h('lexiedistribution')
39
49
  uri = desmoservice_conf.build_json_uri(options)
40
50
  if http.nil?
@@ -46,10 +56,15 @@ class Get
46
56
  end
47
57
  word_distribution = WordDistribution.new()
48
58
  word_distribution.parse_json(json_string)
59
+ if not log_handler.nil?
60
+ log_handler.add_log_message(uri.to_s)
61
+ log_handler.add_log_message(json_string.force_encoding("UTF-8"))
62
+ log_handler.new_line()
63
+ end
49
64
  return word_distribution
50
65
  end
51
66
 
52
- def self.terms(desmoservice_conf, get_params, http=nil)
67
+ def self.terms(desmoservice_conf, get_params, http: nil, log_handler: nil)
53
68
  options = get_params.to_h('terms')
54
69
  uri = desmoservice_conf.build_json_uri(options)
55
70
  if http.nil?
@@ -61,6 +76,11 @@ class Get
61
76
  end
62
77
  terms = Terms.new()
63
78
  terms.parse_json(json_string)
79
+ if not log_handler.nil?
80
+ log_handler.add_log_message(uri.to_s)
81
+ log_handler.add_log_message(json_string.force_encoding("UTF-8"))
82
+ log_handler.new_line()
83
+ end
64
84
  return terms
65
85
  end
66
86
 
@@ -10,6 +10,10 @@ class LogHandler
10
10
  def add_log_message(log_message)
11
11
  destination << log_message << "\n"
12
12
  end
13
+
14
+ def new_line()
15
+ destination << "\n"
16
+ end
13
17
 
14
18
  end
15
19
 
@@ -6,7 +6,7 @@ class Post
6
6
  def initialize
7
7
  end
8
8
 
9
- def self.xml(desmoservice_conf, xml, log_handler=nil, http=nil)
9
+ def self.xml(desmoservice_conf, xml, http: nil, log_handler: nil)
10
10
  uri = desmoservice_conf.build_edition_uri
11
11
  if http.nil?
12
12
  response = Net::HTTP.post_form(uri, 'desmo' => desmoservice_conf.desmo_name, 'xml' => xml)
@@ -33,9 +33,9 @@ class Term
33
33
  @parent_id = data['familleCode'].to_i
34
34
  end
35
35
  @parent_localkey = nil
36
- if data.has_key?('parentCode')
36
+ if data.has_key?('parentIdctxt')
37
37
  @parent_localkey = data['parentIdctxt']
38
- elsif data.has_key?('familleCode')
38
+ elsif data.has_key?('familleIdctxt')
39
39
  @parent_localkey = data['familleIdctxt']
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desmoservice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Calame
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Manage the connection to Desmoservice server, convert JSON to ruby objects
14
14
  and build XML for edition
@@ -18,7 +18,6 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - README
21
- - desmoservice-0.2.0.gem
22
21
  - lib/ventilation.rb
23
22
  - lib/get.rb
24
23
  - lib/conf.rb
Binary file