frodo 0.10.3 → 0.10.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 +4 -4
- data/lib/frodo/schema.rb +17 -0
- data/lib/frodo/version.rb +1 -1
- data/spec/frodo/schema_spec.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f99ab9fe921f7fdb4661c5a6e54b91b4c8149e2
|
4
|
+
data.tar.gz: ad5c5fdaa375d9fcaf0de8bf5ed09b5e5abe15d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48247e31fa6dc5588e54570c27a9dd6a0922587e7728f7211266cabe4c5452c5136d674312821862ab29c1fe1320869d8dee479eb682ba5f6f0765a3c117cc78
|
7
|
+
data.tar.gz: d23a1ecd6f8d49aa670f4c67971922d6bd16e914faf9265c78645d9c24ea9cabdb8d98e9604a4e7b1ede844bf8ca390932ec7ddce484a9129b7249170bf7e903
|
data/lib/frodo/schema.rb
CHANGED
@@ -94,6 +94,23 @@ module Frodo
|
|
94
94
|
end.to_h
|
95
95
|
end
|
96
96
|
|
97
|
+
# Returns a hash for finding the associated read-only value property for a given
|
98
|
+
# navigation property
|
99
|
+
# @return [Hash<String, Hash<String, String>>]
|
100
|
+
def referential_constraints
|
101
|
+
@referential_constraints ||= metadata.xpath('//EntityType').map do |entity_type_def|
|
102
|
+
[
|
103
|
+
entity_type_def.attributes['Name'].value,
|
104
|
+
entity_type_def.xpath('./NavigationProperty[ReferentialConstraint]').map do |nav_property_def|
|
105
|
+
[
|
106
|
+
nav_property_def.attributes['Name'].value,
|
107
|
+
nav_property_def.xpath('./ReferentialConstraint').first.attributes['Property'].value
|
108
|
+
]
|
109
|
+
end.to_h
|
110
|
+
]
|
111
|
+
end.to_h
|
112
|
+
end
|
113
|
+
|
97
114
|
# Get the property type for an entity from metadata.
|
98
115
|
#
|
99
116
|
# @param entity_name [to_s] the name of the relevant entity
|
data/lib/frodo/version.rb
CHANGED
data/spec/frodo/schema_spec.rb
CHANGED
@@ -69,6 +69,14 @@ describe Frodo::Schema do
|
|
69
69
|
it { expect(subject.navigation_properties['Product'].values).to all(be_a(Frodo::NavigationProperty)) }
|
70
70
|
end
|
71
71
|
|
72
|
+
describe '#referential_constraints' do
|
73
|
+
let(:metadata_file) { 'spec/fixtures/files/metadata_dynamics.xml' }
|
74
|
+
it { expect(subject).to respond_to(:referential_constraints) }
|
75
|
+
it { expect(subject.referential_constraints['contact'].size).to eq(20) }
|
76
|
+
it { expect(subject.referential_constraints['contact'].values).to all(be_a(String)) }
|
77
|
+
it { expect(subject.referential_constraints['contact']['parentcustomerid_account']).to eq('_parentcustomerid_value') }
|
78
|
+
end
|
79
|
+
|
72
80
|
describe '#get_property_type' do
|
73
81
|
it { expect(subject).to respond_to(:get_property_type) }
|
74
82
|
it { expect(subject.get_property_type('Product', 'ID')).to eq('Edm.Int32') }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frodo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Pinault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -404,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
404
404
|
version: '0'
|
405
405
|
requirements: []
|
406
406
|
rubyforge_project:
|
407
|
-
rubygems_version: 2.6.14.
|
407
|
+
rubygems_version: 2.6.14.3
|
408
408
|
signing_key:
|
409
409
|
specification_version: 4
|
410
410
|
summary: Simple OData library
|