jiraSOAP 0.6.1 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.yardopts +10 -0
  2. data/ChangeLog +18 -0
  3. data/{LICENSE → LICENSE.txt} +0 -0
  4. data/README.markdown +4 -6
  5. data/lib/jiraSOAP.rb +0 -2
  6. data/lib/jiraSOAP/JIRAservice.rb +5 -5
  7. data/lib/jiraSOAP/api.rb +77 -696
  8. data/lib/jiraSOAP/api/additions.rb +22 -0
  9. data/lib/jiraSOAP/api/attachments.rb +33 -0
  10. data/lib/jiraSOAP/api/avatars.rb +64 -0
  11. data/lib/jiraSOAP/api/comments.rb +33 -0
  12. data/lib/jiraSOAP/api/filters.rb +20 -0
  13. data/lib/jiraSOAP/api/issue_data_types.rb +51 -0
  14. data/lib/jiraSOAP/api/issues.rb +102 -0
  15. data/lib/jiraSOAP/api/project_roles.rb +49 -0
  16. data/lib/jiraSOAP/api/projects.rb +67 -0
  17. data/lib/jiraSOAP/api/schemes.rb +17 -0
  18. data/lib/jiraSOAP/api/server_info.rb +18 -0
  19. data/lib/jiraSOAP/api/users.rb +35 -0
  20. data/lib/jiraSOAP/api/versions.rb +50 -0
  21. data/lib/jiraSOAP/entities.rb +5 -1
  22. data/lib/jiraSOAP/entities/attachment_metadata.rb +9 -22
  23. data/lib/jiraSOAP/entities/avatar.rb +10 -23
  24. data/lib/jiraSOAP/entities/comment.rb +12 -31
  25. data/lib/jiraSOAP/entities/component.rb +1 -1
  26. data/lib/jiraSOAP/entities/custom_field_value.rb +5 -11
  27. data/lib/jiraSOAP/entities/described_entity.rb +4 -4
  28. data/lib/jiraSOAP/entities/dynamic_entity.rb +5 -5
  29. data/lib/jiraSOAP/entities/entity.rb +28 -13
  30. data/lib/jiraSOAP/entities/field.rb +1 -1
  31. data/lib/jiraSOAP/entities/filter.rb +5 -14
  32. data/lib/jiraSOAP/entities/issue.rb +29 -88
  33. data/lib/jiraSOAP/entities/issue_property.rb +4 -4
  34. data/lib/jiraSOAP/entities/issue_security_scheme.rb +1 -1
  35. data/lib/jiraSOAP/entities/issue_type.rb +4 -5
  36. data/lib/jiraSOAP/entities/named_entity.rb +4 -4
  37. data/lib/jiraSOAP/entities/notification_scheme.rb +1 -1
  38. data/lib/jiraSOAP/entities/permission.rb +7 -10
  39. data/lib/jiraSOAP/entities/permission_mapping.rb +5 -10
  40. data/lib/jiraSOAP/entities/permission_scheme.rb +3 -4
  41. data/lib/jiraSOAP/entities/priority.rb +4 -3
  42. data/lib/jiraSOAP/entities/project.rb +9 -30
  43. data/lib/jiraSOAP/entities/project_role.rb +1 -1
  44. data/lib/jiraSOAP/entities/resolution.rb +1 -1
  45. data/lib/jiraSOAP/entities/scheme.rb +1 -1
  46. data/lib/jiraSOAP/entities/server_configuration.rb +14 -53
  47. data/lib/jiraSOAP/entities/server_info.rb +8 -26
  48. data/lib/jiraSOAP/entities/status.rb +1 -1
  49. data/lib/jiraSOAP/entities/time_info.rb +5 -10
  50. data/lib/jiraSOAP/entities/user.rb +5 -15
  51. data/lib/jiraSOAP/entities/username.rb +4 -0
  52. data/lib/jiraSOAP/entities/version.rb +6 -20
  53. data/lib/jiraSOAP/handsoap_extensions.rb +4 -2
  54. data/lib/jiraSOAP/macruby_bonuses.rb +12 -5
  55. data/lib/jiraSOAP/url.rb +13 -24
  56. data/yard-jiraSOAP.rb +65 -0
  57. metadata +52 -92
  58. data/lib/jiraSOAP/api/convenience.rb +0 -12
  59. data/lib/jiraSOAP/entities/remote_entity.rb +0 -7
@@ -2,8 +2,8 @@
2
2
  # have an icon to go with them to help identify properties of issues more
3
3
  # quickly.
4
4
  class JIRA::IssueProperty < JIRA::DescribedEntity
5
- add_attributes({ 'icon' => [:icon=, :to_url] })
6
-
7
- # @return [URL] NSURL on MacRuby and a URI::HTTP object on CRuby
8
- attr_accessor :icon
5
+ add_attributes(
6
+ # NSURL on MacRuby and a URI::HTTP object on CRuby
7
+ ['icon', :icon, :to_url]
8
+ )
9
9
  end
@@ -1,4 +1,4 @@
1
1
  # Basic metadata about a project's issue security scheme.
2
2
  class JIRA::IssueSecurityScheme < JIRA::Scheme
3
- add_attributes({})
3
+ add_attributes
4
4
  end
@@ -1,8 +1,7 @@
1
1
  # Contains all the metadata for an issue type.
2
2
  class JIRA::IssueType < JIRA::IssueProperty
3
- add_attributes({ 'subTask' => [:subtask=, :to_boolean] })
4
-
5
- # @return [boolean] true if the issue type is also a subtask
6
- attr_accessor :subtask
7
- alias_method :subtask?, :subtask
3
+ add_attributes(
4
+ # True if the issue type is also a subtask.
5
+ ['subTask', :subtask, :to_boolean]
6
+ )
8
7
  end
@@ -1,7 +1,7 @@
1
1
  # @abstract Most dynamic entities also have a name
2
2
  class JIRA::NamedEntity < JIRA::DynamicEntity
3
- add_attributes({ 'name' => [:name=, :to_s] })
4
-
5
- # @return [String] a plain language name
6
- attr_accessor :name
3
+ add_attributes(
4
+ # A plain language name.
5
+ ['name', :name, :to_s]
6
+ )
7
7
  end
@@ -1,4 +1,4 @@
1
1
  # Basic metadata about a project's notification scheme.
2
2
  class JIRA::NotificationScheme < JIRA::Scheme
3
- add_attributes({})
3
+ add_attributes
4
4
  end
@@ -1,12 +1,9 @@
1
+ # A permission id and the username that it is tied to.
1
2
  class JIRA::Permission < JIRA::Entity
2
- add_attributes({
3
- 'name' => [:name=, :to_s],
4
- 'permission' => [:permission=, :to_i]
5
- })
6
-
7
- # @return [String] the permission type
8
- attr_accessor :name
9
-
10
- # @return [Fixnum] a unique id number
11
- attr_accessor :permission
3
+ add_attributes(
4
+ # The permission type
5
+ ['name', :name, :to_s],
6
+ # A unique id number
7
+ ['permission', :permission, :to_i]
8
+ )
12
9
  end
@@ -1,12 +1,7 @@
1
+ # @todo make sure the xml names are correct (check the XML dump)
1
2
  class JIRA::PermissionMapping < JIRA::Entity
2
- @attributes = {
3
- 'permission' => [:permission=, :to_object, JIRA::Permission],
4
- 'permission' => [:permission=, :to_objects, JIRA::Permission]
5
- }
6
-
7
- # @return [JIRA::Permission]
8
- attr_accessor :permission
9
-
10
- # @return [[JIRA::RemoteEntity]]
11
- attr_accessor :remote_entities
3
+ add_attributes(
4
+ ['permission', :permission, :to_object, JIRA::Permission],
5
+ ['entities', :users, :to_objects, JIRA::UserName]
6
+ )
12
7
  end
@@ -1,8 +1,7 @@
1
1
  # @todo complete this class
2
2
  # Includes a mapping of project specific permission settings.
3
3
  class JIRA::PermissionScheme < JIRA::Scheme
4
- add_attributes({})
5
-
6
- # @return [nil]
7
- attr_accessor :permission_mappings
4
+ add_attributes(
5
+ ['permissionMappings', :permission_mappings, :to_objects, JIRA::PermissionMapping]
6
+ )
8
7
  end
@@ -1,9 +1,10 @@
1
1
  # Contains all the metadata for a priority level.
2
2
  class JIRA::Priority < JIRA::IssueProperty
3
- add_attributes({ 'color' => [:color=, :to_hex_string] })
3
+ add_attributes(
4
+ # the RGB components as a triple
5
+ ['color', :color, :to_hex_string]
6
+ )
4
7
 
5
- # @return [Array(String,String,String)] the RGB components as a triple
6
- attr_accessor :color
7
8
  alias_method :colour, :color
8
9
  alias_method :colour=, :color=
9
10
  end
@@ -1,35 +1,14 @@
1
1
  # Contains the data and metadata about a project and its configuration.
2
2
  class JIRA::Project < JIRA::DescribedEntity
3
- add_attributes({
4
- 'key' => [:key=, :to_s],
5
- 'lead' => [:lead_username=, :to_s],
6
- 'issueSecurityScheme' => [:issue_security_scheme=, :to_object, JIRA::IssueSecurityScheme],
7
- 'notificationScheme' => [:notification_scheme=, :to_object, JIRA::NotificationScheme],
8
- 'permissionScheme' => [:permission_scheme=, :to_object, JIRA::PermissionScheme],
9
- 'url' => [:jira_url=, :to_url],
10
- 'projectUrl' => [:project_url=, :to_url]
11
- })
12
-
13
- # @return [String]
14
- attr_accessor :key
15
-
16
- # @return [URL]
17
- attr_accessor :jira_url
18
-
19
- # @return [URL]
20
- attr_accessor :project_url
21
-
22
- # @return [String]
23
- attr_accessor :lead_username
24
-
25
- # @return [JIRA::IssueSecurityScheme]
26
- attr_accessor :issue_security_scheme
27
-
28
- # @return [JIRA::NotificationScheme]
29
- attr_accessor :notification_scheme
30
-
31
- # @return [JIRA::PermissionScheme]
32
- attr_accessor :permission_scheme
3
+ add_attributes(
4
+ ['key', :key, :to_s],
5
+ ['lead', :lead_username, :to_s],
6
+ ['issueSecurityScheme', :issue_security_scheme, :to_object, JIRA::IssueSecurityScheme],
7
+ ['notificationScheme', :notification_scheme, :to_object, JIRA::NotificationScheme],
8
+ ['permissionScheme', :permission_scheme, :to_object, JIRA::PermissionScheme],
9
+ ['url', :jira_url, :to_url],
10
+ ['projectUrl', :project_url, :to_url]
11
+ )
33
12
 
34
13
  # @todo make this method shorter
35
14
  # @todo encode the schemes
@@ -1,6 +1,6 @@
1
1
  # Only a name, description and id.
2
2
  class JIRA::ProjectRole < JIRA::DescribedEntity
3
- add_attributes({})
3
+ add_attributes
4
4
 
5
5
  # @param [Handsoap::XmlMason::Node] msg the node where to add self
6
6
  def soapify_for msg
@@ -1,4 +1,4 @@
1
1
  # Contains all the metadata for a resolution.
2
2
  class JIRA::Resolution < JIRA::IssueProperty
3
- add_attributes({})
3
+ add_attributes
4
4
  end
@@ -1,7 +1,7 @@
1
1
  # @abstract
2
2
  # Schemes used by the server.
3
3
  class JIRA::Scheme < JIRA::DescribedEntity
4
- add_attributes({})
4
+ add_attributes
5
5
 
6
6
  # Child classes need to be careful when encoding the scheme type to XML.
7
7
  # @return [Class]
@@ -1,56 +1,17 @@
1
1
  # A simple structure that is used by {RemoteAPI#get_server_configuration}.
2
2
  class JIRA::ServerConfiguration < JIRA::Entity
3
- add_attributes({
4
- 'allowExternalUserManagement' => [:external_user_management_allowed=, :to_boolean],
5
- 'allowAttachments' => [:attachments_allowed=, :to_boolean],
6
- 'allowIssueLinking' => [:issue_linking_allowed=, :to_boolean],
7
- 'allowSubTasks' => [:subtasks_allowed=, :to_boolean],
8
- 'allowTimeTracking' => [:time_tracking_allowed=, :to_boolean],
9
- 'allowUnassignedIssues' => [:unassigned_issues_allowed=, :to_boolean],
10
- 'allowVoting' => [:voting_allowed=, :to_boolean],
11
- 'allowWatching' => [:watching_allowed=, :to_boolean],
12
- 'timeTrackingDaysPerWeek' => [:time_tracking_days_per_week=, :to_i],
13
- 'timeTrackingHoursPerDay' => [:time_tracking_hours_per_day=, :to_i],
14
-
15
- # in case we are using a version of JIRA that misspells 'management'
16
- 'allowExternalUserManagment' => [:external_user_management_allowed=, :to_boolean]
17
- })
18
-
19
- # @return [boolean]
20
- attr_accessor :attachments_allowed
21
- alias_method :attachments_allowed?, :attachments_allowed
22
-
23
- # @return [boolean]
24
- attr_accessor :external_user_management_allowed
25
- alias_method :external_user_management_allowed?, :external_user_management_allowed
26
-
27
- # @return [boolean]
28
- attr_accessor :issue_linking_allowed
29
- alias_method :issue_linking_allowed?, :issue_linking_allowed
30
-
31
- # @return [boolean]
32
- attr_accessor :subtasks_allowed
33
- alias_method :subtasks_allowed?, :subtasks_allowed
34
-
35
- # @return [boolean]
36
- attr_accessor :time_tracking_allowed
37
- alias_method :time_tracking_allowed?, :time_tracking_allowed
38
-
39
- # @return [boolean]
40
- attr_accessor :unassigned_issues_allowed
41
- alias_method :unassigned_issues_allowed?, :unassigned_issues_allowed
42
-
43
- # @return [boolean]
44
- attr_accessor :voting_allowed
45
- alias_method :voting_allowed?, :voting_allowed
46
-
47
- # @return [boolean]
48
- attr_accessor :watching_allowed
49
- alias_method :watching_allowed?, :watching_allowed
50
-
51
- # @return [Fixnum]
52
- attr_accessor :time_tracking_days_per_week
53
-
54
- # @return [Fixnum]
55
- attr_accessor :time_tracking_hours_per_day
3
+ add_attributes(
4
+ ['allowExternalUserManagement', :external_user_management_allowed, :to_boolean],
5
+ ['allowAttachments', :attachments_allowed, :to_boolean],
6
+ ['allowIssueLinking', :issue_linking_allowed, :to_boolean],
7
+ ['allowSubTasks', :subtasks_allowed, :to_boolean],
8
+ ['allowTimeTracking', :time_tracking_allowed, :to_boolean],
9
+ ['allowUnassignedIssues', :unassigned_issues_allowed, :to_boolean],
10
+ ['allowVoting', :voting_allowed, :to_boolean],
11
+ ['allowWatching', :watching_allowed, :to_boolean],
12
+ ['timeTrackingDaysPerWeek', :time_tracking_days_per_week, :to_i],
13
+ ['timeTrackingHoursPerDay', :time_tracking_hours_per_day, :to_i],
14
+ # In case we are using a version of JIRA that misspells 'management'
15
+ ['allowExternalUserManagment', :external_user_management_allowed, :to_boolean]
16
+ )
56
17
  end
@@ -1,30 +1,12 @@
1
1
  # Only contains basic information about the endpoint server and only used
2
2
  # by {RemoteAPI#get_server_info}.
3
3
  class JIRA::ServerInfo < JIRA::Entity
4
- add_attributes({
5
- 'baseUrl' => [:base_url=, :to_url],
6
- 'buildDate' => [:build_date=, :to_date],
7
- 'buildNumber' => [:build_number=, :to_i],
8
- 'edition' => [:edition=, :to_s],
9
- 'version' => [:version=, :to_s],
10
- 'serverTime' => [:server_time=, :to_object, JIRA::TimeInfo]
11
- })
12
-
13
- # @return [URL]
14
- attr_accessor :base_url
15
-
16
- # @return [Time]
17
- attr_accessor :build_date
18
-
19
- # @return [Fixnum]
20
- attr_accessor :build_number
21
-
22
- # @return [String]
23
- attr_accessor :edition
24
-
25
- # @return [String]
26
- attr_accessor :version
27
-
28
- # @return [JIRA::TimeInfo]
29
- attr_accessor :server_time
4
+ add_attributes(
5
+ ['baseUrl', :base_url, :to_url],
6
+ ['buildDate', :build_date, :to_date],
7
+ ['buildNumber', :build_number, :to_i],
8
+ ['edition', :edition, :to_s],
9
+ ['version', :version, :to_s],
10
+ ['serverTime', :server_time, :to_object, JIRA::TimeInfo]
11
+ )
30
12
  end
@@ -1,4 +1,4 @@
1
1
  # Contains all the metadata for an issue's status.
2
2
  class JIRA::Status < JIRA::IssueProperty
3
- add_attributes({})
3
+ add_attributes
4
4
  end
@@ -2,14 +2,9 @@
2
2
  # objects, which themselves are only created when {RemoteAPI#get_server_info}
3
3
  # is called.
4
4
  class JIRA::TimeInfo < JIRA::Entity
5
- add_attributes({
6
- 'serverTime' => [:server_time=, :to_date_string],
7
- 'timeZoneId' => [:timezone=, :to_s]
8
- })
9
-
10
- # @return [Time]
11
- attr_accessor :server_time
12
-
13
- # @return [String] in the form of 'America/Toronto'
14
- attr_accessor :timezone
5
+ add_attributes(
6
+ ['serverTime', :server_time, :to_date_string],
7
+ # in the form of 'America/Toronto'
8
+ ['timeZoneId', :timezone, :to_s]
9
+ )
15
10
  end
@@ -1,18 +1,8 @@
1
1
  # Contains only the basic information about a user. The only things missing here
2
2
  # are the permissions and login statistics, but these are not given in the API.
3
- class JIRA::User < JIRA::Entity
4
- add_attributes({
5
- 'name' => [:username=, :to_s],
6
- 'fullname' => [:full_name=, :to_s],
7
- 'email' => [:email_address=, :to_s]
8
- })
9
-
10
- # @return [String]
11
- attr_accessor :username
12
-
13
- # @return [String]
14
- attr_accessor :full_name
15
-
16
- # @return [String]
17
- attr_accessor :email_address
3
+ class JIRA::User < JIRA::UserName
4
+ add_attributes(
5
+ ['fullname', :full_name, :to_s],
6
+ ['email', :email_address, :to_s]
7
+ )
18
8
  end
@@ -0,0 +1,4 @@
1
+ # This is just a @name, JIRA::User should inherit from this class
2
+ class JIRA::UserName < JIRA::Entity
3
+ add_attributes(['name', :username, :to_s])
4
+ end
@@ -2,26 +2,12 @@
2
2
  # Represents a version for a project. The description field is never
3
3
  # included when you retrieve versions from the server.
4
4
  class JIRA::Version < JIRA::NamedEntity
5
- add_attributes({
6
- 'sequence' => [:sequence=, :to_i],
7
- 'released' => [:released=, :to_boolean],
8
- 'archived' => [:archived=, :to_boolean],
9
- 'releaseDate' => [:release_date=, :to_date]
10
- })
11
-
12
- # @return [Fixnum]
13
- attr_accessor :sequence
14
-
15
- # @return [boolean]
16
- attr_accessor :released
17
- alias_method :released?, :released
18
-
19
- # @return [boolean]
20
- attr_accessor :archived
21
- alias_method :archived?, :archived
22
-
23
- # @return [Time]
24
- attr_accessor :release_date
5
+ add_attributes(
6
+ ['sequence', :sequence, :to_i],
7
+ ['released', :released, :to_boolean],
8
+ ['archived', :archived, :to_boolean],
9
+ ['releaseDate', :release_date, :to_date]
10
+ )
25
11
 
26
12
  # @todo make this method shorter
27
13
  # @param [Handsoap::XmlMason::Node] msg
@@ -1,6 +1,7 @@
1
1
  # Some simple extensions to Handsoap.
2
2
  module Handsoap
3
3
 
4
+ # @todo check if these methods already exist in Handsoap::Service
4
5
  # Some extensions to the XML builder to make message building less ugly.
5
6
  module XmlMason
6
7
 
@@ -35,6 +36,7 @@ end
35
36
  # These are simple extensions to the existing class provided by Handsoap.
36
37
  module XmlQueryFront
37
38
 
39
+ # @todo move these extensions straight to the nokogiri layer
38
40
  # Simple extensions on the existing Handsoap class to make parsing easier.
39
41
  class NokogiriDriver
40
42
 
@@ -54,11 +56,11 @@ module XmlQueryFront
54
56
  temp.match(/#(..)(..)(..)/).captures
55
57
  end
56
58
 
57
- # @return [URL]
59
+ # @return [URI::HTTP,NSURL]
58
60
  def to_url
59
61
  temp = self.to_s
60
62
  return unless temp
61
- URL.new temp
63
+ JIRA.url_class.send JIRA.url_init_method, temp
62
64
  end
63
65
 
64
66
  # Returns the node's children to an array of strings.
@@ -1,16 +1,23 @@
1
1
  framework 'Foundation'
2
2
 
3
- class URL
4
- def initialize(url_string)
5
- @url = NSURL.URLWithString url_string
6
- end
3
+ # In the case of MacRuby, we extend NSURL to behave enough like a
4
+ # URI::HTTP object that they can be interchanged.
5
+ class NSURL
7
6
 
7
+ # We have to override, using {#alias_method} does not work because
8
+ # {#to_s} is defined in the base class.
9
+ # @return [String]
8
10
  def to_s
9
- @url.absoluteString
11
+ absoluteString
10
12
  end
13
+
11
14
  end
12
15
 
16
+
13
17
  # @todo get a parallel map method for collections
14
18
  module JIRA
15
19
 
20
+ @url_class = NSURL
21
+ @url_init_method = :'URLWithString:'
22
+
16
23
  end