frodo 0.10.4 → 0.10.5

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: 1f99ab9fe921f7fdb4661c5a6e54b91b4c8149e2
4
- data.tar.gz: ad5c5fdaa375d9fcaf0de8bf5ed09b5e5abe15d5
3
+ metadata.gz: d625c77ac93f7c66bfe21f5e5080cf00458cc76e
4
+ data.tar.gz: 67cd17ce735175b4670382677c0c200313f20bc0
5
5
  SHA512:
6
- metadata.gz: 48247e31fa6dc5588e54570c27a9dd6a0922587e7728f7211266cabe4c5452c5136d674312821862ab29c1fe1320869d8dee479eb682ba5f6f0765a3c117cc78
7
- data.tar.gz: d23a1ecd6f8d49aa670f4c67971922d6bd16e914faf9265c78645d9c24ea9cabdb8d98e9604a4e7b1ede844bf8ca390932ec7ddce484a9129b7249170bf7e903
6
+ metadata.gz: '08d6bba647323abc803c11123adedd0d56ee0630b4eb74037b630a43980cc55099aa06a3f75e4dad24fa66568557eb9ed182154d9c882c4d79c41c8f6b4e9fd6'
7
+ data.tar.gz: 2b66c975a180d4824d08c7d8358cf7db4182ee714a80a1cd32c62fe013c249561f857ebdec95e476655e4188e7ec0d9297096d488a598739e45793a02bc3671d
data/lib/frodo/entity.rb CHANGED
@@ -88,6 +88,12 @@ module Frodo
88
88
  end
89
89
  end
90
90
 
91
+ # strip inline annotations from property names and return separately
92
+ def parse_annotations_from_property_name(property_name)
93
+ prop_name, annotation = property_name.to_s.split('@', 2)
94
+ return prop_name, annotation
95
+ end
96
+
91
97
  def property_names
92
98
  [
93
99
  @properties_xml_value.andand.keys,
@@ -131,7 +137,9 @@ module Frodo
131
137
  end
132
138
 
133
139
  new_properties.each do |property_name, property_value|
134
- self[property_name] = property_value
140
+ prop_name, annotation = parse_annotations_from_property_name(property_name)
141
+ # TODO: Do something with the annotation?
142
+ self[prop_name] = property_value
135
143
  end
136
144
  end
137
145
  entity
data/lib/frodo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Frodo
2
- VERSION = '0.10.4'
2
+ VERSION = '0.10.5'
3
3
  end
@@ -201,6 +201,16 @@ describe Frodo::Concerns::API do
201
201
  expect{ subject }.to raise_error(ArgumentError)
202
202
  end
203
203
  end
204
+
205
+ context 'with @odata.bind properties' do
206
+ let(:attributes) {{
207
+ 'ownerid@odata.bind': '/systemusers(12345)'
208
+ }}
209
+ it 'calls .update! with unmodified attributes' do
210
+ expect(client).to receive(:update!).with(entity_type, attributes).and_return(true)
211
+ expect(subject).to be(true)
212
+ end
213
+ end
204
214
  end
205
215
 
206
216
  describe '.destroy' do
@@ -90,6 +90,17 @@ describe Frodo::EntitySet, vcr: {cassette_name: 'entity_set_specs'} do
90
90
  it { expect(new_entity['DiscontinuedDate']).to be_nil }
91
91
  it { expect(new_entity['Rating']).to eq(4) }
92
92
  it { expect(new_entity['Price']).to eq(3.5) }
93
+
94
+ context 'with @odata.bind properties' do
95
+ let(:properties) { super().merge({
96
+ 'Supplier@odata.bind': '/systemusers(12345)'
97
+ })}
98
+ it 'creates entity without annotations' do
99
+ expect(new_entity.entity_set).to eq(subject)
100
+ expect(new_entity['Supplier']).to eq('/systemusers(12345)')
101
+ end
102
+ end
103
+
93
104
  end
94
105
 
95
106
  # describe '#[]' do
@@ -59,8 +59,8 @@ describe Frodo::Entity, vcr: false do
59
59
  let(:properties) { {
60
60
  "firstname" => "Christoph",
61
61
  "lastname" => "Wagner",
62
- "ownerid" => "odata.bind@/systemusers(95B9F1A8-3D5A-E911-A956-000D3A3B9CD8)",
63
- "parentcustomerid_account" => "odata.bind@/accounts(60fb3f1c-b766-e911-a955-000d3a3b9316)",
62
+ "ownerid@odata.bind" => "/systemusers(95B9F1A8-3D5A-E911-A956-000D3A3B9CD8)",
63
+ "parentcustomerid_account@odata.bind" => "/accounts(60fb3f1c-b766-e911-a955-000d3a3b9316)",
64
64
  } }
65
65
  let(:entity_set) {
66
66
  Frodo::EntitySet.new(
@@ -89,8 +89,8 @@ describe Frodo::Entity, vcr: false do
89
89
  expect(subject.id).to eq('contacts()')
90
90
  expect(subject['firstname']).to eq('Christoph')
91
91
  expect(subject['lastname']).to eq('Wagner')
92
- expect(subject['ownerid']).to eq('odata.bind@/systemusers(95B9F1A8-3D5A-E911-A956-000D3A3B9CD8)')
93
- expect(subject['parentcustomerid_account']).to eq('odata.bind@/accounts(60fb3f1c-b766-e911-a955-000d3a3b9316)')
92
+ expect(subject['ownerid']).to eq('/systemusers(95B9F1A8-3D5A-E911-A956-000D3A3B9CD8)')
93
+ expect(subject['parentcustomerid_account']).to eq('/accounts(60fb3f1c-b766-e911-a955-000d3a3b9316)')
94
94
  end
95
95
  end
96
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frodo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Pinault