xplanner 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/config/savon_config.rb +0 -1
- data/lib/config/version.rb +1 -1
- data/lib/helpers/xplanner_model_helper.rb +15 -6
- data/lib/helpers/xplanner_soap_client.rb +4 -2
- data/lib/models/person.rb +3 -1
- data/lib/xplanner.rb +1 -0
- data/test/tests.rb +2 -2
- metadata +10 -10
data/lib/config/savon_config.rb
CHANGED
data/lib/config/version.rb
CHANGED
@@ -19,13 +19,21 @@ module XPlanner
|
|
19
19
|
@@base_url
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.
|
23
|
-
raise 'No SoapClient initialised'
|
22
|
+
def self.check_client_initialised
|
23
|
+
raise 'No SoapClient initialised' unless XPlanner.connection?
|
24
|
+
end
|
25
|
+
|
26
|
+
def check_client_initialised
|
27
|
+
raise 'No SoapClient initialised' unless XPlanner.connection?
|
24
28
|
end
|
25
29
|
|
26
30
|
def self.fetch_from_remote( rpc, payload, path, my_class )
|
27
|
-
|
28
|
-
|
31
|
+
check_client_initialised
|
32
|
+
|
33
|
+
r = @@soap_client.call( rpc, payload )
|
34
|
+
return nil if r.nil?
|
35
|
+
h = r.decode_soap_response( path )
|
36
|
+
|
29
37
|
if h.class == Array
|
30
38
|
results = h.collect { |thing| my_class.new( thing ) }
|
31
39
|
elsif h.class == Hash
|
@@ -35,16 +43,17 @@ module XPlanner
|
|
35
43
|
results = nil
|
36
44
|
end
|
37
45
|
end
|
46
|
+
|
38
47
|
results
|
39
48
|
end
|
40
49
|
|
41
50
|
def self.remote_delete( rpc, payload )
|
42
|
-
|
51
|
+
check_client_initialised
|
43
52
|
@@soap_client.call( rpc, payload ).success?
|
44
53
|
end
|
45
54
|
|
46
55
|
def remote_update( rpc, payload )
|
47
|
-
|
56
|
+
check_client_initialised
|
48
57
|
if @dirty_bit
|
49
58
|
result = @@soap_client.call( rpc, payload )
|
50
59
|
@dirty_bit = false if( result.success? )
|
@@ -16,8 +16,10 @@ module XPlanner
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call( rpc, payload=nil)
|
19
|
-
|
20
|
-
soap.body = payload unless payload.nil?
|
19
|
+
begin
|
20
|
+
return @client.request( rpc ) { soap.body = payload unless payload.nil? }
|
21
|
+
rescue Exception => error
|
22
|
+
puts error.to_s
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
data/lib/models/person.rb
CHANGED
@@ -25,7 +25,9 @@ module XPlanner
|
|
25
25
|
def self.all
|
26
26
|
rpc = :get_people
|
27
27
|
path = [:get_people_response, :get_people_return, :get_people_return]
|
28
|
-
fetch_from_remote( rpc, {}, path, Person )
|
28
|
+
p = fetch_from_remote( rpc, {}, path, Person )
|
29
|
+
p = [p] if p.class == Person
|
30
|
+
p
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.retrieve( id )
|
data/lib/xplanner.rb
CHANGED
data/test/tests.rb
CHANGED
@@ -162,11 +162,11 @@ describe 'XPlanner+ SOAP interface' do
|
|
162
162
|
end
|
163
163
|
|
164
164
|
it 'Update' do
|
165
|
-
@myTask.
|
165
|
+
@myTask.disposition_name = 'carriedOver'
|
166
166
|
result = @myTask.save
|
167
167
|
result.should equal true
|
168
168
|
this_task = XPlanner::Task.retrieve( @myTask.id )
|
169
|
-
this_task.
|
169
|
+
this_task.disposition_name.should eq 'carriedOver'
|
170
170
|
end
|
171
171
|
|
172
172
|
it 'Delete' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xplanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-28 00:00:00.000000000 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: savon
|
17
|
-
requirement: &
|
17
|
+
requirement: &2152262460 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2152262460
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: nokogiri
|
28
|
-
requirement: &
|
28
|
+
requirement: &2152261960 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.5.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2152261960
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: activesupport
|
39
|
-
requirement: &
|
39
|
+
requirement: &2152261500 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 3.2.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2152261500
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec
|
50
|
-
requirement: &
|
50
|
+
requirement: &2152261120 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2152261120
|
59
59
|
description: Ruby wrapper for XPlanner+ SOAP interface
|
60
60
|
email:
|
61
61
|
- whoojemaflip@gmail.com
|