xplanner 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,6 @@ require 'active_support/inflections'
7
7
  Savon.configure do |config|
8
8
  config.log = false
9
9
  config.log_level = :errors
10
- config.raise_errors = false # we'll handle our own errors
11
10
  end
12
11
  HTTPI.log = false
13
12
 
@@ -1,3 +1,3 @@
1
1
  module XPlanner
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -19,13 +19,21 @@ module XPlanner
19
19
  @@base_url
20
20
  end
21
21
 
22
- def self.invalid_usage
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
- invalid_usage unless @@soap_client
28
- h = @@soap_client.call( rpc, payload ).decode_soap_response( path )
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
- invalid_usage unless @@soap_client
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
- invalid_usage unless @@soap_client
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
- response = @client.request( rpc ) do
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
@@ -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 )
@@ -24,6 +24,7 @@ module XPlanner
24
24
  soap_client = SoapClient.new( client_config )
25
25
  ModelHelper.soap_client= soap_client
26
26
  @@connection_successful = soap_client.confirm_connection
27
+
27
28
  ModelHelper.base_url= url
28
29
  end
29
30
 
@@ -162,11 +162,11 @@ describe 'XPlanner+ SOAP interface' do
162
162
  end
163
163
 
164
164
  it 'Update' do
165
- @myTask.description += ' O_o '
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.description.should include ' O_o '
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.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-23 00:00:00.000000000 +00:00
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: &2153784300 !ruby/object:Gem::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: *2153784300
25
+ version_requirements: *2152262460
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: nokogiri
28
- requirement: &2153783800 !ruby/object:Gem::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: *2153783800
36
+ version_requirements: *2152261960
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activesupport
39
- requirement: &2153783340 !ruby/object:Gem::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: *2153783340
47
+ version_requirements: *2152261500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &2153782960 !ruby/object:Gem::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: *2153782960
58
+ version_requirements: *2152261120
59
59
  description: Ruby wrapper for XPlanner+ SOAP interface
60
60
  email:
61
61
  - whoojemaflip@gmail.com