frodo 0.10.3 → 0.10.4

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
  SHA1:
3
- metadata.gz: 0dd3b3457bc938fe383ab6e54d33d0f7b6378b0b
4
- data.tar.gz: e88b3a08c1b13c2a1b5bc8d90bf3611173535b99
3
+ metadata.gz: 1f99ab9fe921f7fdb4661c5a6e54b91b4c8149e2
4
+ data.tar.gz: ad5c5fdaa375d9fcaf0de8bf5ed09b5e5abe15d5
5
5
  SHA512:
6
- metadata.gz: 88172c7d563c965bdde9d2ad1b1b6368828054069316f9d0c154507158dee4512d0ccdc32e27388f287f5edf4df5801d4b0fc3e6cf0087c1846e60b2ac01dedc
7
- data.tar.gz: 2690d1dba79226d956348449162e03722f9f1ba3fade0ef8cefc502522d9a7b39312318d947bee76cd48b1024b0ae055b3042e7be4d55f3f7ac27cd834624b9c
6
+ metadata.gz: 48247e31fa6dc5588e54570c27a9dd6a0922587e7728f7211266cabe4c5452c5136d674312821862ab29c1fe1320869d8dee479eb682ba5f6f0765a3c117cc78
7
+ data.tar.gz: d23a1ecd6f8d49aa670f4c67971922d6bd16e914faf9265c78645d9c24ea9cabdb8d98e9604a4e7b1ede844bf8ca390932ec7ddce484a9129b7249170bf7e903
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Frodo
2
- VERSION = '0.10.3'
2
+ VERSION = '0.10.4'
3
3
  end
@@ -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.3
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-02 00:00:00.000000000 Z
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.1
407
+ rubygems_version: 2.6.14.3
408
408
  signing_key:
409
409
  specification_version: 4
410
410
  summary: Simple OData library