dynamics_crm 0.4.0 → 0.4.1

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: cdf1c64a56314592ae09085cc30e1247305464bd
4
- data.tar.gz: 00888ab3d1d5a161d9d3cd84c47d85cb93292f92
3
+ metadata.gz: b36fe4188ed46fabe0f74049683a5ba9498e1842
4
+ data.tar.gz: 616ab5e8a0d26d6a91b99f7dfeb8033852c80edf
5
5
  SHA512:
6
- metadata.gz: 24296b01888a6fbda086b4859afbaf469e90d8bab700611b9ffe2e0bff6af0dfe9c25f86227f344404ad2d95958b4edc833095a6283b3f0cb8fa2822c04b6135
7
- data.tar.gz: 673a47e6a007d99ca77224402a9c43af449f2fd264629d4ecbfa66c05f5709f99b14b7e042f163cf5e72d3e72d0ef0f133f18ee839fce46b0c1627fe9ef7af78
6
+ metadata.gz: 43a30dd93693e0a8b4fe60ae61046560d0ec2c9ce50e158e297e6000e4e311579518df3f6ff0eddd07a40f2bd85488c72328d0cd12ec36536388f51f2f3a5f11
7
+ data.tar.gz: d3055f511ad34189d3451e9b81f71584e7d3ee4e3be73e577c7d220ff98d4777a18a1416feb7d13430df65946c1ba8b7a04f3d3359b6800b9dc00c2000510270
data/dynamics_crm.gemspec CHANGED
@@ -20,7 +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
+ spec.add_runtime_dependency 'builder', '>= 3.0.0', '< 4.0.0'
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency 'rake', '~> 10.1'
@@ -15,26 +15,27 @@ module DynamicsCRM
15
15
  extend Forwardable
16
16
  include XML::MessageBuilder
17
17
 
18
- # The Login URL and Region are located in the client's Organization WSDL.
19
- # https://tinderboxdev.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0
20
- #
21
- # Login URL: Policy -> Issuer -> Address
22
- # Region: SecureTokenService -> AppliesTo
23
- LOGIN_URL = "https://login.microsoftonline.com/RST2.srf"
24
- REGION = 'urn:crmna:dynamics.com'
25
-
26
18
  attr_accessor :logger, :caller_id
27
19
 
28
20
  # Initializes Client instance.
29
21
  # Requires: organization_name
30
22
  # Optional: hostname
31
- def initialize(config={organization_name: nil, hostname: nil, caller_id: nil})
23
+ def initialize(config={organization_name: nil, hostname: nil, caller_id: nil, login_url: nil, region: nil})
32
24
  raise RuntimeError.new("organization_name is required") if config[:organization_name].nil?
33
25
 
34
26
  @organization_name = config[:organization_name]
35
27
  @hostname = config[:hostname] || "#{@organization_name}.api.crm.dynamics.com"
36
28
  @organization_endpoint = "https://#{@hostname}/XRMServices/2011/Organization.svc"
37
29
  @caller_id = config[:caller_id]
30
+
31
+
32
+ # The Login URL and Region are located in the client's Organization WSDL.
33
+ # https://tinderboxdev.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0
34
+ #
35
+ # Login URL: Policy -> Issuer -> Address
36
+ # Region: SecureTokenService -> AppliesTo
37
+ @login_url = config[:login_url] || 'https://login.microsoftonline.com/RST2.srf'
38
+ @region = config[:region] || 'urn:crmna:dynamics.com'
38
39
  end
39
40
 
40
41
  # Public: Authenticate User
@@ -50,7 +51,7 @@ module DynamicsCRM
50
51
  @username = username
51
52
  @password = password
52
53
 
53
- soap_response = post(LOGIN_URL, build_ocp_request(username, password))
54
+ soap_response = post(@login_url, build_ocp_request(username, password, @login_url, @region))
54
55
 
55
56
  document = REXML::Document.new(soap_response)
56
57
  # Check for Fault
@@ -262,7 +263,7 @@ module DynamicsCRM
262
263
  http.ssl_verify_peer = false
263
264
  http.timeout = 60
264
265
  http.follow_location = true
265
- http.ssl_version = 3
266
+ http.ssl_version = 1
266
267
  # http.verbose = 1
267
268
  end
268
269
 
@@ -1,3 +1,3 @@
1
1
  module DynamicsCRM
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -20,7 +20,7 @@ module DynamicsCRM
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
23
- def build_ocp_request(username, password)
23
+ def build_ocp_request(username, password, login_url, region)
24
24
  %Q{
25
25
  <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
26
26
  xmlns:a="http://www.w3.org/2005/08/addressing"
@@ -31,7 +31,7 @@ module DynamicsCRM
31
31
  <a:ReplyTo>
32
32
  <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
33
33
  </a:ReplyTo>
34
- <a:To s:mustUnderstand="1">#{Client::LOGIN_URL}</a:To>
34
+ <a:To s:mustUnderstand="1">#{login_url}</a:To>
35
35
  <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
36
36
  <u:Timestamp u:Id="_0">
37
37
  <u:Created>#{get_current_time}</u:Created>
@@ -49,7 +49,7 @@ module DynamicsCRM
49
49
  <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
50
50
  <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
51
51
  <a:EndpointReference>
52
- <a:Address>#{Client::REGION}</a:Address>
52
+ <a:Address>#{region}</a:Address>
53
53
  </a:EndpointReference>
54
54
  </wsp:AppliesTo>
55
55
  <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
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.4.0
4
+ version: 0.4.1
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-10-11 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
@@ -54,22 +54,22 @@ dependencies:
54
54
  name: builder
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ~>
58
- - !ruby/object:Gem::Version
59
- version: 3.2.2
60
57
  - - '>='
61
58
  - !ruby/object:Gem::Version
62
- version: 3.2.2
59
+ version: 3.0.0
60
+ - - <
61
+ - !ruby/object:Gem::Version
62
+ version: 4.0.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: 3.2.2
70
67
  - - '>='
71
68
  - !ruby/object:Gem::Version
72
- version: 3.2.2
69
+ version: 3.0.0
70
+ - - <
71
+ - !ruby/object:Gem::Version
72
+ version: 4.0.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: bundler
75
75
  requirement: !ruby/object:Gem::Requirement