frodo 0.10.2 → 0.10.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
  SHA1:
3
- metadata.gz: 7c4a9157464aff8b00387cb3b75fd0a394c86df2
4
- data.tar.gz: d7eeae8efeb8b41b098d2d838ad4a9c36b023199
3
+ metadata.gz: 0dd3b3457bc938fe383ab6e54d33d0f7b6378b0b
4
+ data.tar.gz: e88b3a08c1b13c2a1b5bc8d90bf3611173535b99
5
5
  SHA512:
6
- metadata.gz: 98d564ed63c6f7ce8cb836ff37909da160d2285d18d776438f414160eced7cae6954c835a453c216421b837583e1beb26ef466000b8d3875ef88caa40241874a
7
- data.tar.gz: dcac4c14f2c643869500735727b299d4352882cbb5a414239b369d0848a69b985c76cdf801b027b274d9b84cf11be8bdd015600ec70dca4cdc3087a984f0cc8a
6
+ metadata.gz: 88172c7d563c965bdde9d2ad1b1b6368828054069316f9d0c154507158dee4512d0ccdc32e27388f287f5edf4df5801d4b0fc3e6cf0087c1846e60b2ac01dedc
7
+ data.tar.gz: 2690d1dba79226d956348449162e03722f9f1ba3fade0ef8cefc502522d9a7b39312318d947bee76cd48b1024b0ae055b3042e7be4d55f3f7ac27cd834624b9c
data/README.md CHANGED
@@ -307,19 +307,6 @@ This is only recommended for testing purposes, as the metadata file can change.
307
307
  })
308
308
  ```
309
309
 
310
- #### Metadata Data
311
-
312
- Typically the metadata file of a service can be quite large.
313
- You can speed your load time by forcing the service to load the metadata from a file rather than a URL.
314
- This is only recommended for testing purposes, as the metadata file can change.
315
-
316
- ```ruby
317
- service = Frodo::Service.new('http://services.odata.org/V4/OData/OData.svc', {
318
- name: 'ODataDemo',
319
- metadata_data: "metadata.xml",
320
- })
321
- ```
322
-
323
310
  ### Exploring a Service
324
311
 
325
312
  Once instantiated, you can request various information about the service, such as the names and types of entity sets it exposes, or the names of the entity types (and custom datatypes) it defines.
@@ -468,10 +455,10 @@ Many thanks go to [James Thompson][@plainprogrammer], who wrote the [original OD
468
455
  [@plainprogrammer]: https://github.com/plainprogrammer
469
456
  [ruby-odata]: https://github.com/ruby-odata/odata
470
457
 
471
- Many thanks go to [James Thompson][@pandawhisperer], who started the work on the [OData (Version 4.0) gem][frodo].
458
+ Many thanks go to [Christoph Wagner][@pandawhisperer], who started the work on the [OData (Version 4.0) gem][frodata].
472
459
 
473
- [@plainprogrammer]: https://github.com/PandaWhisperer
474
- [frodo]: https://github.com/wrstudios/frodo
460
+ [@pandawhisperer]: https://github.com/PandaWhisperer
461
+ [frodata]: https://github.com/wrstudios/frodata
475
462
 
476
463
  Also, I would like to thank [Outreach][outreach] for generously allowing me to work on Open Source software like this. If you want to work on interesting challenges with an awesome team, check out our [open positions][outreachcareers].
477
464
 
@@ -93,7 +93,7 @@ module Frodo
93
93
 
94
94
  # Public: Insert a new record.
95
95
  #
96
- # entity_set - The set the entity belongs to
96
+ # entity_set_name - The set the entity belongs to
97
97
  # attrs - Hash of attributes to set on the new record.
98
98
  #
99
99
  # Examples
@@ -104,11 +104,15 @@ module Frodo
104
104
  #
105
105
  # Returns the primary key value of the newly created entity.
106
106
  # Raises exceptions if an error is returned from Dynamics.
107
- def create!(entity_set, attrs)
108
- entity = service[entity_set].new_entity(attrs)
109
- url_chunk = to_url_chunk(entity)
107
+ def create!(entity_set_name, attrs)
108
+ entity_set = service[entity_set_name]
109
+ url_chunk = entity_set_to_url_chunk(entity_set)
110
110
  url = api_post(url_chunk, attrs).headers['odata-entityid']
111
- id = url.match(/\(.+\)/)[0]
111
+ id_match = url.match(/\((.+)\)/)
112
+ if id_match.nil?
113
+ raise Frodo::Error.new "entity url not in expected format: #{url.inspect}"
114
+ end
115
+ return id_match[1]
112
116
  end
113
117
  alias insert! create!
114
118
 
@@ -283,6 +287,10 @@ module Frodo
283
287
  entity.is_new? ? set : "#{set}(#{primary_key})"
284
288
  end
285
289
 
290
+ def entity_set_to_url_chunk(entity_set)
291
+ return entity_set.name
292
+ end
293
+
286
294
  # Internal: Errors that should be rescued from in non-bang methods
287
295
  def exceptions
288
296
  [Faraday::Error::ClientError]
data/lib/frodo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Frodo
2
- VERSION = '0.10.2'
2
+ VERSION = '0.10.3'
3
3
  end
@@ -0,0 +1,433 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
3
+ <edmx:Reference Uri="http://vocabularies.odata.org/OData.Community.Keys.V1.xml">
4
+ <edmx:Include Namespace="OData.Community.Keys.V1" Alias="Keys"/>
5
+ <edmx:IncludeAnnotations TermNamespace="OData.Community.Keys.V1"/>
6
+ </edmx:Reference>
7
+ <edmx:Reference Uri="http://vocabularies.odata.org/OData.Community.Display.V1.xml">
8
+ <edmx:Include Namespace="OData.Community.Display.V1" Alias="Display"/>
9
+ <edmx:IncludeAnnotations TermNamespace="OData.Community.Display.V1"/>
10
+ </edmx:Reference>
11
+ <edmx:DataServices>
12
+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Microsoft.Dynamics.CRM" Alias="mscrm">
13
+ <EntityType Name="crmbaseentity" Abstract="true"/>
14
+ <EntityType Name="contact" BaseType="mscrm.crmbaseentity">
15
+ <Key>
16
+ <PropertyRef Name="contactid"/>
17
+ </Key>
18
+ <Property Name="spousesname" Type="Edm.String" Unicode="false"/>
19
+ <Property Name="emailaddress3" Type="Edm.String" Unicode="false"/>
20
+ <Property Name="address3_telephone3" Type="Edm.String" Unicode="false"/>
21
+ <Property Name="teamsfollowed" Type="Edm.Int32"/>
22
+ <Property Name="mobilephone" Type="Edm.String" Unicode="false"/>
23
+ <Property Name="utcconversiontimezonecode" Type="Edm.Int32"/>
24
+ <Property Name="_preferredserviceid_value" Type="Edm.Guid"/>
25
+ <Property Name="address3_shippingmethodcode" Type="Edm.Int32"/>
26
+ <Property Name="address3_postalcode" Type="Edm.String" Unicode="false"/>
27
+ <Property Name="versionnumber" Type="Edm.Int64"/>
28
+ <Property Name="annualincome" Type="Edm.Decimal" Scale="Variable"/>
29
+ <Property Name="address2_line2" Type="Edm.String" Unicode="false"/>
30
+ <Property Name="fax" Type="Edm.String" Unicode="false"/>
31
+ <Property Name="telephone3" Type="Edm.String" Unicode="false"/>
32
+ <Property Name="address1_primarycontactname" Type="Edm.String" Unicode="false"/>
33
+ <Property Name="address3_city" Type="Edm.String" Unicode="false"/>
34
+ <Property Name="lastonholdtime" Type="Edm.DateTimeOffset"/>
35
+ <Property Name="address2_stateorprovince" Type="Edm.String" Unicode="false"/>
36
+ <Property Name="_createdby_value" Type="Edm.Guid"/>
37
+ <Property Name="address2_line1" Type="Edm.String" Unicode="false"/>
38
+ <Property Name="assistantphone" Type="Edm.String" Unicode="false"/>
39
+ <Property Name="lastusedincampaign" Type="Edm.DateTimeOffset"/>
40
+ <Property Name="address3_freighttermscode" Type="Edm.Int32"/>
41
+ <Property Name="pager" Type="Edm.String" Unicode="false"/>
42
+ <Property Name="employeeid" Type="Edm.String" Unicode="false"/>
43
+ <Property Name="address1_latitude" Type="Edm.Double"/>
44
+ <Property Name="_parentcustomerid_value" Type="Edm.Guid"/>
45
+ <Property Name="managername" Type="Edm.String" Unicode="false"/>
46
+ <Property Name="birthdate" Type="Edm.Date"/>
47
+ <Property Name="address1_name" Type="Edm.String" Unicode="false"/>
48
+ <Property Name="department" Type="Edm.String" Unicode="false"/>
49
+ <Property Name="address3_country" Type="Edm.String" Unicode="false"/>
50
+ <Property Name="address2_telephone1" Type="Edm.String" Unicode="false"/>
51
+ <Property Name="address2_primarycontactname" Type="Edm.String" Unicode="false"/>
52
+ <Property Name="address2_latitude" Type="Edm.Double"/>
53
+ <Property Name="territorycode" Type="Edm.Int32"/>
54
+ <Property Name="timezoneruleversionnumber" Type="Edm.Int32"/>
55
+ <Property Name="address2_postalcode" Type="Edm.String" Unicode="false"/>
56
+ <Property Name="entityimage_timestamp" Type="Edm.Int64"/>
57
+ <Property Name="_originatingleadid_value" Type="Edm.Guid"/>
58
+ <Property Name="_owninguser_value" Type="Edm.Guid"/>
59
+ <Property Name="merged" Type="Edm.Boolean"/>
60
+ <Property Name="_masterid_value" Type="Edm.Guid"/>
61
+ <Property Name="_createdonbehalfby_value" Type="Edm.Guid"/>
62
+ <Property Name="address3_longitude" Type="Edm.Double"/>
63
+ <Property Name="subscriptionid" Type="Edm.Guid"/>
64
+ <Property Name="business2" Type="Edm.String" Unicode="false"/>
65
+ <Property Name="address3_county" Type="Edm.String" Unicode="false"/>
66
+ <Property Name="address1_freighttermscode" Type="Edm.Int32"/>
67
+ <Property Name="customertypecode" Type="Edm.Int32"/>
68
+ <Property Name="address3_addresstypecode" Type="Edm.Int32"/>
69
+ <Property Name="address1_longitude" Type="Edm.Double"/>
70
+ <Property Name="address1_addresstypecode" Type="Edm.Int32"/>
71
+ <Property Name="statuscode" Type="Edm.Int32"/>
72
+ <Property Name="yomifullname" Type="Edm.String" Unicode="false"/>
73
+ <Property Name="aging90_base" Type="Edm.Decimal" Scale="Variable"/>
74
+ <Property Name="address3_primarycontactname" Type="Edm.String" Unicode="false"/>
75
+ <Property Name="familystatuscode" Type="Edm.Int32"/>
76
+ <Property Name="home2" Type="Edm.String" Unicode="false"/>
77
+ <Property Name="address3_addressid" Type="Edm.Guid"/>
78
+ <Property Name="address2_utcoffset" Type="Edm.Int32"/>
79
+ <Property Name="aging60" Type="Edm.Decimal" Scale="Variable"/>
80
+ <Property Name="statecode" Type="Edm.Int32"/>
81
+ <Property Name="address2_freighttermscode" Type="Edm.Int32"/>
82
+ <Property Name="address1_composite" Type="Edm.String" Unicode="false"/>
83
+ <Property Name="importsequencenumber" Type="Edm.Int32"/>
84
+ <Property Name="yomimiddlename" Type="Edm.String" Unicode="false"/>
85
+ <Property Name="_modifiedonbehalfby_value" Type="Edm.Guid"/>
86
+ <Property Name="jobtitle" Type="Edm.String" Unicode="false"/>
87
+ <Property Name="address3_utcoffset" Type="Edm.Int32"/>
88
+ <Property Name="address2_addresstypecode" Type="Edm.Int32"/>
89
+ <Property Name="educationcode" Type="Edm.Int32"/>
90
+ <Property Name="address1_telephone3" Type="Edm.String" Unicode="false"/>
91
+ <Property Name="msdyn_orgchangestatus" Type="Edm.Int32"/>
92
+ <Property Name="followemail" Type="Edm.Boolean"/>
93
+ <Property Name="preferredcontactmethodcode" Type="Edm.Int32"/>
94
+ <Property Name="gendercode" Type="Edm.Int32"/>
95
+ <Property Name="msdyn_gdproptout" Type="Edm.Boolean"/>
96
+ <Property Name="creditlimit_base" Type="Edm.Decimal" Scale="Variable"/>
97
+ <Property Name="donotfax" Type="Edm.Boolean"/>
98
+ <Property Name="address3_line1" Type="Edm.String" Unicode="false"/>
99
+ <Property Name="address1_county" Type="Edm.String" Unicode="false"/>
100
+ <Property Name="_owningbusinessunit_value" Type="Edm.Guid"/>
101
+ <Property Name="_createdbyexternalparty_value" Type="Edm.Guid"/>
102
+ <Property Name="address2_shippingmethodcode" Type="Edm.Int32"/>
103
+ <Property Name="address1_fax" Type="Edm.String" Unicode="false"/>
104
+ <Property Name="entityimageid" Type="Edm.Guid"/>
105
+ <Property Name="processid" Type="Edm.Guid"/>
106
+ <Property Name="address1_telephone2" Type="Edm.String" Unicode="false"/>
107
+ <Property Name="description" Type="Edm.String" Unicode="false"/>
108
+ <Property Name="marketingonly" Type="Edm.Boolean"/>
109
+ <Property Name="address3_line2" Type="Edm.String" Unicode="false"/>
110
+ <Property Name="address2_composite" Type="Edm.String" Unicode="false"/>
111
+ <Property Name="donotpostalmail" Type="Edm.Boolean"/>
112
+ <Property Name="externaluseridentifier" Type="Edm.String" Unicode="false"/>
113
+ <Property Name="aging30_base" Type="Edm.Decimal" Scale="Variable"/>
114
+ <Property Name="callback" Type="Edm.String" Unicode="false"/>
115
+ <Property Name="emailaddress2" Type="Edm.String" Unicode="false"/>
116
+ <Property Name="address2_line3" Type="Edm.String" Unicode="false"/>
117
+ <Property Name="managerphone" Type="Edm.String" Unicode="false"/>
118
+ <Property Name="preferredappointmentdaycode" Type="Edm.Int32"/>
119
+ <Property Name="websiteurl" Type="Edm.String" Unicode="false"/>
120
+ <Property Name="exchangerate" Type="Edm.Decimal" Scale="Variable"/>
121
+ <Property Name="firstname" Type="Edm.String" Unicode="false"/>
122
+ <Property Name="address1_telephone1" Type="Edm.String" Unicode="false"/>
123
+ <Property Name="address3_composite" Type="Edm.String" Unicode="false"/>
124
+ <Property Name="address3_fax" Type="Edm.String" Unicode="false"/>
125
+ <Property Name="childrensnames" Type="Edm.String" Unicode="false"/>
126
+ <Property Name="_owningteam_value" Type="Edm.Guid"/>
127
+ <Property Name="numberofchildren" Type="Edm.Int32"/>
128
+ <Property Name="address2_postofficebox" Type="Edm.String" Unicode="false"/>
129
+ <Property Name="aging90" Type="Edm.Decimal" Scale="Variable"/>
130
+ <Property Name="donotbulkpostalmail" Type="Edm.Boolean"/>
131
+ <Property Name="emailaddress1" Type="Edm.String" Unicode="false"/>
132
+ <Property Name="donotbulkemail" Type="Edm.Boolean"/>
133
+ <Property Name="customersizecode" Type="Edm.Int32"/>
134
+ <Property Name="address1_city" Type="Edm.String" Unicode="false"/>
135
+ <Property Name="preferredappointmenttimecode" Type="Edm.Int32"/>
136
+ <Property Name="address3_latitude" Type="Edm.Double"/>
137
+ <Property Name="aging60_base" Type="Edm.Decimal" Scale="Variable"/>
138
+ <Property Name="_transactioncurrencyid_value" Type="Edm.Guid"/>
139
+ <Property Name="entityimage" Type="Edm.Binary"/>
140
+ <Property Name="_modifiedbyexternalparty_value" Type="Edm.Guid"/>
141
+ <Property Name="paymenttermscode" Type="Edm.Int32"/>
142
+ <Property Name="address3_name" Type="Edm.String" Unicode="false"/>
143
+ <Property Name="participatesinworkflow" Type="Edm.Boolean"/>
144
+ <Property Name="leadsourcecode" Type="Edm.Int32"/>
145
+ <Property Name="ftpsiteurl" Type="Edm.String" Unicode="false"/>
146
+ <Property Name="address1_shippingmethodcode" Type="Edm.Int32"/>
147
+ <Property Name="_modifiedby_value" Type="Edm.Guid"/>
148
+ <Property Name="_preferredsystemuserid_value" Type="Edm.Guid"/>
149
+ <Property Name="address2_telephone2" Type="Edm.String" Unicode="false"/>
150
+ <Property Name="_slainvokedid_value" Type="Edm.Guid"/>
151
+ <Property Name="address1_addressid" Type="Edm.Guid"/>
152
+ <Property Name="address3_telephone1" Type="Edm.String" Unicode="false"/>
153
+ <Property Name="nickname" Type="Edm.String" Unicode="false"/>
154
+ <Property Name="address1_postofficebox" Type="Edm.String" Unicode="false"/>
155
+ <Property Name="_preferredequipmentid_value" Type="Edm.Guid"/>
156
+ <Property Name="assistantname" Type="Edm.String" Unicode="false"/>
157
+ <Property Name="address2_country" Type="Edm.String" Unicode="false"/>
158
+ <Property Name="modifiedon" Type="Edm.DateTimeOffset"/>
159
+ <Property Name="_accountid_value" Type="Edm.Guid"/>
160
+ <Property Name="address2_name" Type="Edm.String" Unicode="false"/>
161
+ <Property Name="stageid" Type="Edm.Guid"/>
162
+ <Property Name="creditonhold" Type="Edm.Boolean"/>
163
+ <Property Name="onholdtime" Type="Edm.Int32"/>
164
+ <Property Name="address2_telephone3" Type="Edm.String" Unicode="false"/>
165
+ <Property Name="donotphone" Type="Edm.Boolean"/>
166
+ <Property Name="address3_upszone" Type="Edm.String" Unicode="false"/>
167
+ <Property Name="telephone2" Type="Edm.String" Unicode="false"/>
168
+ <Property Name="contactid" Type="Edm.Guid"/>
169
+ <Property Name="aging30" Type="Edm.Decimal" Scale="Variable"/>
170
+ <Property Name="address2_upszone" Type="Edm.String" Unicode="false"/>
171
+ <Property Name="address1_upszone" Type="Edm.String" Unicode="false"/>
172
+ <Property Name="creditlimit" Type="Edm.Decimal" Scale="Variable"/>
173
+ <Property Name="accountrolecode" Type="Edm.Int32"/>
174
+ <Property Name="salutation" Type="Edm.String" Unicode="false"/>
175
+ <Property Name="suffix" Type="Edm.String" Unicode="false"/>
176
+ <Property Name="traversedpath" Type="Edm.String" Unicode="false"/>
177
+ <Property Name="address1_utcoffset" Type="Edm.Int32"/>
178
+ <Property Name="governmentid" Type="Edm.String" Unicode="false"/>
179
+ <Property Name="fullname" Type="Edm.String" Unicode="false"/>
180
+ <Property Name="address1_stateorprovince" Type="Edm.String" Unicode="false"/>
181
+ <Property Name="donotsendmm" Type="Edm.Boolean"/>
182
+ <Property Name="annualincome_base" Type="Edm.Decimal" Scale="Variable"/>
183
+ <Property Name="address1_country" Type="Edm.String" Unicode="false"/>
184
+ <Property Name="address3_stateorprovince" Type="Edm.String" Unicode="false"/>
185
+ <Property Name="lastname" Type="Edm.String" Unicode="false"/>
186
+ <Property Name="address2_city" Type="Edm.String" Unicode="false"/>
187
+ <Property Name="donotemail" Type="Edm.Boolean"/>
188
+ <Property Name="company" Type="Edm.String" Unicode="false"/>
189
+ <Property Name="address3_postofficebox" Type="Edm.String" Unicode="false"/>
190
+ <Property Name="address1_line2" Type="Edm.String" Unicode="false"/>
191
+ <Property Name="address2_longitude" Type="Edm.Double"/>
192
+ <Property Name="address3_telephone2" Type="Edm.String" Unicode="false"/>
193
+ <Property Name="yomifirstname" Type="Edm.String" Unicode="false"/>
194
+ <Property Name="telephone1" Type="Edm.String" Unicode="false"/>
195
+ <Property Name="address1_line1" Type="Edm.String" Unicode="false"/>
196
+ <Property Name="address2_addressid" Type="Edm.Guid"/>
197
+ <Property Name="isbackofficecustomer" Type="Edm.Boolean"/>
198
+ <Property Name="address2_county" Type="Edm.String" Unicode="false"/>
199
+ <Property Name="shippingmethodcode" Type="Edm.Int32"/>
200
+ <Property Name="anniversary" Type="Edm.Date"/>
201
+ <Property Name="_ownerid_value" Type="Edm.Guid"/>
202
+ <Property Name="_parentcontactid_value" Type="Edm.Guid"/>
203
+ <Property Name="haschildrencode" Type="Edm.Int32"/>
204
+ <Property Name="address2_fax" Type="Edm.String" Unicode="false"/>
205
+ <Property Name="yomilastname" Type="Edm.String" Unicode="false"/>
206
+ <Property Name="createdon" Type="Edm.DateTimeOffset"/>
207
+ <Property Name="entityimage_url" Type="Edm.String" Unicode="false"/>
208
+ <Property Name="address1_line3" Type="Edm.String" Unicode="false"/>
209
+ <Property Name="_defaultpricelevelid_value" Type="Edm.Guid"/>
210
+ <Property Name="_slaid_value" Type="Edm.Guid"/>
211
+ <Property Name="middlename" Type="Edm.String" Unicode="false"/>
212
+ <Property Name="address1_postalcode" Type="Edm.String" Unicode="false"/>
213
+ <Property Name="address3_line3" Type="Edm.String" Unicode="false"/>
214
+ <Property Name="overriddencreatedon" Type="Edm.DateTimeOffset"/>
215
+ <Property Name="timespentbymeonemailandmeetings" Type="Edm.String" Unicode="false"/>
216
+ <NavigationProperty Name="lead_customer_contacts" Type="Collection(mscrm.lead)" Partner="customerid_contact"/>
217
+ <NavigationProperty Name="contactleads_association" Type="Collection(mscrm.lead)" Partner="contactleads_association"/>
218
+ <NavigationProperty Name="lead_parent_contact" Type="Collection(mscrm.lead)" Partner="parentcontactid"/>
219
+ <NavigationProperty Name="originatingleadid" Type="mscrm.lead" Nullable="false" Partner="contact_originating_lead">
220
+ <ReferentialConstraint Property="_originatingleadid_value" ReferencedProperty="leadid"/>
221
+ </NavigationProperty>
222
+ <NavigationProperty Name="defaultpricelevelid" Type="mscrm.pricelevel" Nullable="false" Partner="price_level_contacts">
223
+ <ReferentialConstraint Property="_defaultpricelevelid_value" ReferencedProperty="pricelevelid"/>
224
+ </NavigationProperty>
225
+ <NavigationProperty Name="contact_bookableresource_ContactId" Type="Collection(mscrm.bookableresource)" Partner="ContactId"/>
226
+ <NavigationProperty Name="contact_BulkOperations" Type="Collection(mscrm.bulkoperation)" Partner="regardingobjectid_contact_bulkoperation"/>
227
+ <NavigationProperty Name="contact_CampaignResponses" Type="Collection(mscrm.campaignresponse)" Partner="regardingobjectid_contact_campaignresponse"/>
228
+ <NavigationProperty Name="CreatedContact_BulkOperationLogs" Type="Collection(mscrm.bulkoperationlog)" Partner="createdobjectid_contact"/>
229
+ <NavigationProperty Name="SourceContact_BulkOperationLogs" Type="Collection(mscrm.bulkoperationlog)" Partner="regardingobjectid_contact"/>
230
+ <NavigationProperty Name="listcontact_association" Type="Collection(mscrm.list)" Partner="listcontact_association"/>
231
+ <NavigationProperty Name="Contact_ServiceAppointments" Type="Collection(mscrm.serviceappointment)" Partner="regardingobjectid_contact_serviceappointment"/>
232
+ <NavigationProperty Name="contact_as_responsible_contact" Type="Collection(mscrm.incident)" Partner="responsiblecontactid"/>
233
+ <NavigationProperty Name="contractlineitem_customer_contacts" Type="Collection(mscrm.contractdetail)" Partner="customerid_contact"/>
234
+ <NavigationProperty Name="contract_billingcustomer_contacts" Type="Collection(mscrm.contract)" Partner="billingcustomerid_contact"/>
235
+ <NavigationProperty Name="contract_customer_contacts" Type="Collection(mscrm.contract)" Partner="customerid_contact"/>
236
+ <NavigationProperty Name="incident_customer_contacts" Type="Collection(mscrm.incident)" Partner="customerid_contact"/>
237
+ <NavigationProperty Name="contact_as_primary_contact" Type="Collection(mscrm.incident)" Partner="primarycontactid"/>
238
+ <NavigationProperty Name="contact_entitlement_ContactId" Type="Collection(mscrm.entitlement)" Partner="contactid"/>
239
+ <NavigationProperty Name="contact_entitlement_Customer" Type="Collection(mscrm.entitlement)" Partner="customerid_contact"/>
240
+ <NavigationProperty Name="entitlementcontacts_association" Type="Collection(mscrm.entitlement)" Partner="entitlementcontacts_association"/>
241
+ <NavigationProperty Name="servicecontractcontacts_association" Type="Collection(mscrm.contract)" Partner="servicecontractcontacts_association"/>
242
+ <NavigationProperty Name="preferredequipmentid" Type="mscrm.equipment" Nullable="false" Partner="equipment_contacts">
243
+ <ReferentialConstraint Property="_preferredequipmentid_value" ReferencedProperty="equipmentid"/>
244
+ </NavigationProperty>
245
+ <NavigationProperty Name="preferredserviceid" Type="mscrm.service" Nullable="false" Partner="service_contacts">
246
+ <ReferentialConstraint Property="_preferredserviceid_value" ReferencedProperty="serviceid"/>
247
+ </NavigationProperty>
248
+ <NavigationProperty Name="contactinvoices_association" Type="Collection(mscrm.invoice)" Partner="contactinvoices_association"/>
249
+ <NavigationProperty Name="contactorders_association" Type="Collection(mscrm.salesorder)" Partner="contactorders_association"/>
250
+ <NavigationProperty Name="invoice_customer_contacts" Type="Collection(mscrm.invoice)" Partner="customerid_contact"/>
251
+ <NavigationProperty Name="opportunity_customer_contacts" Type="Collection(mscrm.opportunity)" Partner="customerid_contact"/>
252
+ <NavigationProperty Name="order_customer_contacts" Type="Collection(mscrm.salesorder)" Partner="customerid_contact"/>
253
+ <NavigationProperty Name="quote_customer_contacts" Type="Collection(mscrm.quote)" Partner="customerid_contact"/>
254
+ <NavigationProperty Name="contactquotes_association" Type="Collection(mscrm.quote)" Partner="contactquotes_association"/>
255
+ <NavigationProperty Name="opportunity_parent_contact" Type="Collection(mscrm.opportunity)" Partner="parentcontactid"/>
256
+ <NavigationProperty Name="contact_principalobjectattributeaccess" Type="Collection(mscrm.principalobjectattributeaccess)" Partner="objectid_contact"/>
257
+ <NavigationProperty Name="contact_connections1" Type="Collection(mscrm.connection)" Partner="record1id_contact"/>
258
+ <NavigationProperty Name="Contact_Feedback" Type="Collection(mscrm.feedback)" Partner="ContactId"/>
259
+ <NavigationProperty Name="Contact_ProcessSessions" Type="Collection(mscrm.processsession)" Partner="regardingobjectid_contact"/>
260
+ <NavigationProperty Name="stageid_processstage" Type="mscrm.processstage" Nullable="false" Partner="processstage_contact">
261
+ <ReferentialConstraint Property="stageid" ReferencedProperty="processstageid"/>
262
+ </NavigationProperty>
263
+ <NavigationProperty Name="Contact_ActivityPointers" Type="Collection(mscrm.activitypointer)" Partner="regardingobjectid_contact"/>
264
+ <NavigationProperty Name="Contact_SocialActivities" Type="Collection(mscrm.socialactivity)" Partner="regardingobjectid_contact_socialactivity"/>
265
+ <NavigationProperty Name="lk_contact_feedback_createdonbehalfby" Type="Collection(mscrm.feedback)" Partner="CreatedOnBehalfByContact"/>
266
+ <NavigationProperty Name="contact_PostFollows" Type="Collection(mscrm.postfollow)" Partner="regardingobjectid_contact"/>
267
+ <NavigationProperty Name="contact_PostRegardings" Type="Collection(mscrm.postregarding)" Partner="regardingobjectid_contact"/>
268
+ <NavigationProperty Name="socialactivity_postauthor_contacts" Type="Collection(mscrm.socialactivity)" Partner="postauthor_contact"/>
269
+ <NavigationProperty Name="Contact_Phonecalls" Type="Collection(mscrm.phonecall)" Partner="regardingobjectid_contact_phonecall"/>
270
+ <NavigationProperty Name="Contact_Tasks" Type="Collection(mscrm.task)" Partner="regardingobjectid_contact_task"/>
271
+ <NavigationProperty Name="Contact_SyncErrors" Type="Collection(mscrm.syncerror)" Partner="regardingobjectid_contact_syncerror"/>
272
+ <NavigationProperty Name="slainvokedid_contact_sla" Type="mscrm.sla" Nullable="false" Partner="sla_contact">
273
+ <ReferentialConstraint Property="_slainvokedid_value" ReferencedProperty="slaid"/>
274
+ </NavigationProperty>
275
+ <NavigationProperty Name="sla_contact_sla" Type="mscrm.sla" Nullable="false" Partner="manualsla_contact">
276
+ <ReferentialConstraint Property="_slaid_value" ReferencedProperty="slaid"/>
277
+ </NavigationProperty>
278
+ <NavigationProperty Name="createdonbehalfby" Type="mscrm.systemuser" Nullable="false" Partner="lk_contact_createdonbehalfby">
279
+ <ReferentialConstraint Property="_createdonbehalfby_value" ReferencedProperty="systemuserid"/>
280
+ </NavigationProperty>
281
+ <NavigationProperty Name="Contact_Annotation" Type="Collection(mscrm.annotation)" Partner="objectid_contact"/>
282
+ <NavigationProperty Name="masterid" Type="mscrm.contact" Nullable="false" Partner="contact_master_contact">
283
+ <ReferentialConstraint Property="_masterid_value" ReferencedProperty="contactid"/>
284
+ </NavigationProperty>
285
+ <NavigationProperty Name="contact_master_contact" Type="Collection(mscrm.contact)" Partner="masterid"/>
286
+ <NavigationProperty Name="modifiedonbehalfby" Type="mscrm.systemuser" Nullable="false" Partner="lk_contact_modifiedonbehalfby">
287
+ <ReferentialConstraint Property="_modifiedonbehalfby_value" ReferencedProperty="systemuserid"/>
288
+ </NavigationProperty>
289
+ <NavigationProperty Name="Contact_Email_EmailSender" Type="Collection(mscrm.email)" Partner="emailsender_contact"/>
290
+ <NavigationProperty Name="account_primary_contact" Type="Collection(mscrm.account)" Partner="primarycontactid"/>
291
+ <NavigationProperty Name="createdby" Type="mscrm.systemuser" Nullable="false" Partner="lk_contactbase_createdby">
292
+ <ReferentialConstraint Property="_createdby_value" ReferencedProperty="systemuserid"/>
293
+ </NavigationProperty>
294
+ <NavigationProperty Name="contact_actioncard" Type="Collection(mscrm.actioncard)" Partner="regardingobjectid_contact_actioncard"/>
295
+ <NavigationProperty Name="socialactivity_postauthoraccount_contacts" Type="Collection(mscrm.socialactivity)" Partner="postauthoraccount_contact"/>
296
+ <NavigationProperty Name="Socialprofile_customer_contacts" Type="Collection(mscrm.socialprofile)" Partner="customerid_contact"/>
297
+ <NavigationProperty Name="Contact_CustomerAddress" Type="Collection(mscrm.customeraddress)" Partner="parentid_contact"/>
298
+ <NavigationProperty Name="owningbusinessunit" Type="mscrm.businessunit" Nullable="false" Partner="business_unit_contacts">
299
+ <ReferentialConstraint Property="_owningbusinessunit_value" ReferencedProperty="businessunitid"/>
300
+ </NavigationProperty>
301
+ <NavigationProperty Name="owningteam" Type="mscrm.team" Nullable="false" Partner="team_contacts">
302
+ <ReferentialConstraint Property="_owningteam_value" ReferencedProperty="teamid"/>
303
+ </NavigationProperty>
304
+ <NavigationProperty Name="parentcustomerid_account" Type="mscrm.account" Nullable="false" Partner="contact_customer_accounts">
305
+ <ReferentialConstraint Property="_parentcustomerid_value" ReferencedProperty="accountid"/>
306
+ </NavigationProperty>
307
+ <NavigationProperty Name="Contact_DuplicateMatchingRecord" Type="Collection(mscrm.duplicaterecord)" Partner="duplicaterecordid_contact"/>
308
+ <NavigationProperty Name="lk_contact_feedback_createdby" Type="Collection(mscrm.feedback)" Partner="CreatedByContact"/>
309
+ <NavigationProperty Name="slakpiinstance_contact" Type="Collection(mscrm.slakpiinstance)" Partner="regarding_contact"/>
310
+ <NavigationProperty Name="preferredsystemuserid" Type="mscrm.systemuser" Nullable="false" Partner="system_user_contacts">
311
+ <ReferentialConstraint Property="_preferredsystemuserid_value" ReferencedProperty="systemuserid"/>
312
+ </NavigationProperty>
313
+ <NavigationProperty Name="Contact_Faxes" Type="Collection(mscrm.fax)" Partner="regardingobjectid_contact_fax"/>
314
+ <NavigationProperty Name="Contact_MailboxTrackingFolder" Type="Collection(mscrm.mailboxtrackingfolder)" Partner="regardingobjectid_contact"/>
315
+ <NavigationProperty Name="Contact_Appointments" Type="Collection(mscrm.appointment)" Partner="regardingobjectid_contact_appointment"/>
316
+ <NavigationProperty Name="owninguser" Type="mscrm.systemuser" Nullable="false" Partner="contact_owning_user">
317
+ <ReferentialConstraint Property="_owninguser_value" ReferencedProperty="systemuserid"/>
318
+ </NavigationProperty>
319
+ <NavigationProperty Name="Contact_AsyncOperations" Type="Collection(mscrm.asyncoperation)" Partner="regardingobjectid_contact"/>
320
+ <NavigationProperty Name="ownerid" Type="mscrm.principal" Nullable="false" Partner="owner_contacts">
321
+ <ReferentialConstraint Property="_ownerid_value" ReferencedProperty="ownerid"/>
322
+ </NavigationProperty>
323
+ <NavigationProperty Name="transactioncurrencyid" Type="mscrm.transactioncurrency" Nullable="false" Partner="transactioncurrency_contact">
324
+ <ReferentialConstraint Property="_transactioncurrencyid_value" ReferencedProperty="transactioncurrencyid"/>
325
+ </NavigationProperty>
326
+ <NavigationProperty Name="Contact_RecurringAppointmentMasters" Type="Collection(mscrm.recurringappointmentmaster)" Partner="regardingobjectid_contact_recurringappointmentmaster"/>
327
+ <NavigationProperty Name="Contact_BulkDeleteFailures" Type="Collection(mscrm.bulkdeletefailure)" Partner="regardingobjectid_contact"/>
328
+ <NavigationProperty Name="parentcustomerid_contact" Type="mscrm.contact" Nullable="false" Partner="contact_customer_contacts">
329
+ <ReferentialConstraint Property="_parentcustomerid_value" ReferencedProperty="contactid"/>
330
+ </NavigationProperty>
331
+ <NavigationProperty Name="contact_customer_contacts" Type="Collection(mscrm.contact)" Partner="parentcustomerid_contact"/>
332
+ <NavigationProperty Name="contact_connections2" Type="Collection(mscrm.connection)" Partner="record2id_contact"/>
333
+ <NavigationProperty Name="Contact_DuplicateBaseRecord" Type="Collection(mscrm.duplicaterecord)" Partner="baserecordid_contact"/>
334
+ <NavigationProperty Name="modifiedby" Type="mscrm.systemuser" Nullable="false" Partner="lk_contactbase_modifiedby">
335
+ <ReferentialConstraint Property="_modifiedby_value" ReferencedProperty="systemuserid"/>
336
+ </NavigationProperty>
337
+ <NavigationProperty Name="Contact_Emails" Type="Collection(mscrm.email)" Partner="regardingobjectid_contact_email"/>
338
+ <NavigationProperty Name="Contact_FileAttachment" Type="Collection(mscrm.fileattachment)" Partner="objectid_contact_fileattachment"/>
339
+ <NavigationProperty Name="contact_activity_parties" Type="Collection(mscrm.activityparty)" Partner="partyid_contact"/>
340
+ <NavigationProperty Name="Contact_Letters" Type="Collection(mscrm.letter)" Partner="regardingobjectid_contact_letter"/>
341
+ </EntityType>
342
+ <EntityContainer Name="System">
343
+ <EntitySet Name="contacts" EntityType="Microsoft.Dynamics.CRM.contact">
344
+ <NavigationPropertyBinding Path="lead_customer_contacts" Target="leads"/>
345
+ <NavigationPropertyBinding Path="contactleads_association" Target="leads"/>
346
+ <NavigationPropertyBinding Path="lead_parent_contact" Target="leads"/>
347
+ <NavigationPropertyBinding Path="originatingleadid" Target="leads"/>
348
+ <NavigationPropertyBinding Path="defaultpricelevelid" Target="pricelevels"/>
349
+ <NavigationPropertyBinding Path="contact_bookableresource_ContactId" Target="bookableresources"/>
350
+ <NavigationPropertyBinding Path="contact_BulkOperations" Target="bulkoperations"/>
351
+ <NavigationPropertyBinding Path="contact_CampaignResponses" Target="campaignresponses"/>
352
+ <NavigationPropertyBinding Path="CreatedContact_BulkOperationLogs" Target="bulkoperationlogs"/>
353
+ <NavigationPropertyBinding Path="SourceContact_BulkOperationLogs" Target="bulkoperationlogs"/>
354
+ <NavigationPropertyBinding Path="listcontact_association" Target="lists"/>
355
+ <NavigationPropertyBinding Path="Contact_ServiceAppointments" Target="serviceappointments"/>
356
+ <NavigationPropertyBinding Path="contact_as_responsible_contact" Target="incidents"/>
357
+ <NavigationPropertyBinding Path="contractlineitem_customer_contacts" Target="contractdetails"/>
358
+ <NavigationPropertyBinding Path="contract_billingcustomer_contacts" Target="contracts"/>
359
+ <NavigationPropertyBinding Path="contract_customer_contacts" Target="contracts"/>
360
+ <NavigationPropertyBinding Path="incident_customer_contacts" Target="incidents"/>
361
+ <NavigationPropertyBinding Path="contact_as_primary_contact" Target="incidents"/>
362
+ <NavigationPropertyBinding Path="contact_entitlement_ContactId" Target="entitlements"/>
363
+ <NavigationPropertyBinding Path="contact_entitlement_Customer" Target="entitlements"/>
364
+ <NavigationPropertyBinding Path="entitlementcontacts_association" Target="entitlements"/>
365
+ <NavigationPropertyBinding Path="servicecontractcontacts_association" Target="contracts"/>
366
+ <NavigationPropertyBinding Path="preferredequipmentid" Target="equipments"/>
367
+ <NavigationPropertyBinding Path="preferredserviceid" Target="services"/>
368
+ <NavigationPropertyBinding Path="contactinvoices_association" Target="invoices"/>
369
+ <NavigationPropertyBinding Path="contactorders_association" Target="salesorders"/>
370
+ <NavigationPropertyBinding Path="invoice_customer_contacts" Target="invoices"/>
371
+ <NavigationPropertyBinding Path="opportunity_customer_contacts" Target="opportunities"/>
372
+ <NavigationPropertyBinding Path="order_customer_contacts" Target="salesorders"/>
373
+ <NavigationPropertyBinding Path="quote_customer_contacts" Target="quotes"/>
374
+ <NavigationPropertyBinding Path="contactquotes_association" Target="quotes"/>
375
+ <NavigationPropertyBinding Path="opportunity_parent_contact" Target="opportunities"/>
376
+ <NavigationPropertyBinding Path="contact_principalobjectattributeaccess" Target="principalobjectattributeaccessset"/>
377
+ <NavigationPropertyBinding Path="contact_connections1" Target="connections"/>
378
+ <NavigationPropertyBinding Path="Contact_Feedback" Target="feedback"/>
379
+ <NavigationPropertyBinding Path="Contact_ProcessSessions" Target="processsessions"/>
380
+ <NavigationPropertyBinding Path="stageid_processstage" Target="processstages"/>
381
+ <NavigationPropertyBinding Path="Contact_ActivityPointers" Target="activitypointers"/>
382
+ <NavigationPropertyBinding Path="Contact_SocialActivities" Target="socialactivities"/>
383
+ <NavigationPropertyBinding Path="lk_contact_feedback_createdonbehalfby" Target="feedback"/>
384
+ <NavigationPropertyBinding Path="contact_PostFollows" Target="postfollows"/>
385
+ <NavigationPropertyBinding Path="contact_PostRegardings" Target="postregardings"/>
386
+ <NavigationPropertyBinding Path="socialactivity_postauthor_contacts" Target="socialactivities"/>
387
+ <NavigationPropertyBinding Path="Contact_Phonecalls" Target="phonecalls"/>
388
+ <NavigationPropertyBinding Path="Contact_Tasks" Target="tasks"/>
389
+ <NavigationPropertyBinding Path="Contact_SyncErrors" Target="syncerrors"/>
390
+ <NavigationPropertyBinding Path="slainvokedid_contact_sla" Target="slas"/>
391
+ <NavigationPropertyBinding Path="sla_contact_sla" Target="slas"/>
392
+ <NavigationPropertyBinding Path="createdonbehalfby" Target="systemusers"/>
393
+ <NavigationPropertyBinding Path="Contact_Annotation" Target="annotations"/>
394
+ <NavigationPropertyBinding Path="masterid" Target="contacts"/>
395
+ <NavigationPropertyBinding Path="contact_master_contact" Target="contacts"/>
396
+ <NavigationPropertyBinding Path="modifiedonbehalfby" Target="systemusers"/>
397
+ <NavigationPropertyBinding Path="Contact_Email_EmailSender" Target="emails"/>
398
+ <NavigationPropertyBinding Path="account_primary_contact" Target="accounts"/>
399
+ <NavigationPropertyBinding Path="createdby" Target="systemusers"/>
400
+ <NavigationPropertyBinding Path="contact_actioncard" Target="actioncards"/>
401
+ <NavigationPropertyBinding Path="socialactivity_postauthoraccount_contacts" Target="socialactivities"/>
402
+ <NavigationPropertyBinding Path="Socialprofile_customer_contacts" Target="socialprofiles"/>
403
+ <NavigationPropertyBinding Path="Contact_CustomerAddress" Target="customeraddresses"/>
404
+ <NavigationPropertyBinding Path="owningbusinessunit" Target="businessunits"/>
405
+ <NavigationPropertyBinding Path="owningteam" Target="teams"/>
406
+ <NavigationPropertyBinding Path="parentcustomerid_account" Target="accounts"/>
407
+ <NavigationPropertyBinding Path="Contact_DuplicateMatchingRecord" Target="duplicaterecords"/>
408
+ <NavigationPropertyBinding Path="lk_contact_feedback_createdby" Target="feedback"/>
409
+ <NavigationPropertyBinding Path="slakpiinstance_contact" Target="slakpiinstances"/>
410
+ <NavigationPropertyBinding Path="preferredsystemuserid" Target="systemusers"/>
411
+ <NavigationPropertyBinding Path="Contact_Faxes" Target="faxes"/>
412
+ <NavigationPropertyBinding Path="Contact_MailboxTrackingFolder" Target="mailboxtrackingfolders"/>
413
+ <NavigationPropertyBinding Path="Contact_Appointments" Target="appointments"/>
414
+ <NavigationPropertyBinding Path="owninguser" Target="systemusers"/>
415
+ <NavigationPropertyBinding Path="Contact_AsyncOperations" Target="asyncoperations"/>
416
+ <NavigationPropertyBinding Path="ownerid" Target="owners"/>
417
+ <NavigationPropertyBinding Path="transactioncurrencyid" Target="transactioncurrencies"/>
418
+ <NavigationPropertyBinding Path="Contact_RecurringAppointmentMasters" Target="recurringappointmentmasters"/>
419
+ <NavigationPropertyBinding Path="Contact_BulkDeleteFailures" Target="bulkdeletefailures"/>
420
+ <NavigationPropertyBinding Path="parentcustomerid_contact" Target="contacts"/>
421
+ <NavigationPropertyBinding Path="contact_customer_contacts" Target="contacts"/>
422
+ <NavigationPropertyBinding Path="contact_connections2" Target="connections"/>
423
+ <NavigationPropertyBinding Path="Contact_DuplicateBaseRecord" Target="duplicaterecords"/>
424
+ <NavigationPropertyBinding Path="modifiedby" Target="systemusers"/>
425
+ <NavigationPropertyBinding Path="Contact_Emails" Target="emails"/>
426
+ <NavigationPropertyBinding Path="Contact_FileAttachment" Target="fileattachments"/>
427
+ <NavigationPropertyBinding Path="contact_activity_parties" Target="activityparties"/>
428
+ <NavigationPropertyBinding Path="Contact_Letters" Target="letters"/>
429
+ </EntitySet>
430
+ </EntityContainer>
431
+ </Schema>
432
+ </edmx:DataServices>
433
+ </edmx:Edmx>
@@ -110,20 +110,21 @@ describe Frodo::Concerns::API do
110
110
  end
111
111
 
112
112
  describe '.create!' do
113
- let(:id) { '(an-id)' }
114
- let(:url) { "blah/#{id}/foo" }
113
+ let(:id) { 'an-id' }
114
+ let(:url) { "blah/(#{id})/foo" }
115
115
  let(:verb) { :post }
116
116
  let(:attributes) { {} }
117
117
  let(:options) { attributes }
118
118
  let(:headers) { { 'odata-entityid' => url } }
119
+ let(:entity_set_name) { 'things' }
119
120
 
120
121
  subject { client.create!(entity_type, attributes) }
121
122
 
122
123
  before do
123
124
  allow(client).to receive(:service).and_return(service)
124
125
  allow(service).to receive(:[]).with(entity_type).and_return(entity_set)
125
- allow(entity_set).to receive(:new_entity).with(attributes).and_return(entity)
126
- allow(client).to receive(:to_url_chunk).with(entity).and_return(path)
126
+ allow(entity_set).to receive(:name).and_return(entity_set_name)
127
+ allow(client).to receive(:entity_set_to_url_chunk).with(entity_set).and_return(path)
127
128
  end
128
129
 
129
130
  it 'posts entity_set info and returns resulting id' do
@@ -133,7 +134,7 @@ describe Frodo::Concerns::API do
133
134
  it 'raises errors that occur' do
134
135
  allow(client).to receive(:service).and_raise(StandardError)
135
136
 
136
- expect{ subject }.to raise_error
137
+ expect{ subject }.to raise_error(StandardError)
137
138
  end
138
139
 
139
140
  context 'alias .insert!' do
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
  require_relative 'entity/shared_examples'
3
3
 
4
- describe Frodo::Entity, vcr: {cassette_name: 'entity_specs'} do
4
+ describe Frodo::Entity, vcr: false do
5
5
  before(:example) do
6
- Frodo::Service.new('http://services.odata.org/V4/OData/OData.svc', name: 'ODataDemo', metadata_file: metadata_file)
6
+ Frodo::Service.new('http://services.odata.org/V4/OData/OData.svc', name: 'ODataDemo', metadata_file: metadata_file)
7
7
  end
8
8
 
9
9
  let(:metadata_file) { 'spec/fixtures/files/metadata.xml' }
@@ -50,6 +50,51 @@ describe Frodo::Entity, vcr: {cassette_name: 'entity_specs'} do
50
50
  it_behaves_like 'a valid product'
51
51
  end
52
52
 
53
+ describe '.with_properties with bind properties' do
54
+ before do
55
+ Frodo::Service.new('http://dynamics.com', name: 'DynamicsTestService', metadata_file: metadata_file)
56
+ end
57
+ let(:metadata_file) { 'spec/fixtures/files/metadata_dynamics.xml' }
58
+ let(:subject) { Frodo::Entity.with_properties(properties, options) }
59
+ let(:properties) { {
60
+ "firstname" => "Christoph",
61
+ "lastname" => "Wagner",
62
+ "ownerid" => "odata.bind@/systemusers(95B9F1A8-3D5A-E911-A956-000D3A3B9CD8)",
63
+ "parentcustomerid_account" => "odata.bind@/accounts(60fb3f1c-b766-e911-a955-000d3a3b9316)",
64
+ } }
65
+ let(:entity_set) {
66
+ Frodo::EntitySet.new(
67
+ container: 'System',
68
+ namespace: 'Microsoft.Dynamics.CRM',
69
+ name: 'contacts',
70
+ type: 'contact',
71
+ service_name: 'DynamicsTestService')
72
+ }
73
+ let(:options) { {
74
+ type: 'Microsoft.Dynamics.CRM.contact',
75
+ namespace: 'Microsoft.Dynamics.CRM',
76
+ service_name: 'DynamicsTestService',
77
+ entity_set: entity_set
78
+ } }
79
+
80
+ it do
81
+ aggregate_failures do
82
+ expect(subject).to be_a(Frodo::Entity)
83
+
84
+ expect(subject.name).to eq(entity_set.type)
85
+ expect(subject.type).to eq(options[:type])
86
+ expect(subject.namespace).to eq(options[:namespace])
87
+ expect(subject.service_name).to eq('DynamicsTestService')
88
+ expect(subject.context).to eq('http://dynamics.com/$metadata#contacts/$entity')
89
+ expect(subject.id).to eq('contacts()')
90
+ expect(subject['firstname']).to eq('Christoph')
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)')
94
+ end
95
+ end
96
+ end
97
+
53
98
  describe '.from_xml' do
54
99
  let(:subject) { Frodo::Entity.from_xml(product_xml, options) }
55
100
  let(:product_xml) {
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.2
4
+ version: 0.10.3
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-04-05 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -320,6 +320,7 @@ files:
320
320
  - spec/fixtures/files/entity_to_xml.xml
321
321
  - spec/fixtures/files/error.xml
322
322
  - spec/fixtures/files/metadata.xml
323
+ - spec/fixtures/files/metadata_dynamics.xml
323
324
  - spec/fixtures/files/metadata_with_error.xml
324
325
  - spec/fixtures/files/product_0.json
325
326
  - spec/fixtures/files/product_0.xml
@@ -413,6 +414,7 @@ test_files:
413
414
  - spec/fixtures/files/entity_to_xml.xml
414
415
  - spec/fixtures/files/error.xml
415
416
  - spec/fixtures/files/metadata.xml
417
+ - spec/fixtures/files/metadata_dynamics.xml
416
418
  - spec/fixtures/files/metadata_with_error.xml
417
419
  - spec/fixtures/files/product_0.json
418
420
  - spec/fixtures/files/product_0.xml