safrano 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a14d6778d6391597537f6747dc2cdd650413bd45d8351af3ba427d349c90e887
4
- data.tar.gz: f8f899d1d1cffd48701539e85240f7368eec5f85c6d0d1647f0448f55bdfde58
3
+ metadata.gz: 33ec32a310f05cb4118e15152f2209aec1551d6363af29eddae28b92d4abf79d
4
+ data.tar.gz: 78d6e4c243fc124280ddfc352f0e9376aae269c016bd57b9d9693caff0c7e5c2
5
5
  SHA512:
6
- metadata.gz: dbe8f715a880590d6077f392408a50082e99cfd5f23b9648fd63c64a543c361a155cba6144a63da75a4c1e48f0e2ccb1da95d19729d49cb881b82100bc122b3c
7
- data.tar.gz: 199026ff4cf9abc042cd547232f8aa9c251c6849f9e954fe6351da2b416b1cc87d3ad974d09bbf7c12122d1bff65ca1699556bffcaae563d329984ffacb5ea53
6
+ metadata.gz: 4344b9959b281e77d830fabf9d812655a50c9560258a5cca3a3364c4569efb10beee34bc7bf0f2fa1b86561fcdff499e40cb3e5a8d819a4b94013870b9a57e91
7
+ data.tar.gz: e0027ac6315f9b7ee8e1b948de9c5f1236b01f79638ef3ddcc8adad3a1972091ba5ce52f5bea060ad673581b38a7d00cb4a24ed6aa295c92558e228aabde775f
@@ -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,13 +321,17 @@ 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
@@ -372,6 +376,8 @@ module Safrano
372
376
  @cmap = {}
373
377
  @collections.each do |klass|
374
378
  @cmap[klass.entity_set_name] = klass
379
+ # set namespace needed to have qualified type name
380
+ copy_namespace_to(klass)
375
381
  end
376
382
 
377
383
  # 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.3'
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.3
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-11-04 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