xplanner 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/config/attr_accessor_dirty_bit.rb +14 -0
- data/lib/config/version.rb +2 -2
- data/lib/helpers/xplanner_model_helper.rb +10 -5
- data/lib/helpers/xplanner_soap_client.rb +0 -1
- data/lib/models/iteration.rb +20 -17
- data/lib/models/person.rb +10 -7
- data/lib/models/project.rb +7 -4
- data/lib/models/story.rb +6 -3
- data/lib/models/task.rb +6 -3
- data/test/tests.rb +2 -2
- metadata +11 -10
@@ -0,0 +1,14 @@
|
|
1
|
+
module AttrAccessorWithDirtyBit
|
2
|
+
def dirty_accessor( *names )
|
3
|
+
attr_reader *names
|
4
|
+
|
5
|
+
names.each do |name|
|
6
|
+
define_method :"#{name}=" do |v|
|
7
|
+
if instance_variable_get(:"@#{name}") != v
|
8
|
+
@dirty_bit = true
|
9
|
+
instance_variable_set(:"@#{name}", v)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/config/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module XPlanner
|
2
|
-
VERSION = '0.0.
|
3
|
-
end
|
2
|
+
VERSION = '0.0.6'
|
3
|
+
end
|
@@ -26,15 +26,20 @@ module XPlanner
|
|
26
26
|
results
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.
|
29
|
+
def self.remote_delete( rpc, payload )
|
30
30
|
invalid_usage unless @@soap_client
|
31
31
|
@@soap_client.call( rpc, payload ).success?
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def remote_update( rpc, payload )
|
35
35
|
invalid_usage unless @@soap_client
|
36
|
-
|
37
|
-
|
36
|
+
if @dirty_bit
|
37
|
+
result = @@soap_client.call( rpc, payload )
|
38
|
+
@dirty_bit = false if( result.success? )
|
39
|
+
return result.success?
|
40
|
+
else
|
41
|
+
return true
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
def self.parse_date( date )
|
@@ -49,7 +54,7 @@ module XPlanner
|
|
49
54
|
end
|
50
55
|
|
51
56
|
def create_payload
|
52
|
-
payload = hashify.delete_if { |key, value|
|
57
|
+
payload = hashify.delete_if { |key, value| [:last_update_time, :dirty_bit].include? key }
|
53
58
|
end
|
54
59
|
|
55
60
|
end
|
data/lib/models/iteration.rb
CHANGED
@@ -1,26 +1,29 @@
|
|
1
1
|
module XPlanner
|
2
2
|
class Iteration < ModelHelper
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
extend AttrAccessorWithDirtyBit
|
4
|
+
dirty_accessor :name,
|
5
|
+
:description,
|
6
|
+
:project_id,
|
7
|
+
:status_key,
|
8
|
+
:actual_hours,
|
9
|
+
:added_hours,
|
10
|
+
:adjusted_estimated_hours,
|
11
|
+
:days_worked,
|
12
|
+
:estimated_hours,
|
13
|
+
:overestimated_hours,
|
14
|
+
:postponed_hours,
|
15
|
+
:remaining_hours,
|
16
|
+
:start_date,
|
17
|
+
:end_date,
|
18
|
+
:underestimated_hours
|
18
19
|
|
19
20
|
attr_reader :id,
|
20
21
|
:last_update_time
|
21
22
|
|
22
23
|
|
23
24
|
def initialize( iter )
|
25
|
+
@dirty_bit = false
|
26
|
+
|
24
27
|
@id = iter[:id]
|
25
28
|
@name = iter[:name]
|
26
29
|
@description = iter[:description]
|
@@ -74,7 +77,7 @@ module XPlanner
|
|
74
77
|
def self.delete( id )
|
75
78
|
rpc = :remove_iteration
|
76
79
|
payload = { :id => id }
|
77
|
-
|
80
|
+
remote_delete( rpc, payload )
|
78
81
|
end
|
79
82
|
|
80
83
|
def delete
|
@@ -84,7 +87,7 @@ module XPlanner
|
|
84
87
|
def save
|
85
88
|
rpc = :update
|
86
89
|
payload = { :iterationData => create_payload }
|
87
|
-
|
90
|
+
remote_update( rpc, payload )
|
88
91
|
end
|
89
92
|
|
90
93
|
end
|
data/lib/models/person.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
module XPlanner
|
2
2
|
class Person < ModelHelper
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
extend AttrAccessorWithDirtyBit
|
4
|
+
dirty_accessor :name,
|
5
|
+
:email,
|
6
|
+
:initials,
|
7
|
+
:phone,
|
8
|
+
:user_id
|
8
9
|
|
9
10
|
attr_reader :id,
|
10
11
|
:last_update_time
|
11
12
|
|
12
13
|
def initialize( p )
|
14
|
+
@dirty_bit = false
|
15
|
+
|
13
16
|
@id = p[:id]
|
14
17
|
@name = p[:name]
|
15
18
|
@last_update_time = Person.parse_date p[:last_update_time]
|
@@ -48,7 +51,7 @@ module XPlanner
|
|
48
51
|
def self.delete( id )
|
49
52
|
rpc = :remove_person
|
50
53
|
payload = { :id => id }
|
51
|
-
|
54
|
+
remote_delete( rpc, payload )
|
52
55
|
end
|
53
56
|
|
54
57
|
def delete
|
@@ -58,7 +61,7 @@ module XPlanner
|
|
58
61
|
def save
|
59
62
|
rpc = :update
|
60
63
|
payload = { :personData => create_payload }
|
61
|
-
|
64
|
+
remote_update( rpc, payload )
|
62
65
|
end
|
63
66
|
end
|
64
67
|
end
|
data/lib/models/project.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module XPlanner
|
2
2
|
class Project < ModelHelper
|
3
|
-
|
4
|
-
|
3
|
+
extend AttrAccessorWithDirtyBit
|
4
|
+
dirty_accessor :name,
|
5
|
+
:description
|
5
6
|
|
6
7
|
attr_reader :id,
|
7
8
|
:last_update_time
|
8
9
|
|
9
10
|
def initialize( p )
|
11
|
+
@dirty_bit = false
|
12
|
+
|
10
13
|
@id = p[:id]
|
11
14
|
@name = p[:name]
|
12
15
|
@last_update_time = Project.parse_date p[:last_update_time]
|
@@ -36,7 +39,7 @@ module XPlanner
|
|
36
39
|
def self.delete( id )
|
37
40
|
rpc = :remove_project
|
38
41
|
payload = { :id => id }
|
39
|
-
|
42
|
+
remote_delete( rpc, payload )
|
40
43
|
end
|
41
44
|
|
42
45
|
def delete
|
@@ -46,7 +49,7 @@ module XPlanner
|
|
46
49
|
def save
|
47
50
|
rpc = :update
|
48
51
|
payload = { :projectData => create_payload }
|
49
|
-
|
52
|
+
remote_update( rpc, payload )
|
50
53
|
end
|
51
54
|
|
52
55
|
def link
|
data/lib/models/story.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module XPlanner
|
2
2
|
class Story < ModelHelper
|
3
|
+
extend AttrAccessorWithDirtyBit
|
3
4
|
|
4
|
-
|
5
|
+
dirty_accessor :actual_hours,
|
5
6
|
:adjusted_estimated_hours,
|
6
7
|
:completed,
|
7
8
|
:customer_id,
|
@@ -21,6 +22,8 @@ module XPlanner
|
|
21
22
|
|
22
23
|
|
23
24
|
def initialize( story )
|
25
|
+
@dirty_bit = false
|
26
|
+
|
24
27
|
@actual_hours = story[:actual_hours]
|
25
28
|
@adjusted_estimated_hours = story[:adjusted_estimated_hours]
|
26
29
|
@completed = story[:completed]
|
@@ -71,7 +74,7 @@ module XPlanner
|
|
71
74
|
def self.delete( id )
|
72
75
|
rpc = :remove_user_story
|
73
76
|
payload = { :id => id }
|
74
|
-
|
77
|
+
remote_delete( rpc, payload )
|
75
78
|
end
|
76
79
|
|
77
80
|
def delete
|
@@ -81,7 +84,7 @@ module XPlanner
|
|
81
84
|
def save
|
82
85
|
rpc = :update
|
83
86
|
payload = { :userStoryData => create_payload }
|
84
|
-
|
87
|
+
remote_update( rpc, payload )
|
85
88
|
end
|
86
89
|
|
87
90
|
end
|
data/lib/models/task.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module XPlanner
|
2
2
|
class Task < ModelHelper
|
3
|
+
extend AttrAccessorWithDirtyBit
|
3
4
|
|
4
|
-
|
5
|
+
dirty_accessor :acceptor_id,
|
5
6
|
:actual_hours,
|
6
7
|
:adjusted_estimated_hours,
|
7
8
|
:completed,
|
@@ -20,6 +21,8 @@ module XPlanner
|
|
20
21
|
|
21
22
|
|
22
23
|
def initialize( task )
|
24
|
+
@dirty_bit = false
|
25
|
+
|
23
26
|
@acceptor_id = task[:acceptor_id]
|
24
27
|
@actual_hours = task[:actual_hours]
|
25
28
|
@adjusted_estimated_hours = task[:adjusted_estimated_hours]
|
@@ -70,7 +73,7 @@ module XPlanner
|
|
70
73
|
def self.delete( id )
|
71
74
|
rpc = :remove_task
|
72
75
|
payload = { :id => id }
|
73
|
-
|
76
|
+
remote_delete( rpc, payload )
|
74
77
|
end
|
75
78
|
|
76
79
|
def delete
|
@@ -80,7 +83,7 @@ module XPlanner
|
|
80
83
|
def save
|
81
84
|
rpc = :update
|
82
85
|
payload = { :taskData => create_payload }
|
83
|
-
|
86
|
+
remote_update( rpc, payload )
|
84
87
|
end
|
85
88
|
|
86
89
|
end
|
data/test/tests.rb
CHANGED
@@ -20,11 +20,11 @@ describe 'XPlanner+ SOAP interface' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'Update' do
|
23
|
-
@myProject.description
|
23
|
+
@myProject.description= ' O_o '
|
24
24
|
result = @myProject.save
|
25
25
|
result.should equal true
|
26
26
|
this_project = XPlanner::Project.retrieve( @myProject.id )
|
27
|
-
this_project.description.should
|
27
|
+
this_project.description.should eq ' O_o '
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'creates link tot he project on XPlanner' 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.0.
|
4
|
+
version: 0.0.6
|
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-22 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: &2168985100 !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: *2168985100
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: nokogiri
|
28
|
-
requirement: &
|
28
|
+
requirement: &2168984600 !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: *2168984600
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: activesupport
|
39
|
-
requirement: &
|
39
|
+
requirement: &2168984140 !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: *2168984140
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec
|
50
|
-
requirement: &
|
50
|
+
requirement: &2168983760 !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: *2168983760
|
59
59
|
description: Ruby wrapper for XPlanner+ SOAP interface
|
60
60
|
email:
|
61
61
|
- whoojemaflip@gmail.com
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- Gemfile
|
68
68
|
- LICENSE.txt
|
69
69
|
- README.md
|
70
|
+
- lib/config/attr_accessor_dirty_bit.rb
|
70
71
|
- lib/config/default_config.rb
|
71
72
|
- lib/config/savon_config.rb
|
72
73
|
- lib/config/version.rb
|