safrano 0.6.2 → 0.6.4

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
  SHA256:
3
- metadata.gz: a14d6778d6391597537f6747dc2cdd650413bd45d8351af3ba427d349c90e887
4
- data.tar.gz: f8f899d1d1cffd48701539e85240f7368eec5f85c6d0d1647f0448f55bdfde58
3
+ metadata.gz: 5ac4c570c39b0419c702aef0756ce4c9687916436d5198f768d8dfdedb9bc5fd
4
+ data.tar.gz: 3aac760ce6b4bd5e89750e1540024f531593a4cc627663025322cb0e32d60417
5
5
  SHA512:
6
- metadata.gz: dbe8f715a880590d6077f392408a50082e99cfd5f23b9648fd63c64a543c361a155cba6144a63da75a4c1e48f0e2ccb1da95d19729d49cb881b82100bc122b3c
7
- data.tar.gz: 199026ff4cf9abc042cd547232f8aa9c251c6849f9e954fe6351da2b416b1cc87d3ad974d09bbf7c12122d1bff65ca1699556bffcaae563d329984ffacb5ea53
6
+ metadata.gz: f1e89de14fdacfcd3db0893d0b9e9d00c929da0ba74268d623b235955ed9437e21d2a61454d710886d71aa819625c7ffa8b8f894a69684eace27d51c34d1f05e
7
+ data.tar.gz: 954b7c8e764a4c415ba28f34063d7f142876de691cf99c4ce8fc97ad994b2e3adb5faf680cdf4bd7af14b30b6d9a2769fd78fa45ce1b8cc27c7f004bb67a7d51
@@ -39,6 +39,10 @@ module Safrano
39
39
  def to_edm_json
40
40
  # no offset
41
41
  # --> %Q milliseconds since epoch
42
+ # Formatting: look at
43
+ # https://services.odata.org/V2/Northwind/Northwind.svc/Employees?$format=json
44
+ # the json raw data is like this : "HireDate": "\/Date(704678400000)\/"
45
+ # --> \/\/
42
46
  strftime('/Date(%Q)/')
43
47
  end
44
48
  end
@@ -36,6 +36,11 @@ module Safrano
36
36
  # <ticks> = number of milliseconds since midnight Jan 1, 1970
37
37
  # <offset> = number of minutes to add or subtract
38
38
  # https://stackoverflow.com/questions/10286204/what-is-the-right-json-date-format/10286228#10286228
39
+
40
+ # Formatting: look at
41
+ # https://services.odata.org/V2/Northwind/Northwind.svc/Employees?$format=json
42
+ # the json raw data is like this : "HireDate": "\/Date(704678400000)\/"
43
+ # --> \/\/
39
44
  def to_edm_json
40
45
  if offset.zero?
41
46
  # no offset
@@ -51,6 +51,11 @@ module Safrano
51
51
  # https://docs.microsoft.com/de-de/dotnet/standard/datetime/system-text-json-support
52
52
  # https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/stand-alone-json-serialization#datestimes-and-json
53
53
  # https://blogs.sap.com/2017/01/05/date-and-time-in-sap-gateway-foundation/
54
+
55
+ # Formatting: look at
56
+ # https://services.odata.org/V2/Northwind/Northwind.svc/Employees?$format=json
57
+ # the json raw data is like this : "HireDate": "\/Date(704678400000)\/"
58
+ # --> \/\/
54
59
  def to_edm_json
55
60
  if utc? || (gmt_offset == 0)
56
61
  # no offset
@@ -198,6 +198,7 @@ module Safrano
198
198
  # 'Type' => Safrano.get_edm_type(db_type: prop[:db_type]) }
199
199
  'Type' => metadata[:edm_type] }
200
200
  attrs['Nullable'] = 'false' if prop[:allow_null] == false
201
+ attrs['Precision'] = '0' if metadata[:edm_type] == 'Edm.DateTime'
201
202
  enty.add_element('Property', attrs)
202
203
  end
203
204
  enty
@@ -321,18 +321,23 @@ module Safrano
321
321
  modelklass.deferred_iblock = block if block_given?
322
322
  end
323
323
 
324
+ def copy_namespace_to(klass)
325
+ serv_namespace = @xnamespace
326
+ klass.instance_eval { @namespace = serv_namespace }
327
+ end
328
+
324
329
  def publish_complex_type(ctklass)
325
330
  # check that the provided klass is a Safrano ComplexType
326
331
 
327
332
  raise(Safrano::API::ComplexTypeNameError, ctklass) unless ctklass.superclass == Safrano::ComplexType
328
333
 
329
- serv_namespace = @xnamespace
330
- ctklass.instance_eval { @namespace = serv_namespace }
334
+ copy_namespace_to(ctklass)
331
335
 
332
336
  @complex_types.add ctklass
333
337
  end
334
338
 
335
- def function_import(name)
339
+ def function_import(name_p)
340
+ name = "#{name_p}"
336
341
  funcimp = Safrano::FunctionImport(name)
337
342
  @function_imports[name] = funcimp
338
343
  @function_import_keys << name
@@ -372,6 +377,8 @@ module Safrano
372
377
  @cmap = {}
373
378
  @collections.each do |klass|
374
379
  @cmap[klass.entity_set_name] = klass
380
+ # set namespace needed to have qualified type name
381
+ copy_namespace_to(klass)
375
382
  end
376
383
 
377
384
  # now that we know all model klasses we can handle relationships
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Safrano
4
- VERSION = '0.6.2'
4
+ VERSION = '0.6.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - oz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-25 00:00:00.000000000 Z
11
+ date: 2022-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: rack-test
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '1.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '1.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement