dynamics_crm 0.1.2 → 0.2.0

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: 9bb94f5a5bd351991b2e929c9c9f6dbb94bf22c8
4
- data.tar.gz: 949b48ff2ae0b40e9ae7d65f9e897f644e0a4f2a
3
+ metadata.gz: ed0c1801ab9a78dba2eb01192f0806fdbf9bc4ab
4
+ data.tar.gz: 9bb310620e6a7fbdc950487a3a7cb1a57c3e2a9f
5
5
  SHA512:
6
- metadata.gz: a230f285eee9f1a272badc7fe6f9b8ad369f891d2a1ad13207ecf3b16d39c9ee9579458e1debf3bbd2032df6d1072a5aea4ae191a9884e5bc9f2a55ce758cefd
7
- data.tar.gz: 92c07774595e74b0b3ad88116fc67e659ecc6cef8602d1554d49676db59932aea325436dfafb30bc6ebe6da4998726fbaaa5019a0228269e271cb06a6c7922ef
6
+ metadata.gz: 83a6d261729864fd043f39ea3fb33c18c6c73d058d8672612e67b6a170de701184d1a957e04d229bec7c694f98b2f6abf8f9eff64bebc1dd515eb50df04fe221
7
+ data.tar.gz: a690903d49cdab46e248569539acc3a47afa9ce275e991b1b10039014bd3b70e764f973206c6be4f3ace790a230c00224013560a7ba6e3d4eec2673cb95ced99
data/README.md CHANGED
@@ -38,10 +38,10 @@ client.retrieve('account', '53291AAB-4A9A-E311-B097-6C3BE5A8DD60')
38
38
  ### retrieve_multiple
39
39
 
40
40
  ```ruby
41
- client.retrieve_multiple('account', ["name", "Equal", "Test Account"])
41
+ client.retrieve_multiple('account', [["name", "Equal", "Test Account"]])
42
42
  # => [#<DynamicsCRM::XML::Entity ... >]
43
43
 
44
- client.retrieve_multiple('account', ["name", "Equal", "Test Account"], ["Name, "CreatedBy"])
44
+ client.retrieve_multiple('account', [["name", "Equal", "Test Account"], ["Name, "CreatedBy"]])
45
45
  # => [#<DynamicsCRM::XML::Entity ... >]
46
46
  ```
47
47
 
@@ -52,6 +52,10 @@ client.retrieve_multiple('account', ["name", "Equal", "Test Account"], ["Name, "
52
52
  # Add a new account
53
53
  client.create('account', name: 'Foobar Inc.')
54
54
  # => {id: '53291AAB-4A9A-E311-B097-6C3BE5A8DD60'}
55
+
56
+ # Add a new contact
57
+ client.create('contact', firstname: 'John', lastname: 'Doe', emailaddress1: "johndoe@mydomain.com")
58
+ # => {id: '71ef2416-50f7-e311-93fc-6c3be5a8c054'}
55
59
  ```
56
60
 
57
61
  ### update
@@ -94,6 +98,20 @@ client.retrieve_attribute('account', 'name')
94
98
  # => [#<DynamicsCRM::Metadata::AttributeMetadata>, ...]
95
99
  ```
96
100
 
101
+ ### associate a contact to an account
102
+
103
+ ```ruby
104
+ contacts = [ DynamicsCRM::XML::EntityReference.new("contact", contact["id"])]
105
+ client.associate("account", account["id"], "contact_customer_accounts", contacts)
106
+ ```
107
+
108
+ ## Logging
109
+
110
+ If you want to log the REQUEST and RESPONSE, you can do through [Logger](http://www.ruby-doc.org/stdlib-2.1.2/libdoc/logger/rdoc/Logger.html) class of Ruby.
111
+
112
+ ```ruby
113
+ client.logger = Logger.new(STDOUT)
114
+ ```
97
115
 
98
116
  ## Contributing
99
117
 
@@ -1,11 +1,14 @@
1
1
  # SOAP Only Walk through
2
2
  # http://code.msdn.microsoft.com/CRM-Online-2011-WebServices-14913a16
3
3
  #
4
- # PHP starting point:
4
+ # PHP starting point:
5
5
  # http://crmtroubleshoot.blogspot.com.au/2013/07/dynamics-crm-2011-php-and-soap-using.html
6
- #
6
+ #
7
7
  # OCP: Open Commerce Platform
8
8
  # https://community.dynamics.com/crm/b/crmgirishraja/archive/2012/09/04/authentication-with-dynamics-crm-online-on-ocp-office-365.aspx
9
+
10
+ require 'forwardable'
11
+
9
12
  module DynamicsCRM
10
13
 
11
14
  class Client
@@ -14,7 +17,7 @@ module DynamicsCRM
14
17
 
15
18
  # The Login URL and Region are located in the client's Organization WSDL.
16
19
  # https://tinderboxdev.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0
17
- #
20
+ #
18
21
  # Login URL: Policy -> Issuer -> Address
19
22
  # Region: SecureTokenService -> AppliesTo
20
23
  LOGIN_URL = "https://login.microsoftonline.com/RST2.srf"
@@ -124,7 +127,7 @@ module DynamicsCRM
124
127
  request = update_request(entity)
125
128
  xml_response = post(@organization_endpoint, request)
126
129
  return Response::UpdateResponse.new(xml_response)
127
- end
130
+ end
128
131
 
129
132
  def delete(entity_name, guid)
130
133
  request = delete_request(entity_name, guid)
@@ -276,10 +279,10 @@ module DynamicsCRM
276
279
  def log_xml(title, xml)
277
280
  return unless logger
278
281
 
279
- logger.puts(title)
282
+ logger.debug(title)
280
283
  doc = REXML::Document.new(xml)
281
284
  formatter.write(doc.root, logger)
282
- logger.puts
285
+ logger.debug
283
286
  end
284
287
 
285
288
  def formatter
@@ -292,4 +295,4 @@ module DynamicsCRM
292
295
 
293
296
  end
294
297
 
295
- end
298
+ end
@@ -1,3 +1,3 @@
1
1
  module DynamicsCRM
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/dynamics_crm.rb CHANGED
@@ -33,6 +33,8 @@ require 'base64'
33
33
  require "rexml/document"
34
34
  require 'mimemagic'
35
35
  require 'curl'
36
+ require 'securerandom'
37
+ require 'date'
36
38
 
37
39
  module DynamicsCRM
38
40
 
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.2
4
+ version: 0.2.0
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-06-18 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb