dynamics_crm 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +12 -0
- data/README.md +2 -2
- data/dynamics_crm.gemspec +0 -1
- data/lib/dynamics_crm/version.rb +1 -1
- data/lib/dynamics_crm/xml/entity_reference.rb +3 -2
- data/lib/dynamics_crm/xml/message_builder.rb +3 -3
- data/spec/lib/client_spec.rb +49 -0
- data/spec/lib/xml/entity_reference_spec.rb +15 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDU2ZGVlMzE2YzAwNzk4YmMzZDA1ZWQ1OGYxMWJlNmIxZDg4Nzc3Ng==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9bb94f5a5bd351991b2e929c9c9f6dbb94bf22c8
|
4
|
+
data.tar.gz: 949b48ff2ae0b40e9ae7d65f9e897f644e0a4f2a
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NGJkZDFkYTljZjUwNzVmZGQxMTdjYTE2YmUzNDBhMDE3N2RiZTY0ZWUzNzcx
|
11
|
-
NTIzYTg2YmIzNjJmZDJiZDYxMzhiZGUxNjZkZGQ2NTcyMTQxN2U=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MzEwYTk0ZmY4OGRlYjBiODIwZGExNDJkOTI3ODRiNWM0YjQ5YzUxYWVhZDQ4
|
14
|
-
NmQ0ZjY3NjVmY2Y0OTljYWQ0N2ZiYWM2MmYwY2E4Mzg4MGVjMzUyOGUzNzhi
|
15
|
-
NzgxYTk4ZWFkZmEyOGJmMjhjYmRiYjRjNTg2YjZjM2UwNjRhODI=
|
6
|
+
metadata.gz: a230f285eee9f1a272badc7fe6f9b8ad369f891d2a1ad13207ecf3b16d39c9ee9579458e1debf3bbd2032df6d1072a5aea4ae191a9884e5bc9f2a55ce758cefd
|
7
|
+
data.tar.gz: 92c07774595e74b0b3ad88116fc67e659ecc6cef8602d1554d49676db59932aea325436dfafb30bc6ebe6da4998726fbaaa5019a0228269e271cb06a6c7922ef
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
#### Username/Password authentication
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
client = DynamicsCRM::Client.new
|
27
|
+
client = DynamicsCRM::Client.new({organization_name: "orgname"})
|
28
28
|
client.authenticate('user@orgname.onmicrosoft.com', 'password')
|
29
29
|
```
|
30
30
|
|
@@ -50,7 +50,7 @@ client.retrieve_multiple('account', ["name", "Equal", "Test Account"], ["Name, "
|
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
# Add a new account
|
53
|
-
client.create('
|
53
|
+
client.create('account', name: 'Foobar Inc.')
|
54
54
|
# => {id: '53291AAB-4A9A-E311-B097-6C3BE5A8DD60'}
|
55
55
|
```
|
56
56
|
|
data/dynamics_crm.gemspec
CHANGED
@@ -20,7 +20,6 @@ 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 'nokogiri', '~> 1.5', '>= 1.5.10'
|
24
23
|
|
25
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
25
|
spec.add_development_dependency 'rake', '~> 10.1'
|
data/lib/dynamics_crm/version.rb
CHANGED
@@ -18,10 +18,11 @@ module DynamicsCRM
|
|
18
18
|
<#{namespace}LogicalName>#{@logical_name}</#{namespace}LogicalName>
|
19
19
|
<#{namespace}Name #{@name ? '' : 'nil="true"'}>#{@name}</#{namespace}Name>
|
20
20
|
}
|
21
|
-
|
21
|
+
# Associate/Disassociate request requires CamelCase while others require lowerCase
|
22
|
+
tag_name = options[:camel_case] ? "EntityReference" : "entityReference"
|
22
23
|
if options[:exclude_root].nil?
|
23
24
|
xml = %Q{
|
24
|
-
<#{namespace}
|
25
|
+
<#{namespace}#{tag_name}>#{xml}</#{namespace}#{tag_name}>
|
25
26
|
}
|
26
27
|
end
|
27
28
|
return xml
|
@@ -16,7 +16,7 @@ module DynamicsCRM
|
|
16
16
|
|
17
17
|
# Select the right region for your CRM
|
18
18
|
# The region can be pulled from the Organization WSDL
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# urn:crmna:dynamics.com - North America
|
21
21
|
# urn:crmemea:dynamics.com - Europe, the Middle East and Africa
|
22
22
|
# urn:crmapac:dynamics.com - Asia Pacific
|
@@ -179,7 +179,7 @@ module DynamicsCRM
|
|
179
179
|
def modify_association(action, entity_name, id, relationship, relationship_entities=[])
|
180
180
|
entities_xml = ""
|
181
181
|
relationship_entities.each do |ref|
|
182
|
-
entities_xml << ref.to_xml(namespace: "b")
|
182
|
+
entities_xml << ref.to_xml(namespace: "b", camel_case: true)
|
183
183
|
end
|
184
184
|
|
185
185
|
build_envelope(action) do
|
@@ -187,7 +187,7 @@ module DynamicsCRM
|
|
187
187
|
<entityName i:type="string">#{entity_name}</entityName>
|
188
188
|
<entityId xmlns:q10="http://schemas.microsoft.com/2003/10/Serialization/" i:type="q10:guid">#{id}</entityId>
|
189
189
|
<relationship i:type="b:Relationship">
|
190
|
-
<b:PrimaryEntityRole
|
190
|
+
<b:PrimaryEntityRole i:nil="true" />
|
191
191
|
<b:SchemaName i:type="string">#{relationship}</b:SchemaName>
|
192
192
|
</relationship>
|
193
193
|
<relatedEntities i:type="b:EntityReferenceCollection">#{entities_xml}</relatedEntities>
|
data/spec/lib/client_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
2
3
|
|
3
4
|
describe DynamicsCRM::Client do
|
4
5
|
let(:subject) { DynamicsCRM::Client.new(organization_name: "tinderboxdev")}
|
@@ -67,6 +68,15 @@ describe DynamicsCRM::Client do
|
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
71
|
+
describe "#retrieve_attachments" do
|
72
|
+
it "retrieves document records from annotation object" do
|
73
|
+
subject.stub(:post).and_return(fixture("retrieve_multiple_result"))
|
74
|
+
|
75
|
+
result = subject.retrieve_attachments("93f0325c-a592-e311-b7f3-6c3be5a8a0c8")
|
76
|
+
result.should be_a(DynamicsCRM::Response::RetrieveMultipleResult)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
70
80
|
describe "#fetch" do
|
71
81
|
it "uses FetchXML to retrieve multiple" do
|
72
82
|
|
@@ -116,6 +126,33 @@ describe DynamicsCRM::Client do
|
|
116
126
|
end
|
117
127
|
end
|
118
128
|
|
129
|
+
describe "#create_attachment" do
|
130
|
+
it "creates new record in annotation entity" do
|
131
|
+
|
132
|
+
file = Tempfile.new(["sample-file", "pdf"])
|
133
|
+
|
134
|
+
subject.should_receive(:create).with("annotation", {
|
135
|
+
objectid: {id: "f4944f99-b5a0-e311-b64f-6c3be5a87df0", logical_name: "opportunity"},
|
136
|
+
subject: "Sample Subject",
|
137
|
+
notetext: "Post message",
|
138
|
+
filename: "testfile.pdf",
|
139
|
+
isdocument: true,
|
140
|
+
documentbody: ::Base64.encode64(""),
|
141
|
+
filesize: 0,
|
142
|
+
mimetype: nil
|
143
|
+
})
|
144
|
+
|
145
|
+
options = {
|
146
|
+
filename: "testfile.pdf",
|
147
|
+
document: file,
|
148
|
+
subject: "Sample Subject",
|
149
|
+
text: "Post message"
|
150
|
+
}
|
151
|
+
|
152
|
+
result = subject.create_attachment("opportunity", "f4944f99-b5a0-e311-b64f-6c3be5a87df0", options)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
119
156
|
describe "#update" do
|
120
157
|
it "updates entity by id" do
|
121
158
|
|
@@ -227,4 +264,16 @@ describe DynamicsCRM::Client do
|
|
227
264
|
end
|
228
265
|
end
|
229
266
|
|
267
|
+
describe "#load_entity" do
|
268
|
+
it "returns Model::Opportunity" do
|
269
|
+
response = subject.load_entity("opportunity", "c4944f99-b5a0-e311-b64f-6c3be5a87df0")
|
270
|
+
response.should be_a(DynamicsCRM::Model::Opportunity)
|
271
|
+
end
|
272
|
+
|
273
|
+
it "returns Model::Entity" do
|
274
|
+
response = subject.load_entity("account", "c4944f99-b5a0-e311-b64f-6c3be5a87df0")
|
275
|
+
response.should be_a(DynamicsCRM::Model::Entity)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
230
279
|
end
|
@@ -14,7 +14,7 @@ describe DynamicsCRM::XML::EntityReference do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
context "#to_xml" do
|
17
|
-
it
|
17
|
+
it "outputs entityReference with no namespace" do
|
18
18
|
# Spacing here is intentional to match created string.
|
19
19
|
expected_xml = %Q{
|
20
20
|
<entityReference>
|
@@ -24,7 +24,20 @@ describe DynamicsCRM::XML::EntityReference do
|
|
24
24
|
</entityReference>
|
25
25
|
}
|
26
26
|
subject.to_xml.should == expected_xml
|
27
|
-
|
27
|
+
end
|
28
|
+
|
29
|
+
it "outputs EntityReference with namespace" do
|
30
|
+
# Spacing here is intentional to match created string.
|
31
|
+
expected_xml = %Q{
|
32
|
+
<b:EntityReference>
|
33
|
+
<b:Id>9BF1325C-A592-E311-B7F3-6C3BE5A8A0C8</b:Id>
|
34
|
+
<b:LogicalName>opportunity</b:LogicalName>
|
35
|
+
<b:Name #{@name ? '' : 'nil="true"'}>#{@name}</b:Name>
|
36
|
+
</b:EntityReference>
|
37
|
+
}
|
38
|
+
subject.to_xml(namespace: 'b', camel_case: true).should == expected_xml
|
39
|
+
end
|
40
|
+
|
28
41
|
end
|
29
42
|
|
30
43
|
context "#from_xml" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamics_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Heth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.8'
|
20
|
-
- -
|
20
|
+
- - '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.8.5
|
23
23
|
type: :runtime
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.8'
|
30
|
-
- -
|
30
|
+
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.8.5
|
33
33
|
- !ruby/object:Gem::Dependency
|
@@ -37,7 +37,7 @@ dependencies:
|
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0.2'
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.2.1
|
43
43
|
type: :runtime
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0.2'
|
50
|
-
- -
|
50
|
+
- - '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.2.1
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- .gitignore
|
117
117
|
- .rspec
|
118
118
|
- .travis.yml
|
119
|
+
- CHANGELOG.md
|
119
120
|
- Gemfile
|
120
121
|
- LICENSE.txt
|
121
122
|
- README.md
|
@@ -195,17 +196,17 @@ require_paths:
|
|
195
196
|
- lib
|
196
197
|
required_ruby_version: !ruby/object:Gem::Requirement
|
197
198
|
requirements:
|
198
|
-
- -
|
199
|
+
- - '>='
|
199
200
|
- !ruby/object:Gem::Version
|
200
201
|
version: '0'
|
201
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
203
|
requirements:
|
203
|
-
- -
|
204
|
+
- - '>='
|
204
205
|
- !ruby/object:Gem::Version
|
205
206
|
version: '0'
|
206
207
|
requirements: []
|
207
208
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.2.
|
209
|
+
rubygems_version: 2.2.1
|
209
210
|
signing_key:
|
210
211
|
specification_version: 4
|
211
212
|
summary: Ruby gem for integrating with MS Dynamics 2011/2013 SOAP API
|