dynamics_crm 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +19 -0
- data/dynamics_crm.gemspec +1 -0
- data/lib/dynamics_crm/client.rb +1 -0
- data/lib/dynamics_crm/fetch_xml/builder.rb +101 -0
- data/lib/dynamics_crm/fetch_xml/entity.rb +34 -0
- data/lib/dynamics_crm/fetch_xml/link_entity.rb +28 -0
- data/lib/dynamics_crm/response/retrieve_multiple_result.rb +1 -9
- data/lib/dynamics_crm/version.rb +1 -1
- data/lib/dynamics_crm/xml/entity_collection.rb +43 -0
- data/lib/dynamics_crm/xml/fetch_expression.rb +1 -1
- data/lib/dynamics_crm/xml/message_parser.rb +1 -5
- data/lib/dynamics_crm.rb +20 -1
- data/spec/lib/client_spec.rb +18 -4
- data/spec/lib/fetch_xml/builder_spec.rb +107 -0
- metadata +27 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdf1c64a56314592ae09085cc30e1247305464bd
|
4
|
+
data.tar.gz: 00888ab3d1d5a161d9d3cd84c47d85cb93292f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24296b01888a6fbda086b4859afbaf469e90d8bab700611b9ffe2e0bff6af0dfe9c25f86227f344404ad2d95958b4edc833095a6283b3f0cb8fa2822c04b6135
|
7
|
+
data.tar.gz: 673a47e6a007d99ca77224402a9c43af449f2fd264629d4ecbfa66c05f5709f99b14b7e042f163cf5e72d3e72d0ef0f133f18ee839fce46b0c1627fe9ef7af78
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.4.0 (October 11, 2014)
|
2
|
+
|
3
|
+
* Adds FetchXml module (Builder, Entity, LinkEntity) for building Xml document. (New dependency on builder)
|
4
|
+
* Merge PR #15 - Adds EntityCollection object used by Client#fetch response.
|
5
|
+
|
1
6
|
## 0.3.0 (October 11, 2014)
|
2
7
|
|
3
8
|
* Merge PR #12 - Adds support for Entity FormattedValues
|
data/README.md
CHANGED
@@ -45,6 +45,25 @@ client.retrieve_multiple('account', [["name", "Equal", "Test Account"], ["Name,
|
|
45
45
|
# => [#<DynamicsCRM::XML::Entity ... >]
|
46
46
|
```
|
47
47
|
|
48
|
+
### fetch (FetchXml)
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
xml = %Q{<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
52
|
+
<entity name="opportunityproduct">
|
53
|
+
<attribute name="opportunityproductid" />
|
54
|
+
<attribute name="productid" />
|
55
|
+
<attribute name="productdescription" />
|
56
|
+
<attribute name="priceperunit" />
|
57
|
+
<attribute name="quantity" />
|
58
|
+
<order attribute="productid" descending="false" />
|
59
|
+
</entity>
|
60
|
+
</fetch>}
|
61
|
+
|
62
|
+
result = client.fetch(xml)
|
63
|
+
# => #<DynamicsCRM::XML::EntityCollection>
|
64
|
+
# result.entity_name => 'opportunityproduct'
|
65
|
+
# result.entities => [DynamicsCRM::XML::Entity, ...]
|
66
|
+
```
|
48
67
|
|
49
68
|
### create
|
50
69
|
|
data/dynamics_crm.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'curb', '~> 0.8', '>= 0.8.5'
|
22
22
|
spec.add_runtime_dependency 'mimemagic', '~> 0.2', '>= 0.2.1'
|
23
|
+
spec.add_runtime_dependency 'builder', '~> 3.2.2', '>= 3.2.2'
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
26
|
spec.add_development_dependency 'rake', '~> 10.1'
|
data/lib/dynamics_crm/client.rb
CHANGED
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'builder'
|
2
|
+
|
3
|
+
# <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
4
|
+
# <entity name="opportunityproduct">
|
5
|
+
# <attribute name="productid" />
|
6
|
+
# <attribute name="productdescription" />
|
7
|
+
# <attribute name="priceperunit" />
|
8
|
+
# <attribute name="quantity" />
|
9
|
+
# <attribute name="extendedamount" />
|
10
|
+
# <attribute name="opportunityproductid" />
|
11
|
+
# <order attribute="productid" descending="false" />
|
12
|
+
# <link-entity name="product" from="productid" to="productid" alias="product">
|
13
|
+
# <attribute name="name" />
|
14
|
+
# <attribute name="producttypecode" />
|
15
|
+
# <attribute name="price" />
|
16
|
+
# <attribute name="standardcost" />
|
17
|
+
# <attribute name="currentcost" />
|
18
|
+
# </link-entity>
|
19
|
+
# <link-entity name="opportunity" from="opportunityid" to="opportunityid" alias="opportunity">
|
20
|
+
# <filter type="and">
|
21
|
+
# <condition attribute="opportunityid" operator="eq" value="02dd7344-d04a-e411-a9d3-9cb654950300" />
|
22
|
+
# </filter>
|
23
|
+
# </link-entity>
|
24
|
+
# </entity>
|
25
|
+
# </fetch>
|
26
|
+
module DynamicsCRM
|
27
|
+
module FetchXml
|
28
|
+
|
29
|
+
class Builder
|
30
|
+
attr_accessor :version, :output_format, :mapping, :distinct
|
31
|
+
|
32
|
+
def initialize(options={})
|
33
|
+
@builder = ::Builder::XmlMarkup.new(:indent=>2)
|
34
|
+
@entities = []
|
35
|
+
@link_entities = []
|
36
|
+
|
37
|
+
@version = options[:version] || '1.0'
|
38
|
+
@output_format = options[:output_format] || 'xml-platform'
|
39
|
+
@mapping = options[:mapping] || 'logical'
|
40
|
+
@distinct = options[:distinct] || false
|
41
|
+
end
|
42
|
+
|
43
|
+
def entity(logical_name)
|
44
|
+
@entities << Entity.new(logical_name)
|
45
|
+
@entities.last
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_xml
|
49
|
+
# <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
50
|
+
@builder.fetch(version: @version, :"output-format" => @output_format, mapping: @mapping, distinct: @distinct) {
|
51
|
+
@entities.each do |e|
|
52
|
+
# <entity name="opportunityproduct">
|
53
|
+
@builder.entity(name: e.logical_name) {
|
54
|
+
e.attributes.each do |field|
|
55
|
+
# <attribute name="productid" />
|
56
|
+
@builder.attribute(name: field)
|
57
|
+
end
|
58
|
+
|
59
|
+
if e.order_field
|
60
|
+
@builder.order(attribute: e.order_field, descending: e.order_desc)
|
61
|
+
end
|
62
|
+
|
63
|
+
add_link_entities(e)
|
64
|
+
|
65
|
+
# </entity>
|
66
|
+
}
|
67
|
+
end
|
68
|
+
}
|
69
|
+
@builder.target!
|
70
|
+
end
|
71
|
+
|
72
|
+
protected
|
73
|
+
|
74
|
+
def add_link_entities(e)
|
75
|
+
e.link_entities.each do |le|
|
76
|
+
# <link-entity name="product" from="productid" to="productid" alias="product">
|
77
|
+
@builder.tag!('link-entity', name: le.logical_name, from: le.from, to: le.to, :alias => le.alias) {
|
78
|
+
le.attributes.each do |field|
|
79
|
+
# <attribute name="name" />
|
80
|
+
@builder.attribute(name: field)
|
81
|
+
end
|
82
|
+
if le.has_conditions?
|
83
|
+
# <filter type="and">
|
84
|
+
@builder.filter(type: 'and') {
|
85
|
+
le.conditions.each do |c|
|
86
|
+
# <condition attribute="opportunityid" operator="eq" value="02dd7344-d04a-e411-a9d3-9cb654950300" />
|
87
|
+
@builder.condition(attribute: c[:attribute], operator: c[:operator], value: c[:value])
|
88
|
+
end
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Support nested link-entity elements. Recursive.
|
93
|
+
add_link_entities(le)
|
94
|
+
}
|
95
|
+
# </link-entity>
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module DynamicsCRM
|
2
|
+
module FetchXml
|
3
|
+
class Entity
|
4
|
+
attr_reader :logical_name, :attributes
|
5
|
+
attr_reader :order_field, :order_desc
|
6
|
+
attr_reader :link_entities
|
7
|
+
|
8
|
+
def initialize(logical_name, options={})
|
9
|
+
# options used by LinkEntity subclass
|
10
|
+
@logical_name = logical_name
|
11
|
+
@attributes = []
|
12
|
+
@link_entities = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_attributes(field_names=nil)
|
16
|
+
@attributes = field_names
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
# <order attribute="productid" descending="false" />
|
21
|
+
def order(field_name, descending=false)
|
22
|
+
@order_field = field_name
|
23
|
+
@order_desc = descending
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def link_entity(logical_name, attributes={})
|
28
|
+
@link_entities << LinkEntity.new(logical_name, attributes)
|
29
|
+
@link_entities.last
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module DynamicsCRM
|
2
|
+
module FetchXml
|
3
|
+
class LinkEntity < FetchXml::Entity
|
4
|
+
attr_accessor :from, :to, :alias, :conditions
|
5
|
+
|
6
|
+
def initialize(logical_name, options={})
|
7
|
+
super
|
8
|
+
@from = options[:from]|| "#{logical_name}id"
|
9
|
+
@to = options[:to] || "#{logical_name}id"
|
10
|
+
@alias = options[:alias] || logical_name
|
11
|
+
@conditions = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_condition(attribute, operator, value)
|
15
|
+
@conditions << {
|
16
|
+
attribute: attribute,
|
17
|
+
operator: operator,
|
18
|
+
value: value
|
19
|
+
}
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def has_conditions?
|
24
|
+
@conditions.any?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -13,15 +13,7 @@ module DynamicsCRM
|
|
13
13
|
next if el.name == "Entities"
|
14
14
|
|
15
15
|
# Convert text to actual data types.
|
16
|
-
|
17
|
-
if value == "true" || value == "false"
|
18
|
-
value = (value == "true")
|
19
|
-
elsif value =~ /^[-?]\d+$/
|
20
|
-
value = value.to_i
|
21
|
-
elsif value =~ /^[-?]\d+\.\d+$/
|
22
|
-
value = value.to_f
|
23
|
-
end
|
24
|
-
h[el.name] = value
|
16
|
+
h[el.name] = ::DynamicsCRM::StringUtil.valueOf(el.text)
|
25
17
|
end
|
26
18
|
|
27
19
|
h[:entities] = []
|
data/lib/dynamics_crm/version.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
module DynamicsCRM
|
2
|
+
module XML
|
3
|
+
|
4
|
+
class EntityCollection
|
5
|
+
|
6
|
+
attr_accessor :entity_name, :min_active_row_version, :more_records, :paging_cookie,
|
7
|
+
:total_record_count, :total_record_count_limit_exceeded, :entities
|
8
|
+
|
9
|
+
def initialize(xml_document)
|
10
|
+
@entities = []
|
11
|
+
|
12
|
+
if xml_document
|
13
|
+
xml_document.each_element do |node|
|
14
|
+
attr_name = ::DynamicsCRM::StringUtil.underscore(node.name).to_sym
|
15
|
+
if node.name == "Entities"
|
16
|
+
node.elements.each do |entity_xml|
|
17
|
+
@entities << XML::Entity.from_xml(entity_xml)
|
18
|
+
end
|
19
|
+
elsif self.respond_to?(attr_name)
|
20
|
+
value = node.text ? ::DynamicsCRM::StringUtil.valueOf(node.text.strip) : nil
|
21
|
+
self.send("#{attr_name}=", value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_hash
|
29
|
+
{
|
30
|
+
:entity_name => entity_name,
|
31
|
+
:min_active_row_version => min_active_row_version,
|
32
|
+
:more_records => more_records,
|
33
|
+
:paging_cookie => paging_cookie,
|
34
|
+
:total_record_count => total_record_count,
|
35
|
+
:total_record_count_limit_exceeded => total_record_count_limit_exceeded,
|
36
|
+
:entities => entities
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
# EntityCollection
|
42
|
+
end
|
43
|
+
end
|
@@ -34,11 +34,7 @@ module DynamicsCRM
|
|
34
34
|
end
|
35
35
|
value = entity_ref
|
36
36
|
when "b:EntityCollection"
|
37
|
-
|
38
|
-
value_element.elements["b:Entities"].elements.each do |entity_xml|
|
39
|
-
collection << XML::Entity.from_xml(entity_xml)
|
40
|
-
end
|
41
|
-
value = collection
|
37
|
+
value = XML::EntityCollection.new(value_element)
|
42
38
|
when "d:EntityMetadata", /^d:\w*AttributeMetadata$/
|
43
39
|
value = value_element
|
44
40
|
when "d:ArrayOfEntityMetadata"
|
data/lib/dynamics_crm.rb
CHANGED
@@ -10,6 +10,7 @@ require "dynamics_crm/xml/query"
|
|
10
10
|
require "dynamics_crm/xml/fetch_expression"
|
11
11
|
require "dynamics_crm/xml/entity"
|
12
12
|
require "dynamics_crm/xml/entity_reference"
|
13
|
+
require "dynamics_crm/xml/entity_collection"
|
13
14
|
require "dynamics_crm/response/result"
|
14
15
|
require "dynamics_crm/response/retrieve_result"
|
15
16
|
require "dynamics_crm/response/retrieve_multiple_result"
|
@@ -25,6 +26,10 @@ require "dynamics_crm/metadata/retrieve_attribute_response"
|
|
25
26
|
# Model
|
26
27
|
require "dynamics_crm/model/entity"
|
27
28
|
require "dynamics_crm/model/opportunity"
|
29
|
+
# Fetch XML
|
30
|
+
require "dynamics_crm/fetch_xml/entity"
|
31
|
+
require 'dynamics_crm/fetch_xml/link_entity'
|
32
|
+
require "dynamics_crm/fetch_xml/builder"
|
28
33
|
# Client
|
29
34
|
require "dynamics_crm/client"
|
30
35
|
|
@@ -36,7 +41,7 @@ require 'curl'
|
|
36
41
|
require 'securerandom'
|
37
42
|
require 'date'
|
38
43
|
|
39
|
-
module DynamicsCRM
|
44
|
+
module DynamicsCRM
|
40
45
|
|
41
46
|
class StringUtil
|
42
47
|
def self.underscore(str)
|
@@ -46,6 +51,20 @@ module DynamicsCRM
|
|
46
51
|
tr("-", "_").
|
47
52
|
downcase
|
48
53
|
end
|
54
|
+
|
55
|
+
def self.valueOf(text)
|
56
|
+
# Convert text to actual data types.
|
57
|
+
value = text
|
58
|
+
if value == "true" || value == "false"
|
59
|
+
value = (value == "true")
|
60
|
+
elsif value =~ /^[-?]\d+$/
|
61
|
+
value = value.to_i
|
62
|
+
elsif value =~ /^[-?]\d+\.\d+$/
|
63
|
+
value = value.to_f
|
64
|
+
else
|
65
|
+
value
|
66
|
+
end
|
67
|
+
end
|
49
68
|
end
|
50
69
|
|
51
70
|
end
|
data/spec/lib/client_spec.rb
CHANGED
@@ -70,6 +70,14 @@ describe DynamicsCRM::Client do
|
|
70
70
|
result = subject.retrieve_multiple("account", ["name", "Equal", "Test Account"], columns=[])
|
71
71
|
|
72
72
|
result.should be_a(DynamicsCRM::Response::RetrieveMultipleResult)
|
73
|
+
|
74
|
+
expect(result['EntityName']).to eq('account')
|
75
|
+
expect(result['MinActiveRowVersion']).to eq(-1)
|
76
|
+
expect(result['MoreRecords']).to eq(false)
|
77
|
+
expect(result['PagingCookie']).not_to be_empty
|
78
|
+
expect(result['TotalRecordCount']).to eq(-1)
|
79
|
+
expect(result['TotalRecordCountLimitExceeded']).to eq(false)
|
80
|
+
|
73
81
|
result.entities.size.should == 3
|
74
82
|
entities = result.entities
|
75
83
|
|
@@ -112,13 +120,19 @@ describe DynamicsCRM::Client do
|
|
112
120
|
</fetch>
|
113
121
|
}
|
114
122
|
|
115
|
-
|
123
|
+
entity_collection = subject.fetch(xml)
|
124
|
+
entity_collection.should be_a(DynamicsCRM::XML::EntityCollection)
|
116
125
|
|
117
|
-
|
126
|
+
expect(entity_collection.entity_name).to eq('new_tinderboxdocument')
|
127
|
+
expect(entity_collection.min_active_row_version).to eq(-1)
|
128
|
+
expect(entity_collection.more_records).to eq(false)
|
129
|
+
expect(entity_collection.paging_cookie).not_to be_empty
|
130
|
+
expect(entity_collection.total_record_count).to eq(-1)
|
131
|
+
expect(entity_collection.total_record_count_limit_exceeded).to eq(false)
|
118
132
|
|
119
|
-
|
133
|
+
expect(entity_collection.entities.size).to eq(3)
|
120
134
|
|
121
|
-
entity =
|
135
|
+
entity = entity_collection.entities.first
|
122
136
|
entity.id.should == "9c27cf91-ada3-e311-b64f-6c3be5a87df0"
|
123
137
|
entity.logical_name.should == "new_tinderboxdocument"
|
124
138
|
entity.attributes["new_tinderboxdocumentid"].should == entity.id
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DynamicsCRM::FetchXml::Builder do
|
4
|
+
|
5
|
+
describe 'xml' do
|
6
|
+
let(:opportunity_product_fields) {
|
7
|
+
['productid', 'productdescription', 'priceperunit', 'quantity', 'extendedamount', 'opportunityproductid']
|
8
|
+
}
|
9
|
+
let(:product_fields) {
|
10
|
+
['name', 'producttypecode', 'price', 'standardcost', 'currentcost']
|
11
|
+
}
|
12
|
+
|
13
|
+
context "entity" do
|
14
|
+
it "builds a single entity" do
|
15
|
+
subject.entity('opportunityproduct').add_attributes(opportunity_product_fields)
|
16
|
+
expect(subject.to_xml).to eq %Q{<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
17
|
+
<entity name="opportunityproduct">
|
18
|
+
<attribute name="productid"/>
|
19
|
+
<attribute name="productdescription"/>
|
20
|
+
<attribute name="priceperunit"/>
|
21
|
+
<attribute name="quantity"/>
|
22
|
+
<attribute name="extendedamount"/>
|
23
|
+
<attribute name="opportunityproductid"/>
|
24
|
+
</entity>
|
25
|
+
</fetch>
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
it "builds a single entity with order" do
|
30
|
+
subject.entity('opportunityproduct').add_attributes(opportunity_product_fields).order('productid')
|
31
|
+
expect(subject.to_xml).to eq %Q{<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
32
|
+
<entity name="opportunityproduct">
|
33
|
+
<attribute name="productid"/>
|
34
|
+
<attribute name="productdescription"/>
|
35
|
+
<attribute name="priceperunit"/>
|
36
|
+
<attribute name="quantity"/>
|
37
|
+
<attribute name="extendedamount"/>
|
38
|
+
<attribute name="opportunityproductid"/>
|
39
|
+
<order attribute="productid" descending="false"/>
|
40
|
+
</entity>
|
41
|
+
</fetch>
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
context "link_entity" do
|
48
|
+
it "builds entity with link_entity" do
|
49
|
+
entity = subject.entity('opportunityproduct').add_attributes(opportunity_product_fields).order('productid')
|
50
|
+
entity.link_entity('product', to: 'productid', from: 'productid', :alias => 'prod').add_attributes(product_fields)
|
51
|
+
expect(subject.to_xml).to eq %Q{<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
52
|
+
<entity name="opportunityproduct">
|
53
|
+
<attribute name="productid"/>
|
54
|
+
<attribute name="productdescription"/>
|
55
|
+
<attribute name="priceperunit"/>
|
56
|
+
<attribute name="quantity"/>
|
57
|
+
<attribute name="extendedamount"/>
|
58
|
+
<attribute name="opportunityproductid"/>
|
59
|
+
<order attribute="productid" descending="false"/>
|
60
|
+
<link-entity name="product" from="productid" to="productid" alias="prod">
|
61
|
+
<attribute name="name"/>
|
62
|
+
<attribute name="producttypecode"/>
|
63
|
+
<attribute name="price"/>
|
64
|
+
<attribute name="standardcost"/>
|
65
|
+
<attribute name="currentcost"/>
|
66
|
+
</link-entity>
|
67
|
+
</entity>
|
68
|
+
</fetch>
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "link_entity condition" do
|
74
|
+
it "builds entity with two link_entity and condition" do
|
75
|
+
entity = subject.entity('opportunityproduct').add_attributes(opportunity_product_fields).order('productid')
|
76
|
+
entity.link_entity('product', to: 'productid', from: 'productid', :alias => 'prod').add_attributes(product_fields)
|
77
|
+
entity.link_entity('opportunity', :alias => 'oppty').
|
78
|
+
add_condition('opportunityid', 'eq', '02dd7344-d04a-e411-a9d3-9cb654950300')
|
79
|
+
expect(subject.to_xml).to eq %Q{<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
|
80
|
+
<entity name="opportunityproduct">
|
81
|
+
<attribute name="productid"/>
|
82
|
+
<attribute name="productdescription"/>
|
83
|
+
<attribute name="priceperunit"/>
|
84
|
+
<attribute name="quantity"/>
|
85
|
+
<attribute name="extendedamount"/>
|
86
|
+
<attribute name="opportunityproductid"/>
|
87
|
+
<order attribute="productid" descending="false"/>
|
88
|
+
<link-entity name="product" from="productid" to="productid" alias="prod">
|
89
|
+
<attribute name="name"/>
|
90
|
+
<attribute name="producttypecode"/>
|
91
|
+
<attribute name="price"/>
|
92
|
+
<attribute name="standardcost"/>
|
93
|
+
<attribute name="currentcost"/>
|
94
|
+
</link-entity>
|
95
|
+
<link-entity name="opportunity" from="opportunityid" to="opportunityid" alias="oppty">
|
96
|
+
<filter type="and">
|
97
|
+
<condition attribute="opportunityid" operator="eq" value="02dd7344-d04a-e411-a9d3-9cb654950300"/>
|
98
|
+
</filter>
|
99
|
+
</link-entity>
|
100
|
+
</entity>
|
101
|
+
</fetch>
|
102
|
+
}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamics_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Heth
|
@@ -50,6 +50,26 @@ dependencies:
|
|
50
50
|
- - '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.2.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: builder
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 3.2.2
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.2.2
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.2.2
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 3.2.2
|
53
73
|
- !ruby/object:Gem::Dependency
|
54
74
|
name: bundler
|
55
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,6 +144,9 @@ files:
|
|
124
144
|
- dynamics_crm.gemspec
|
125
145
|
- lib/dynamics_crm.rb
|
126
146
|
- lib/dynamics_crm/client.rb
|
147
|
+
- lib/dynamics_crm/fetch_xml/builder.rb
|
148
|
+
- lib/dynamics_crm/fetch_xml/entity.rb
|
149
|
+
- lib/dynamics_crm/fetch_xml/link_entity.rb
|
127
150
|
- lib/dynamics_crm/metadata/attribute_metadata.rb
|
128
151
|
- lib/dynamics_crm/metadata/entity_metadata.rb
|
129
152
|
- lib/dynamics_crm/metadata/retrieve_all_entities_response.rb
|
@@ -142,6 +165,7 @@ files:
|
|
142
165
|
- lib/dynamics_crm/xml/column_set.rb
|
143
166
|
- lib/dynamics_crm/xml/criteria.rb
|
144
167
|
- lib/dynamics_crm/xml/entity.rb
|
168
|
+
- lib/dynamics_crm/xml/entity_collection.rb
|
145
169
|
- lib/dynamics_crm/xml/entity_reference.rb
|
146
170
|
- lib/dynamics_crm/xml/fault.rb
|
147
171
|
- lib/dynamics_crm/xml/fetch_expression.rb
|
@@ -170,6 +194,7 @@ files:
|
|
170
194
|
- spec/fixtures/who_am_i_result.xml
|
171
195
|
- spec/fixtures/win_opportunity_response.xml
|
172
196
|
- spec/lib/client_spec.rb
|
197
|
+
- spec/lib/fetch_xml/builder_spec.rb
|
173
198
|
- spec/lib/metadata/entity_metadata_spec.rb
|
174
199
|
- spec/lib/metadata/retrieve_all_entities_response_spec.rb
|
175
200
|
- spec/lib/metadata/retrieve_attribute_response_spec.rb
|
@@ -232,6 +257,7 @@ test_files:
|
|
232
257
|
- spec/fixtures/who_am_i_result.xml
|
233
258
|
- spec/fixtures/win_opportunity_response.xml
|
234
259
|
- spec/lib/client_spec.rb
|
260
|
+
- spec/lib/fetch_xml/builder_spec.rb
|
235
261
|
- spec/lib/metadata/entity_metadata_spec.rb
|
236
262
|
- spec/lib/metadata/retrieve_all_entities_response_spec.rb
|
237
263
|
- spec/lib/metadata/retrieve_attribute_response_spec.rb
|