jiraSOAP 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ module JIRA
2
+
3
+ # Contains all the metadata for a resolution.
4
+ class Resolution < JIRA::IssueProperty
5
+ end
6
+
7
+ # Contains all the metadata for an issue's status.
8
+ class Status < JIRA::IssueProperty
9
+ end
10
+
11
+ # Contains all the metadata for a priority level.
12
+ # @todo change @color to be some kind of hex Fixnum object
13
+ class Priority < JIRA::IssueProperty
14
+
15
+ # @return [String] is a hex value
16
+ attr_accessor :color
17
+
18
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
19
+ def initialize_with_xml_fragment(frag)
20
+ super frag
21
+ @color = (frag/'color').to_s
22
+ end
23
+ end
24
+
25
+ # Contains all the metadata for an issue type.
26
+ class IssueType < JIRA::IssueProperty
27
+
28
+ # @return [boolean]
29
+ attr_accessor :subtask
30
+
31
+ # @return [boolean] true if the issue type is a subtask, otherwise false
32
+ def subtask?; @subtask; end
33
+
34
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
35
+ def initialize_with_xml_fragment(frag)
36
+ super frag
37
+ @subtask = (frag/'subTask').to_boolean
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,57 @@
1
+ module JIRA
2
+
3
+ # Contains the data and metadata about a project and its configuration.
4
+ class Project < JIRA::DescribedEntity
5
+
6
+ # @return [String]
7
+ attr_accessor :key
8
+
9
+ # @return [URL]
10
+ attr_accessor :url
11
+
12
+ # @return [URL]
13
+ attr_accessor :project_url
14
+
15
+ # @return [String]
16
+ attr_accessor :lead
17
+
18
+ # @return [JIRA::IssueSecurityScheme]
19
+ attr_accessor :issue_security_scheme
20
+
21
+ # @return [JIRA::NotificationScheme]
22
+ attr_accessor :notification_scheme
23
+
24
+ # @return [JIRA::PermissionScheme]
25
+ attr_accessor :permission_scheme
26
+
27
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
28
+ def initialize_with_xml_fragment(frag)
29
+ super frag
30
+ @key, @lead,
31
+ @issue_security_scheme, @notification_scheme, @permission_scheme,
32
+ @url, @project_url =
33
+ frag.nodes( ['key', :to_s],
34
+ ['lead', :to_s],
35
+ ['issueSecurityScheme', :to_object, JIRA::IssueSecurityScheme],
36
+ ['notificationScheme', :to_object, JIRA::NotificationScheme],
37
+ ['permissionScheme', :to_object, JIRA::PermissionScheme],
38
+ ['url', :to_url],
39
+ ['projectUrl', :to_url] )
40
+ end
41
+
42
+ # @todo make this method shorter
43
+ # @todo encode the schemes
44
+ # @param [Handsoap::XmlMason::Node] msg
45
+ # @return [Handsoap::XmlMason::Node]
46
+ def soapify_for(msg)
47
+ msg.add 'id', @id
48
+ msg.add 'name', @name
49
+ msg.add 'key', @key
50
+ msg.add 'url', @url
51
+ msg.add 'projectUrl', @project_url
52
+ msg.add 'lead', @lead
53
+ msg.add 'description', @description
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,121 @@
1
+ module JIRA
2
+
3
+ # Only contains basic information about the endpoint server and only used
4
+ # by {RemoteAPI#get_server_info}.
5
+ class ServerInfo < JIRA::Entity
6
+
7
+ # @return [URL]
8
+ attr_reader :base_url
9
+
10
+ # @return [Time]
11
+ attr_reader :build_date
12
+
13
+ # @return [Fixnum]
14
+ attr_reader :build_number
15
+
16
+ # @return [String]
17
+ attr_reader :edition
18
+
19
+ # @return [JIRA::TimeInfo]
20
+ attr_reader :server_time
21
+
22
+ # @return [String]
23
+ attr_reader :version
24
+
25
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
26
+ def initialize_with_xml_fragment(frag)
27
+ @build_date, @build_number, @base_url, @edition, @version, @server_time =
28
+ frag.nodes( ['buildDate', :to_date],
29
+ ['buildNumber', :to_i],
30
+ ['baseUrl', :to_url],
31
+ ['edition', :to_s],
32
+ ['version', :to_s],
33
+ ['serverTime', :to_object, JIRA::TimeInfo] )
34
+ end
35
+ end
36
+
37
+
38
+ # Simple structure for a time and time zone; only used by JIRA::ServerInfo
39
+ # objects, which themselves are only created when {RemoteAPI#get_server_info}
40
+ # is called.
41
+ class TimeInfo < JIRA::Entity
42
+
43
+ # @return [Time]
44
+ attr_reader :server_time
45
+
46
+ # @return [String] in the form of 'America/Toronto'
47
+ attr_reader :timezone
48
+
49
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
50
+ def initialize_with_xml_fragment(frag)
51
+ @server_time, @timezone =
52
+ frag.nodes ['serverTime', :to_string_date], ['timeZoneId', :to_s]
53
+ end
54
+ end
55
+
56
+
57
+ # A simple structure that is used by {RemoteAPI#get_server_configuration}.
58
+ class ServerConfiguration < JIRA::Entity
59
+
60
+ # @return [boolean]
61
+ attr_reader :attachments_allowed
62
+
63
+ # @return [boolean]
64
+ attr_reader :external_user_management_allowed
65
+
66
+ # @return [boolean]
67
+ attr_reader :issue_linking_allowed
68
+
69
+ # @return [boolean]
70
+ attr_reader :subtasks_allowed
71
+
72
+ # @return [boolean]
73
+ attr_reader :time_tracking_allowed
74
+
75
+ # @return [boolean]
76
+ attr_reader :unassigned_issues_allowed
77
+
78
+ # @return [boolean]
79
+ attr_reader :voting_allowed
80
+
81
+ # @return [boolean]
82
+ attr_reader :watching_allowed
83
+
84
+ # @return [Fixnum]
85
+ attr_reader :time_tracking_days_per_week
86
+
87
+ # @return [Fixnum]
88
+ attr_reader :time_tracking_hours_per_day
89
+
90
+ def attachments_allowed?; @attachments_allowed; end
91
+ def external_user_management_allowed?; @external_user_management_allowed; end
92
+ def issue_linking_allowed?; @issue_linking_allowed; end
93
+ def subtasks_allowed?; @subtasks_allowed; end
94
+ def time_tracking_allowed?; @time_tracking_allowed; end
95
+ def unassigned_issues_allowed?; @unassigned_issues_allowed; end
96
+ def voting_allowed?; @voting_allowed; end
97
+ def watching_allowed?; @watching_allowed; end
98
+
99
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
100
+ def initialize_with_xml_fragment(frag)
101
+ @external_user_management_allowed, @attachments_allowed,
102
+ @issue_linking_allowed, @subtasks_allowed,
103
+ @time_tracking_allowed, @unassigned_issues_allowed,
104
+ @voting_allowed, @watching_allowed,
105
+ @time_tracking_days_per_week, @time_tracking_hours_per_day =
106
+ frag.nodes( ['allowExternalUserManagement', :to_boolean],
107
+ ['allowAttachments', :to_boolean],
108
+ ['allowIssueLinking', :to_boolean],
109
+ ['allowSubTasks', :to_boolean],
110
+ ['allowTimeTracking', :to_boolean],
111
+ ['allowUnassignedIssues', :to_boolean],
112
+ ['allowVoting', :to_boolean],
113
+ ['allowWatching', :to_boolean],
114
+ ['timeTrackingDaysPerWeek', :to_i],
115
+ ['timeTrackingHoursPerDay', :to_i] )
116
+ # in case Atlassian still has not fixed their spelling of 'management'
117
+ @external_user_management_allowed ||= (frag/'allowExternalUserManagment').to_boolean
118
+ end
119
+ end
120
+
121
+ end
@@ -0,0 +1,25 @@
1
+ module JIRA
2
+
3
+ # @todo complete this class
4
+ # Includes a mapping of project specific permission settings.
5
+ class PermissionScheme < JIRA::Scheme
6
+
7
+ # @return [nil]
8
+ attr_accessor :permission_mappings
9
+
10
+ # @todo actually parse the permission mapping
11
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
12
+ def initialize_with_xml_fragment(frag)
13
+ super frag
14
+ end
15
+ end
16
+
17
+ # Basic metadata about a project's notification scheme.
18
+ class NotificationScheme < JIRA::Scheme
19
+ end
20
+
21
+ # Basic metadata about a project's issue security scheme.
22
+ class IssueSecurityScheme < JIRA::Scheme
23
+ end
24
+
25
+ end
@@ -0,0 +1,23 @@
1
+ module JIRA
2
+
3
+ # Contains the basic information about a user. The only things missing here
4
+ # are the permissions and login statistics.
5
+ class User < JIRA::Entity
6
+
7
+ # @return [String]
8
+ attr_accessor :username
9
+
10
+ # @return [String]
11
+ attr_accessor :full_name
12
+
13
+ # @return [String]
14
+ attr_accessor :email_address
15
+
16
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
17
+ def initialize_with_xml_fragment(frag)
18
+ @username, @full_name, @email_address =
19
+ frag.nodes ['name', :to_s], ['fullname', :to_s], ['email', :to_s]
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,45 @@
1
+ module JIRA
2
+
3
+ # Represents a version for a project. The description field is never
4
+ # included when you retrieve versions from the server.
5
+ # @todo find out why we don't get a description for this object
6
+ class Version < JIRA::NamedEntity
7
+
8
+ # @return [Fixnum]
9
+ attr_accessor :sequence
10
+
11
+ # @return [boolean]
12
+ attr_accessor :released
13
+
14
+ # @return [boolean]
15
+ attr_accessor :archived
16
+
17
+ # @return [Time]
18
+ attr_accessor :release_date
19
+
20
+ def released?; @released; end
21
+ def archived?; @archived; end
22
+
23
+ # @param [Handsoap::XmlQueryFront::NokogiriDriver] frag
24
+ def initialize_with_xml_fragment(frag)
25
+ super frag
26
+ @sequence, @released, @archived, @release_date =
27
+ frag.nodes( ['sequence', :to_i],
28
+ ['released', :to_boolean],
29
+ ['archived', :to_boolean],
30
+ ['releaseDate', :to_date] )
31
+ end
32
+
33
+ # @todo make this method shorter
34
+ # @param [Handsoap::XmlMason::Node] msg
35
+ # @return [Handsoap::XmlMason::Node]
36
+ def soapify_for(msg)
37
+ msg.add 'name', @name
38
+ msg.add 'archived', @archived unless @archived.nil?
39
+ msg.add 'sequence', @sequence unless @sequence.nil?
40
+ msg.add 'releaseDate', @release_date.xmlschema unless @release_date.nil?
41
+ msg.add 'released', @released unless @released.nil?
42
+ end
43
+ end
44
+
45
+ end
@@ -26,4 +26,72 @@ module XmlMason
26
26
  end
27
27
  end
28
28
  end
29
+
30
+ # Some simple extensions to make initialization of JIRA objects cleaner.
31
+ module XmlQueryFront
32
+ # Represents a node in an XML document used when parsing SOAP responses.
33
+ # This class is extended for use with jiraSOAP.
34
+ class NokogiriDriver
35
+
36
+ # @param [Array] *attributes pairs or triplets, the first element is the
37
+ # attribute you want, the second element is the method to send to the
38
+ # result, and the third element is the argument to that method (if needed)
39
+ # @return [[Objects]]
40
+ def nodes(*attributes)
41
+ attributes.map { |attr|
42
+ self.xpath(attr.shift).send *attr
43
+ }
44
+ end
45
+
46
+ # @return [Time]
47
+ def to_string_date
48
+ temp = self.to_s
49
+ return unless temp
50
+ Time.new temp
51
+ end
52
+
53
+ # @return [URL]
54
+ def to_url
55
+ temp = self.to_s
56
+ return unless temp
57
+ URL.new temp
58
+ end
59
+
60
+ # @return [[String]]
61
+ def to_ss
62
+ self.map { |val| val.to_s }
63
+ end
64
+ end
65
+
66
+ # Simple additions to help expedite parsing XML.
67
+ class NodeSelection
68
+ # @return [URL]
69
+ def to_url
70
+ self.first.to_url if self.any?
71
+ end
72
+
73
+ # @return [Time]
74
+ def to_string_date
75
+ self.first.to_string_date
76
+ end
77
+
78
+ # @return [[String]]
79
+ def to_ss
80
+ self.map { |val| val.to_s }
81
+ end
82
+
83
+ # @param [Class] klass the object you want an array of
84
+ # @return [Array] an array of klass objects
85
+ def to_objects(klass)
86
+ self.map { |frag| klass.new_with_xml_fragment frag }
87
+ end
88
+
89
+ # @param [Class] klass the object you want to make
90
+ # @return [Object] an instance of klass
91
+ def to_object(klass)
92
+ klass.new_with_xml_fragment self.first if self.any?
93
+ end
94
+ end
95
+ end
96
+
29
97
  end
@@ -10,7 +10,7 @@ class URL
10
10
  end
11
11
  end
12
12
 
13
+ # @todo get a parallel map method for collections
13
14
  module JIRA
14
- #overrides for MacRuby
15
15
 
16
16
  end
data/lib/jiraSOAP/url.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # A bit of a hack to support using an NSURL in MacRuby while still supporting
2
2
  # MRI by using the URI module.
3
3
  #
4
- # I suggest not thinking about it too much beyond this point: this is a
5
- # URI object if you are running on CRuby, but it will be an NSURL if you
6
- # are running on MacRuby.
4
+ # For any JIRA entity that has a URL object as an instance variable, you can
5
+ # stick what ever type of object you want in the instance varible, as long as
6
+ # the object has a #to_s method that returns a properly formatted URI.
7
7
  class URL
8
8
  # @return [NSURL, URI::HTTP] the type depends on your RUBY_ENGINE
9
9
  attr_accessor :url
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
7
+ - 5
8
8
  - 0
9
- version: 0.4.0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Rada
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-10 00:00:00 -05:00
17
+ date: 2010-11-16 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -40,8 +40,10 @@ dependencies:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  segments:
43
- - 0
44
- version: "0"
43
+ - 1
44
+ - 4
45
+ - 4
46
+ version: 1.4.4
45
47
  type: :runtime
46
48
  version_requirements: *id002
47
49
  - !ruby/object:Gem::Dependency
@@ -77,16 +79,31 @@ executables: []
77
79
  extensions: []
78
80
 
79
81
  extra_rdoc_files:
82
+ - ChangeLog
80
83
  - LICENSE
81
84
  - README.markdown
82
85
  files:
83
86
  - lib/jiraSOAP.rb
84
87
  - lib/jiraSOAP/JIRAservice.rb
88
+ - lib/jiraSOAP/api.rb
89
+ - lib/jiraSOAP/entities.rb
90
+ - lib/jiraSOAP/entities/abstract.rb
91
+ - lib/jiraSOAP/entities/attachments.rb
92
+ - lib/jiraSOAP/entities/avatar.rb
93
+ - lib/jiraSOAP/entities/comment.rb
94
+ - lib/jiraSOAP/entities/field_value.rb
95
+ - lib/jiraSOAP/entities/filter.rb
96
+ - lib/jiraSOAP/entities/issue.rb
97
+ - lib/jiraSOAP/entities/issue_properties.rb
98
+ - lib/jiraSOAP/entities/project.rb
99
+ - lib/jiraSOAP/entities/read_only.rb
100
+ - lib/jiraSOAP/entities/schemes.rb
101
+ - lib/jiraSOAP/entities/user.rb
102
+ - lib/jiraSOAP/entities/version.rb
85
103
  - lib/jiraSOAP/handsoap_extensions.rb
86
- - lib/jiraSOAP/remoteAPI.rb
87
- - lib/jiraSOAP/remoteEntities.rb
104
+ - lib/jiraSOAP/macruby_bonuses.rb
88
105
  - lib/jiraSOAP/url.rb
89
- - lib/macruby_stuff.rb
106
+ - ChangeLog
90
107
  - LICENSE
91
108
  - README.markdown
92
109
  - test/jiraSOAP_test.rb
@@ -96,8 +113,8 @@ homepage: http://github.com/ferrous26/jiraSOAP
96
113
  licenses: []
97
114
 
98
115
  post_install_message:
99
- rdoc_options:
100
- - --charset=UTF-8
116
+ rdoc_options: []
117
+
101
118
  require_paths:
102
119
  - lib
103
120
  required_ruby_version: !ruby/object:Gem::Requirement