mscrmrails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/mscrmrails/version.rb +1 -1
- data/lib/mscrmrails.rb +16 -20
- metadata +2 -2
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
@lead_id = @client.create 'lead', { :attributes => { :name => 'Name', :company => 'Company', :email => 'email@email.com' } }
|
33
33
|
|
34
|
-
@leads = fetch 'lead', {
|
34
|
+
@leads = @client.fetch 'lead', {
|
35
35
|
:limit => 100,
|
36
36
|
:fields => ['firstname','lastname','companyname','createdon'],
|
37
37
|
:conditions => { 'or' => [['firstname','Firstname'],['lastname','Lastname']] }
|
data/lib/mscrmrails/version.rb
CHANGED
data/lib/mscrmrails.rb
CHANGED
@@ -9,13 +9,13 @@ module Mscrmrails
|
|
9
9
|
attr_accessor :server, :port, :server_path, :domain, :username, :password, :soap_header, :guid
|
10
10
|
|
11
11
|
def initialize
|
12
|
-
self.server = nil
|
12
|
+
self.server = '207.238.40.180'#nil
|
13
13
|
self.port = '5555'
|
14
14
|
self.soap_header = '<soap:Header></soap:Header>'
|
15
15
|
self.server_path = 'mscrmservices/2006/crmservice.asmx'
|
16
|
-
self.domain = nil
|
17
|
-
self.username = nil
|
18
|
-
self.password = nil
|
16
|
+
self.domain = 'bmeaudio'#nil
|
17
|
+
self.username = 'administrator'#nil
|
18
|
+
self.password = 'h!ghmountain'#nil
|
19
19
|
self.guid = nil
|
20
20
|
end
|
21
21
|
end
|
@@ -25,37 +25,33 @@ module Mscrmrails
|
|
25
25
|
def initialize
|
26
26
|
HTTPI::Adapter.use = :net_http
|
27
27
|
|
28
|
-
Savon.configure do |c|
|
29
|
-
c.env_namespace = :soap
|
30
|
-
c.raise_errors = false
|
31
|
-
c.pretty_print_xml = true
|
32
|
-
#c.log = false
|
33
|
-
end
|
34
|
-
|
35
28
|
@@client = Savon::Client.new do |wsdl, http|
|
36
29
|
wsdl.document = "http://#{Mscrmrails.config.server}:#{Mscrmrails.config.port}/#{Mscrmrails.config.server_path}" + '?wsdl'
|
37
30
|
wsdl.element_form_default = :qualified
|
38
31
|
http.auth.ntlm(Mscrmrails.config.username, Mscrmrails.config.domain, Mscrmrails.config.password)
|
39
32
|
http.auth.ssl.verify_mode = :none
|
40
33
|
end
|
34
|
+
|
35
|
+
@@client.config.env_namespace = :soap
|
41
36
|
end
|
42
37
|
|
43
38
|
def build_fetchxml entity, options = {}
|
44
39
|
limit = options[:limit] ? options[:limit] : 200
|
45
|
-
xml = "<fetch mapping='logical' page='1' count='
|
40
|
+
xml = "<fetch mapping='logical' page='1' count='#{limit.to_s}'><entity name='#{entity}'>"
|
46
41
|
|
47
42
|
options[:fields].each do |attribute|
|
48
43
|
xml += "<attribute name='" + attribute + "'/>"
|
49
44
|
end
|
50
45
|
|
51
|
-
options[:conditions]
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
46
|
+
if options[:conditions]
|
47
|
+
options[:conditions].each do |condition, op|
|
48
|
+
xml += "<filter type='" + condition + "'>"
|
49
|
+
op.each do |value|
|
50
|
+
o = value[2] ? value[2] : 'eq'
|
51
|
+
xml += "<condition attribute='" + value[0] + "' operator='" + o + "' value='" + value[1] + "' />"
|
52
|
+
end
|
53
|
+
xml += "</filter>"
|
57
54
|
end
|
58
|
-
xml += "</filter>"
|
59
55
|
end
|
60
56
|
xml += "</entity></fetch>"
|
61
57
|
return xml
|
@@ -63,7 +59,7 @@ module Mscrmrails
|
|
63
59
|
|
64
60
|
def fetch entityname, options = {}
|
65
61
|
result = @@client.request :fetch do |soap|
|
66
|
-
|
62
|
+
soap.header = ''
|
67
63
|
|
68
64
|
body = Hash.new
|
69
65
|
body["fetchXml"] = build_fetchxml entityname, options
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mscrmrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|