jiraSOAP 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/.yardopts +2 -3
  2. data/ChangeLog +15 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.markdown +51 -41
  5. data/Rakefile +57 -0
  6. data/docs/GettingStarted.markdown +36 -0
  7. data/lib/jiraSOAP.rb +7 -4
  8. data/lib/jiraSOAP/api.rb +59 -53
  9. data/lib/jiraSOAP/api/additions.rb +4 -6
  10. data/lib/jiraSOAP/api/attachments.rb +18 -8
  11. data/lib/jiraSOAP/api/avatars.rb +30 -17
  12. data/lib/jiraSOAP/api/comments.rb +16 -11
  13. data/lib/jiraSOAP/api/filters.rb +13 -10
  14. data/lib/jiraSOAP/api/issue_data_types.rb +29 -21
  15. data/lib/jiraSOAP/api/issues.rb +46 -31
  16. data/lib/jiraSOAP/api/project_roles.rb +22 -15
  17. data/lib/jiraSOAP/api/projects.rb +33 -20
  18. data/lib/jiraSOAP/api/schemes.rb +9 -9
  19. data/lib/jiraSOAP/api/server_info.rb +11 -9
  20. data/lib/jiraSOAP/api/users.rb +58 -10
  21. data/lib/jiraSOAP/api/versions.rb +15 -11
  22. data/lib/jiraSOAP/api/worklog.rb +14 -0
  23. data/lib/jiraSOAP/core_extensions.rb +8 -0
  24. data/lib/jiraSOAP/entities.rb +3 -0
  25. data/lib/jiraSOAP/entities/attachment_metadata.rb +28 -9
  26. data/lib/jiraSOAP/entities/avatar.rb +29 -10
  27. data/lib/jiraSOAP/entities/comment.rb +37 -11
  28. data/lib/jiraSOAP/entities/component.rb +1 -1
  29. data/lib/jiraSOAP/entities/custom_field_value.rb +17 -12
  30. data/lib/jiraSOAP/entities/described_entity.rb +9 -5
  31. data/lib/jiraSOAP/entities/dynamic_entity.rb +12 -5
  32. data/lib/jiraSOAP/entities/entity.rb +33 -27
  33. data/lib/jiraSOAP/entities/field.rb +1 -1
  34. data/lib/jiraSOAP/entities/field_value.rb +16 -6
  35. data/lib/jiraSOAP/entities/filter.rb +18 -5
  36. data/lib/jiraSOAP/entities/issue.rb +74 -29
  37. data/lib/jiraSOAP/entities/issue_property.rb +9 -6
  38. data/lib/jiraSOAP/entities/issue_security_scheme.rb +1 -1
  39. data/lib/jiraSOAP/entities/issue_type.rb +9 -4
  40. data/lib/jiraSOAP/entities/named_entity.rb +8 -4
  41. data/lib/jiraSOAP/entities/notification_scheme.rb +1 -1
  42. data/lib/jiraSOAP/entities/permission.rb +14 -6
  43. data/lib/jiraSOAP/entities/permission_mapping.rb +9 -5
  44. data/lib/jiraSOAP/entities/permission_scheme.rb +7 -4
  45. data/lib/jiraSOAP/entities/priority.rb +7 -4
  46. data/lib/jiraSOAP/entities/project.rb +29 -13
  47. data/lib/jiraSOAP/entities/project_role.rb +3 -2
  48. data/lib/jiraSOAP/entities/resolution.rb +1 -1
  49. data/lib/jiraSOAP/entities/scheme.rb +5 -1
  50. data/lib/jiraSOAP/entities/server_configuration.rb +39 -14
  51. data/lib/jiraSOAP/entities/server_info.rb +20 -8
  52. data/lib/jiraSOAP/entities/status.rb +1 -1
  53. data/lib/jiraSOAP/entities/time_info.rb +12 -5
  54. data/lib/jiraSOAP/entities/user.rb +8 -4
  55. data/lib/jiraSOAP/entities/usergroup.rb +15 -0
  56. data/lib/jiraSOAP/entities/username.rb +7 -1
  57. data/lib/jiraSOAP/entities/version.rb +20 -12
  58. data/lib/jiraSOAP/entities/worklog.rb +28 -0
  59. data/lib/jiraSOAP/handsoap_extensions.rb +31 -80
  60. data/lib/jiraSOAP/{JIRAservice.rb → jira_service.rb} +19 -14
  61. data/lib/jiraSOAP/{macruby_bonuses.rb → macruby_extensions.rb} +5 -14
  62. data/lib/jiraSOAP/nokogiri_extensions.rb +68 -0
  63. data/lib/jiraSOAP/url.rb +10 -2
  64. data/lib/jiraSOAP/version.rb +3 -0
  65. metadata +29 -55
  66. data/yard-jiraSOAP.rb +0 -65
@@ -1,9 +1,12 @@
1
+ ##
1
2
  # @abstract A common base for most issue properties; core issue properties
2
- # have an icon to go with them to help identify properties of issues more
3
- # quickly.
3
+ # also have an icon.
4
4
  class JIRA::IssueProperty < JIRA::DescribedEntity
5
- add_attributes(
6
- # NSURL on MacRuby and a URI::HTTP object on CRuby
7
- ['icon', :icon, :to_url]
8
- )
5
+
6
+ ##
7
+ # NSURL on MacRuby, URI::HTTP on CRuby
8
+ #
9
+ # @return [URI::HTTP,NSURL]
10
+ add_attribute :icon, 'icon', :to_url
11
+
9
12
  end
@@ -1,4 +1,4 @@
1
+ ##
1
2
  # Basic metadata about a project's issue security scheme.
2
3
  class JIRA::IssueSecurityScheme < JIRA::Scheme
3
- add_attributes
4
4
  end
@@ -1,7 +1,12 @@
1
+ ##
1
2
  # Contains all the metadata for an issue type.
2
3
  class JIRA::IssueType < JIRA::IssueProperty
3
- add_attributes(
4
- # True if the issue type is also a subtask.
5
- ['subTask', :subtask, :to_boolean]
6
- )
4
+
5
+ ##
6
+ # True if the issue type is also a subtask
7
+ #
8
+ # @return [Boolean]
9
+ add_attribute :subtask, 'subTask', :to_boolean
10
+ alias_method :sub_task, :subtask
11
+
7
12
  end
@@ -1,7 +1,11 @@
1
+ ##
1
2
  # @abstract Most dynamic entities also have a name
2
3
  class JIRA::NamedEntity < JIRA::DynamicEntity
3
- add_attributes(
4
- # A plain language name.
5
- ['name', :name, :to_s]
6
- )
4
+
5
+ ##
6
+ # A plain language name
7
+ #
8
+ # @return [String]
9
+ add_attribute :name, 'name', :content
10
+
7
11
  end
@@ -1,4 +1,4 @@
1
+ ##
1
2
  # Basic metadata about a project's notification scheme.
2
3
  class JIRA::NotificationScheme < JIRA::Scheme
3
- add_attributes
4
4
  end
@@ -1,9 +1,17 @@
1
+ ##
1
2
  # A permission id and the username that it is tied to.
2
3
  class JIRA::Permission < JIRA::Entity
3
- add_attributes(
4
- # The permission type
5
- ['name', :name, :to_s],
6
- # A unique id number
7
- ['permission', :permission, :to_i]
8
- )
4
+
5
+ ##
6
+ # The permission type
7
+ #
8
+ # @return [String]
9
+ add_attribute :name, 'name', :content
10
+
11
+ ##
12
+ # A unique id number
13
+ #
14
+ # @return [Number]
15
+ add_attribute :permission, 'permission', :to_i
16
+
9
17
  end
@@ -1,7 +1,11 @@
1
- # @todo make sure the xml names are correct (check the XML dump)
1
+ ##
2
+ # @todo Make sure the xml names are correct (check the XML dump)
2
3
  class JIRA::PermissionMapping < JIRA::Entity
3
- add_attributes(
4
- ['permission', :permission, :to_object, JIRA::Permission],
5
- ['entities', :users, :to_objects, JIRA::UserName]
6
- )
4
+
5
+ # @return [Array<JIRA::Permission>]
6
+ add_attribute :permission, 'permission', [:children_as_object, JIRA::Permission]
7
+
8
+ # @return [Array<JIRA::UserName>]
9
+ add_attribute :users, 'entities', [:children_as_objects, JIRA::UserName]
10
+
7
11
  end
@@ -1,7 +1,10 @@
1
- # @todo complete this class
1
+ ##
2
+ # @todo Complete this class
3
+ #
2
4
  # Includes a mapping of project specific permission settings.
3
5
  class JIRA::PermissionScheme < JIRA::Scheme
4
- add_attributes(
5
- ['permissionMappings', :permission_mappings, :to_objects, JIRA::PermissionMapping]
6
- )
6
+
7
+ # @return [Array<JIRA::PermissionMapping>]
8
+ add_attribute :permission_mappings, 'permissionMappings', [:children_as_objects, JIRA::PermissionMapping]
9
+
7
10
  end
@@ -1,10 +1,13 @@
1
+ ##
1
2
  # Contains all the metadata for a priority level.
2
3
  class JIRA::Priority < JIRA::IssueProperty
3
- add_attributes(
4
- # the RGB components as a triple
5
- ['color', :color, :to_hex_string]
6
- )
7
4
 
5
+ ##
6
+ # The RGB components as a triple
7
+ #
8
+ # @return [Array(String,String,String)]
9
+ add_attribute :color, 'color', :to_colour_triple
8
10
  alias_method :colour, :color
9
11
  alias_method :colour=, :color=
12
+
10
13
  end
@@ -1,20 +1,35 @@
1
+ ##
1
2
  # Contains the data and metadata about a project and its configuration.
2
3
  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
- # @todo make this method shorter
14
- # @todo encode the schemes
4
+
5
+ # @return [String]
6
+ add_attribute :key, 'key', :content
7
+
8
+ # @return [String]
9
+ add_attribute :lead_username, 'lead', :content
10
+
11
+ # @return [String]
12
+ add_attribute :issue_security_scheme, 'issueSecurityScheme', [:children_as_object, JIRA::IssueSecurityScheme]
13
+
14
+ # @return [String]
15
+ add_attribute :notification_scheme, 'notificationScheme', [:children_as_object, JIRA::NotificationScheme]
16
+
17
+ # @return [String]
18
+ add_attribute :permission_scheme, 'permissionScheme', [:children_as_object, JIRA::PermissionScheme]
19
+
20
+ # @return [NSURL,URI::HTTP]
21
+ add_attribute :jira_url, 'url', :to_url
22
+
23
+ # @return [NSURL,URI::HTTP]
24
+ add_attribute :project_url, 'projectUrl', :to_url
25
+
26
+
27
+ ##
28
+ # @todo Encode the schemes
29
+ #
15
30
  # @param [Handsoap::XmlMason::Node] msg
16
31
  # @return [Handsoap::XmlMason::Node]
17
- def soapify_for(msg)
32
+ def soapify_for msg
18
33
  msg.add 'id', @id
19
34
  msg.add 'name', @name
20
35
  msg.add 'key', @key
@@ -23,4 +38,5 @@ class JIRA::Project < JIRA::DescribedEntity
23
38
  msg.add 'lead', @lead_username
24
39
  msg.add 'description', @description
25
40
  end
41
+
26
42
  end
@@ -1,6 +1,6 @@
1
- # Only a name, description and id.
1
+ ##
2
+ # Only a name, description, and id.
2
3
  class JIRA::ProjectRole < JIRA::DescribedEntity
3
- add_attributes
4
4
 
5
5
  # @param [Handsoap::XmlMason::Node] msg the node where to add self
6
6
  def soapify_for msg
@@ -8,4 +8,5 @@ class JIRA::ProjectRole < JIRA::DescribedEntity
8
8
  msg.add 'name', @name
9
9
  msg.add 'description', @description
10
10
  end
11
+
11
12
  end
@@ -1,4 +1,4 @@
1
+ ##
1
2
  # Contains all the metadata for a resolution.
2
3
  class JIRA::Resolution < JIRA::IssueProperty
3
- add_attributes
4
4
  end
@@ -1,9 +1,13 @@
1
+ ##
1
2
  # @abstract
3
+ #
2
4
  # Schemes used by the server.
3
5
  class JIRA::Scheme < JIRA::DescribedEntity
4
- add_attributes
5
6
 
7
+ ##
6
8
  # Child classes need to be careful when encoding the scheme type to XML.
9
+ #
7
10
  # @return [Class]
8
11
  alias_method :type, :class
12
+
9
13
  end
@@ -1,17 +1,42 @@
1
+ ##
1
2
  # A simple structure that is used by {RemoteAPI#get_server_configuration}.
2
3
  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
- # In case we are using a version of JIRA that misspells 'management'
15
- ['allowExternalUserManagment', :external_user_management_allowed, :to_boolean]
16
- )
4
+
5
+ # @return [Boolean]
6
+ add_attribute :external_user_management_allowed, 'allowExternalUserManagement', :to_boolean
7
+
8
+ # @return [Boolean]
9
+ add_attribute :attachments_allowed, 'allowAttachments', :to_boolean
10
+
11
+ # @return [Boolean]
12
+ add_attribute :issue_linking_allowed, 'allowIssueLinking', :to_boolean
13
+
14
+ # @return [Boolean]
15
+ add_attribute :subtasks_allowed, 'allowSubTasks', :to_boolean
16
+
17
+ # @return [Boolean]
18
+ add_attribute :time_tracking_allowed, 'allowTimeTracking', :to_boolean
19
+
20
+ # @return [Boolean]
21
+ add_attribute :unassigned_issues_allowed, 'allowUnassignedIssues', :to_boolean
22
+
23
+ # @return [Boolean]
24
+ add_attribute :voting_allowed, 'allowVoting', :to_boolean
25
+
26
+ # @return [Boolean]
27
+ add_attribute :watching_allowed, 'allowWatching', :to_boolean
28
+
29
+ # @return [Number]
30
+ add_attribute :time_tracking_days_per_week, 'timeTrackingDaysPerWeek', :to_i
31
+
32
+ # @return [Number]
33
+ add_attribute :time_tracking_hours_per_day, 'timeTrackingHoursPerDay', :to_i
34
+
35
+ ##
36
+ # @note JIRA misspells 'management', so we define this attribute twice
37
+ # to cover both cases.
38
+ #
39
+ # @return [Boolean]
40
+ add_attribute :external_user_management_allowed, 'allowExternalUserManagment', :to_boolean
41
+
17
42
  end
@@ -1,12 +1,24 @@
1
+ ##
1
2
  # Only contains basic information about the endpoint server and only used
2
3
  # by {RemoteAPI#get_server_info}.
3
4
  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
- )
5
+
6
+ # @return [NSURL,URI::HTTP]
7
+ add_attribute :base_url, 'baseUrl', :to_url
8
+
9
+ # @return [Time]
10
+ add_attribute :build_date, 'buildDate', :to_iso_date
11
+
12
+ # @return [Number]
13
+ add_attribute :build_number, 'buildNumber', :to_i
14
+
15
+ # @return [String]
16
+ add_attribute :edition, 'edition', :content
17
+
18
+ # @return [String]
19
+ add_attribute :version, 'version', :content
20
+
21
+ # @return [Array<JIRA::TimeInfo>]
22
+ add_attribute :server_time, 'serverTime', [:children_as_object, JIRA::TimeInfo]
23
+
12
24
  end
@@ -1,4 +1,4 @@
1
+ ##
1
2
  # Contains all the metadata for an issue's status.
2
3
  class JIRA::Status < JIRA::IssueProperty
3
- add_attributes
4
4
  end
@@ -1,10 +1,17 @@
1
+ ##
1
2
  # Simple structure for a time and time zone; only used by JIRA::ServerInfo
2
3
  # objects, which themselves are only created when {RemoteAPI#get_server_info}
3
4
  # is called.
4
5
  class JIRA::TimeInfo < JIRA::Entity
5
- add_attributes(
6
- ['serverTime', :server_time, :to_date_string],
7
- # in the form of 'America/Toronto'
8
- ['timeZoneId', :timezone, :to_s]
9
- )
6
+
7
+ # @return [Time]
8
+ add_attribute :server_time, 'serverTime', :to_natural_date
9
+
10
+ ##
11
+ # @example
12
+ # 'America/Toronto'
13
+ #
14
+ # @return [String]
15
+ add_attribute :timezone, 'timeZoneId', :content
16
+
10
17
  end
@@ -1,8 +1,12 @@
1
+ ##
1
2
  # Contains only the basic information about a user. The only things missing here
2
3
  # are the permissions and login statistics, but these are not given in the API.
3
4
  class JIRA::User < JIRA::UserName
4
- add_attributes(
5
- ['fullname', :full_name, :to_s],
6
- ['email', :email_address, :to_s]
7
- )
5
+
6
+ # @return [String]
7
+ add_attribute :full_name, 'fullname', :content
8
+
9
+ # @return [String]
10
+ add_attribute :email_address, 'email', :content
11
+
8
12
  end
@@ -0,0 +1,15 @@
1
+ ##
2
+ # Though this class contains a name, it is not the same name that
3
+ # you get from a {JIRA::NamedEntity}.
4
+ class JIRA::UserGroup < JIRA::Entity
5
+
6
+ # @return [String]
7
+ add_attribute :name, 'name', :content
8
+
9
+ ##
10
+ # @todo I suspect that I will have to delete users from SOAPifying
11
+ #
12
+ # @return [Array<JIRA::User>]
13
+ add_attribute :users, 'users', [:children_as_objects, JIRA::User]
14
+
15
+ end
@@ -1,4 +1,10 @@
1
+ ##
2
+ # @todo Find out if this is an abstract class.
3
+ #
1
4
  # This is just a @name, JIRA::User should inherit from this class
2
5
  class JIRA::UserName < JIRA::Entity
3
- add_attributes(['name', :username, :to_s])
6
+
7
+ # @return [String]
8
+ add_attribute :username, 'name', :content
9
+
4
10
  end
@@ -1,22 +1,30 @@
1
- # @todo find out why we don't get a description for this object
1
+ ##
2
+ # @todo Find out why we don't get a description for this object
3
+ #
2
4
  # Represents a version for a project. The description field is never
3
5
  # included when you retrieve versions from the server.
4
6
  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
7
 
12
- # @todo make this method shorter
8
+ # @return [Number]
9
+ add_attribute :sequence, 'sequence', :to_i
10
+
11
+ # @return [Boolean]
12
+ add_attribute :released, 'released', :to_boolean
13
+
14
+ # @return [Boolean]
15
+ add_attribute :archived, 'archived', :to_boolean
16
+
17
+ # @return [Time]
18
+ add_attribute :release_date, 'releaseDate', :to_iso_date
19
+
13
20
  # @param [Handsoap::XmlMason::Node] msg
14
21
  # @return [Handsoap::XmlMason::Node]
15
22
  def soapify_for(msg)
16
23
  msg.add 'name', @name
17
- msg.add 'archived', @archived unless @archived.nil?
18
- msg.add 'sequence', @sequence unless @sequence.nil?
19
- msg.add 'releaseDate', @release_date.xmlschema unless @release_date.nil?
20
- msg.add 'released', @released unless @released.nil?
24
+ msg.add 'archived', @archived if @archived
25
+ msg.add 'sequence', @sequence if @sequence
26
+ msg.add 'releaseDate', @release_date.xmlschema if @release_date
27
+ msg.add 'released', @released if @released
21
28
  end
29
+
22
30
  end