jiraSOAP 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.yardopts CHANGED
@@ -7,5 +7,6 @@ lib/**/*.rb
7
7
  -
8
8
  docs/GettingStarted.markdown
9
9
  docs/Examples.markdown
10
+ docs/SwitchingHTTPDriver.markdown
10
11
  ChangeLog
11
12
  LICENSE.txt
data/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ Version 0.10.0
2
+
3
+ * Add RemoteAPI#add_attachments_to_issue_with_key (thanks @rjharmon)
4
+ * Add RemoteAPI#components_for_project_with_key (thanks @rjharmon)
5
+
6
+ * Fix a typo in RemoteAPI#progress_workflow_action (thanks Vincent Beau)
7
+
8
+ * Deprecate RemoteAPI#add_base64_encoded_attachments_to_issue_with_key (thanks @rjharmon)
9
+ * Remove deprecated methods from previous release
10
+ * Begin making the test suite public
11
+
1
12
  Version 0.9.2
2
13
 
3
14
  * Remove unneeded httpclient dependency
data/README.markdown CHANGED
@@ -43,8 +43,6 @@ See the {file:docs/GettingStarted.markdown Getting Started} guide.
43
43
  JQL searches)
44
44
  + Parsing might be doable with array indexing instead of hash lookups
45
45
  + Use a different web driver backend (net/http is slow under load)
46
- - Public test suite
47
- + Needs a lot of mock data
48
46
  - ActiveRecord inspired conveniences
49
47
  + ProjectRole.new( 'test role' ).unique? # => check uniqueness
50
48
  + Issue.new( args ).create! # => creates a new issue
@@ -52,12 +50,20 @@ See the {file:docs/GettingStarted.markdown Getting Started} guide.
52
50
  + Issue.new( args ).project # => returns a JIRA::Project
53
51
 
54
52
 
53
+ ## Test Suite
54
+
55
+ The test suite relies on a specific JIRA server being available. Every
56
+ thing that might need to be configured has been abstracted to its own
57
+ method so that the values can easily be changed, but I will try to
58
+ provide a database backup in the near future if the licensing works out.
59
+
55
60
  ## Note on Patches/Pull Requests
56
61
 
57
62
  * Fork the project.
58
63
  * Make your feature addition or bug fix.
59
64
  * Add tests for it. This is important so I don't break it in a
60
- future version unintentionally.
65
+ future version unintentionally. If it is difficult for you to run
66
+ the tests then let me know.
61
67
  * Commit, do not mess with rakefile, version, or history.
62
68
  (if you want to have your own version, that is fine but
63
69
  bump version in a commit by itself I can ignore when I pull)
data/Rakefile CHANGED
@@ -37,7 +37,6 @@ end
37
37
  require 'rake/testtask'
38
38
  Rake::TestTask.new(:test) do |t|
39
39
  t.libs << 'test'
40
- t.pattern = 'test/**/test_*.rb'
41
40
  t.ruby_opts = ['-rhelper.rb']
42
41
  t.verbose = true
43
42
  end
data/lib/jiraSOAP.rb CHANGED
@@ -10,36 +10,17 @@ Handsoap.http_driver = :net_http
10
10
  require 'jiraSOAP/handsoap_extensions'
11
11
 
12
12
  require 'jiraSOAP/url'
13
- require 'jiraSOAP/macruby_extensions' if RUBY_ENGINE == 'macruby'
14
13
 
15
14
  ##
16
15
  # All the remote entities as well as the SOAP service client.
17
16
  module JIRA; end
18
17
 
19
- ##
20
- # Inspired by Gem::Deprecate from rubygems. A mixin that exposes a
21
- # method to declare deprecated methods.
22
- module JIRA::Deprecate
23
-
24
- ##
25
- # Deprecate a method that begins with `get_` by printing out a
26
- # message and then calling the original method.
27
- #
28
- # @param [Symbol] name
29
- def deprecate name
30
- define_method "get_#{name}" do |*args|
31
- $stderr.puts <<-EOM
32
- RemoteAPI#get_#{name} is deprecated and will be removed in the next release.
33
- Please use RemoteAPI##{name} instead.
34
- EOM
35
- send name, *args
36
- end
37
- end
38
-
39
- end
40
-
41
18
  require 'jiraSOAP/version'
42
19
  require 'jiraSOAP/core_extensions'
43
20
  require 'jiraSOAP/entities'
44
21
  require 'jiraSOAP/api'
45
22
  require 'jiraSOAP/jira_service'
23
+
24
+ if RUBY_ENGINE == 'macruby'
25
+ require 'jiraSOAP/macruby_extensions'
26
+ end
data/lib/jiraSOAP/api.rb CHANGED
@@ -5,8 +5,6 @@
5
5
  # Atlassian; most notably, this API tries to be more idomatically Ruby by using
6
6
  # snake case for method names, default values, varargs, etc..
7
7
  module JIRA::RemoteAPI
8
- extend JIRA::Deprecate
9
-
10
8
 
11
9
  # @group Logging in/out
12
10
 
@@ -17,10 +15,9 @@ module JIRA::RemoteAPI
17
15
  # @param [String] password
18
16
  # @return [String] auth_token if successful, otherwise raises an exception
19
17
  def login username, password
20
- response = soap_call 'login', username, password
21
- self.auth_token = response.first.content
22
- @user = user
23
- self.auth_token
18
+ response = soap_call 'login', username, password
19
+ @user = username
20
+ @auth_token = response.first.content
24
21
  end
25
22
  alias_method :log_in, :login
26
23
 
@@ -29,7 +26,10 @@ module JIRA::RemoteAPI
29
26
  # will automatically expire after a set time (configured on the server).
30
27
  # @return [Boolean] true if successful, otherwise false
31
28
  def logout
32
- jira_call( 'logout' ).to_boolean
29
+ jira_call( 'logout' ).to_boolean.tap do |_|
30
+ @user = nil
31
+ @auth_token = nil
32
+ end
33
33
  end
34
34
  alias_method :log_out, :logout
35
35
 
@@ -67,7 +67,7 @@ module JIRA::RemoteAPI
67
67
  # @return [Nokogiri::XML::NodeSet]
68
68
  def soap_call method, *args
69
69
  response = build method, *args
70
- response .document.element/RESPONSE_XPATH
70
+ response .document.native_element/RESPONSE_XPATH
71
71
  end
72
72
 
73
73
  ##
@@ -101,6 +101,7 @@ require 'jiraSOAP/api/additions'
101
101
  require 'jiraSOAP/api/attachments'
102
102
  require 'jiraSOAP/api/avatars'
103
103
  require 'jiraSOAP/api/comments'
104
+ require 'jiraSOAP/api/components'
104
105
  require 'jiraSOAP/api/filters'
105
106
  require 'jiraSOAP/api/issue_data_types'
106
107
  require 'jiraSOAP/api/issues'
@@ -3,7 +3,6 @@
3
3
  # SOAP API javadoc. They are generally close to something from the javadoc
4
4
  # but with some extra conveniences.
5
5
  module JIRA::RemoteAPIAdditions
6
- extend JIRA::Deprecate
7
6
 
8
7
  ##
9
8
  # Returns the first field that exactly matches the given
@@ -14,6 +13,5 @@ module JIRA::RemoteAPIAdditions
14
13
  def custom_field_with_name name
15
14
  get_custom_fields.find { |cf| cf.name == name }
16
15
  end
17
- deprecate :custom_field_with_name
18
16
 
19
17
  end
@@ -13,21 +13,64 @@ module JIRA::RemoteAPI
13
13
  # @todo change method name to reflect that you only get metadata
14
14
  #
15
15
  # @param [String] issue_key
16
- # @return [Array<JIRA::AttachmentMetadata>]
16
+ # @return [Array<JIRA::Attachment>]
17
17
  def attachments_for_issue_with_key issue_key
18
- array_jira_call JIRA::AttachmentMetadata, 'getAttachmentsFromIssue', issue_key
18
+ array_jira_call JIRA::Attachment, 'getAttachmentsFromIssue', issue_key
19
19
  end
20
- deprecate :attachments_for_issue_with_key
21
20
 
22
21
  ##
23
- # Expect this method to be slow.
22
+ # @note Expect this method to be slow.
23
+ #
24
+ # Uploads attachments to an issue using the `addBase64EncodedAttachmentsToIssue`
25
+ # SOAP method.
26
+ #
27
+ # The metadata is not automatically refreshed by this method. To get the
28
+ # updated metadata (e.g., `file_size` and `content_type`), call
29
+ # {RemoteAPI#attachments_for_issue_with_key}.
24
30
  #
25
31
  # @param [String] issue_key
26
- # @param [Array<String>] filenames names to put on the files
27
- # @param [Array<String>] data base64 encoded data
32
+ # @param [Array<JIRA::Attachment>] attachments files to be uploaded;
33
+ # their `content` attributes should populated with the data
28
34
  # @return [Boolean] true if successful
35
+ def add_attachments_to_issue_with_key issue_key, *attachments
36
+ invoke('soap:addBase64EncodedAttachmentsToIssue') { |msg|
37
+ msg.add 'soap:in0', self.auth_token
38
+ msg.add 'soap:in1', issue_key
39
+ msg.add 'soap:in2' do |submsg|
40
+ attachments.each { |attachment| submsg.add 'filenames', attachment.filename }
41
+ end
42
+ msg.add 'soap:in3' do |submsg|
43
+ attachments.each { |attachment| submsg.add 'base64EncodedData', [attachment.content].pack('m0') }
44
+ end
45
+ }
46
+ true
47
+ end
48
+
49
+ ##
50
+ # @deprecated This will be removed in the next release (either 0.11 or 1.0)
51
+ #
52
+ # (see #add_attachments_to_issue_with_key)
53
+ #
54
+ # @param [String] issue_key
55
+ # @param [Array<String>] filenames array of names for attachments
56
+ # @param [Array<String>] data base64 encoded data for upload
57
+ # @return [Boolean] true if successful, otherwise an exception is raised
29
58
  def add_base64_encoded_attachments_to_issue_with_key issue_key, filenames, data
30
- jira_call 'addBase64EncodedAttachmentsToIssue', issue_key, filenames, data
59
+ $stderr.puts <<-EOM
60
+ RemoteAPI#add_base64_encoded_attachments_to_issue_with_key is deprecated and will be removed in the next release.
61
+ Please use RemoteAPI#add_attachments_to_issue_with_key instead.
62
+ EOM
63
+
64
+ invoke('soap:addBase64EncodedAttachmentsToIssue') { |msg|
65
+ msg.add 'soap:in0', self.auth_token
66
+ msg.add 'soap:in1', issue_key
67
+ msg.add 'soap:in2' do |submsg|
68
+ filenames.each { |filename| submsg.add 'filenames', filename }
69
+ end
70
+ msg.add 'soap:in3' do |submsg|
71
+ data.each { |datum| submsg.add 'base64EncodedData', datum }
72
+ end
73
+ }
31
74
  true
32
75
  end
33
76
 
@@ -11,7 +11,6 @@ module JIRA::RemoteAPI
11
11
  def project_avatar_for_key project_key
12
12
  JIRA::Avatar.new_with_xml jira_call('getProjectAvatar', project_key)
13
13
  end
14
- deprecate :project_avatar_for_key
15
14
 
16
15
  ##
17
16
  # Gets ALL avatars for a given project with this method; if you
@@ -23,7 +22,6 @@ module JIRA::RemoteAPI
23
22
  def project_avatars_for_key project_key, include_default_avatars = false
24
23
  array_jira_call JIRA::Avatar, 'getProjectAvatars', project_key, include_default_avatars
25
24
  end
26
- deprecate :project_avatars_for_key
27
25
 
28
26
  ##
29
27
  # @note You cannot delete system avatars, and you need project
@@ -15,14 +15,12 @@ module JIRA::RemoteAPI
15
15
  def comment_with_id id
16
16
  JIRA::Comment.new_with_xml jira_call( 'getComment', id )
17
17
  end
18
- deprecate :comment_with_id
19
18
 
20
19
  # @param [String] issue_key
21
20
  # @return [Array<JIRA::Comment>]
22
21
  def comments_for_issue_with_key issue_key
23
22
  array_jira_call JIRA::Comment, 'getComments', issue_key
24
23
  end
25
- deprecate :comments_for_issue_with_key
26
24
 
27
25
  # @param [JIRA::Comment] comment
28
26
  # @return [JIRA::Comment]
@@ -0,0 +1,13 @@
1
+ module JIRA::RemoteAPI
2
+ # @group Components
3
+
4
+ ##
5
+ # Lists a project's components
6
+ #
7
+ # @param [String] project_key
8
+ # @return [Array<JIRA::Component>]
9
+ def components_for_project_with_key project_key
10
+ array_jira_call JIRA::Component, 'getComponents', project_key
11
+ end
12
+
13
+ end
@@ -10,14 +10,11 @@ module JIRA::RemoteAPI
10
10
  array_jira_call JIRA::Filter, 'getFavouriteFilters'
11
11
  end
12
12
  alias_method :favorite_filters, :favourite_filters
13
- deprecate :favorite_filters
14
- deprecate :favourite_filters
15
13
 
16
14
  # @param [String] id
17
15
  # @return [Fixnum]
18
16
  def issue_count_for_filter_with_id id
19
17
  jira_call( 'getIssueCountForFilter', id ).to_i
20
18
  end
21
- deprecate :issue_count_for_filter_with_id
22
19
 
23
20
  end
@@ -6,51 +6,43 @@ module JIRA::RemoteAPI
6
6
  def priorities
7
7
  array_jira_call JIRA::Priority, 'getPriorities'
8
8
  end
9
- deprecate :priorities
10
9
 
11
10
  # @return [Array<JIRA::Resolution>]
12
11
  def resolutions
13
12
  array_jira_call JIRA::Resolution, 'getResolutions'
14
13
  end
15
- deprecate :resolutions
16
14
 
17
15
  # @return [Array<JIRA::Field>]
18
16
  def custom_fields
19
17
  array_jira_call JIRA::Field, 'getCustomFields'
20
18
  end
21
- deprecate :custom_fields
22
19
 
23
20
  # @return [Array<JIRA::IssueType>]
24
21
  def issue_types
25
22
  array_jira_call JIRA::IssueType, 'getIssueTypes'
26
23
  end
27
- deprecate :issue_types
28
24
 
29
25
  # @param [String] project_name
30
26
  # @return [Array<JIRA::IssueType>]
31
27
  def issue_types_for_project_with_id project_id
32
28
  array_jira_call JIRA::IssueType, 'getIssueTypesForProject', project_id
33
29
  end
34
- deprecate :issue_types_for_project_with_id
35
30
 
36
31
  # @return [Array<JIRA::Status>]
37
32
  def statuses
38
33
  array_jira_call JIRA::Status, 'getStatuses'
39
34
  end
40
- deprecate :statuses
41
35
 
42
36
  # @return [Array<JIRA::IssueType>]
43
37
  def subtask_issue_types
44
38
  array_jira_call JIRA::IssueType, 'getSubTaskIssueTypes'
45
39
  end
46
- deprecate :subtask_issue_types
47
40
 
48
41
  # @param [String] project_id
49
42
  # @return [Array<JIRA::IssueType>]
50
43
  def subtask_issue_types_for_project_with_id project_id
51
44
  array_jira_call JIRA::IssueType, 'getSubTaskIssueTypesForProject', project_id
52
45
  end
53
- deprecate :subtask_issue_types_for_project_with_id
54
46
 
55
47
  ##
56
48
  # @todo find out what this method does
@@ -20,7 +20,6 @@ module JIRA::RemoteAPI
20
20
  def issues_from_jql_search jql_query, max_results = 2000
21
21
  array_jira_call JIRA::Issue, 'getIssuesFromJqlSearch', jql_query, max_results
22
22
  end
23
- deprecate :issues_from_jql_search
24
23
 
25
24
  ##
26
25
  # This method can update most, but not all, issue fields. Some limitations
@@ -107,14 +106,12 @@ module JIRA::RemoteAPI
107
106
  def issue_with_key issue_key
108
107
  JIRA::Issue.new_with_xml jira_call( 'getIssue', issue_key )
109
108
  end
110
- deprecate :issue_with_key
111
109
 
112
110
  # @param [String] issue_id
113
111
  # @return [JIRA::Issue]
114
112
  def issue_with_id issue_id
115
113
  JIRA::Issue.new_with_xml jira_call( 'getIssueById', issue_id )
116
114
  end
117
- deprecate :issue_with_id
118
115
 
119
116
  # @param [String] id
120
117
  # @param [Fixnum] max_results
@@ -123,21 +120,18 @@ module JIRA::RemoteAPI
123
120
  def issues_from_filter_with_id id, max_results = 500, offset = 0
124
121
  array_jira_call JIRA::Issue, 'getIssuesFromFilterWithLimit', id, offset, max_results
125
122
  end
126
- deprecate :issues_from_filter_with_id
127
123
 
128
124
  # @param [String] issue_id
129
125
  # @return [Time]
130
126
  def resolution_date_for_issue_with_id issue_id
131
127
  jira_call( 'getResolutionDateById', issue_id ).to_iso_date
132
128
  end
133
- deprecate :resolution_date_for_issue_with_id
134
129
 
135
130
  # @param [String] issue_key
136
131
  # @return [Time]
137
132
  def resolution_date_for_issue_with_key issue_key
138
133
  jira_call( 'getResolutionDateByKey', issue_key ).to_iso_date
139
134
  end
140
- deprecate :resolution_date_for_issue_with_key
141
135
 
142
136
  ##
143
137
  # This method acts like {#update_issue} except that it also updates
@@ -153,7 +147,7 @@ module JIRA::RemoteAPI
153
147
  # @return [JIRA::Issue]
154
148
  def progress_workflow_action issue_key, action_id, *field_values
155
149
  JIRA::Issue.new_with_xml jira_call('progressWorkflowAction',
156
- issue_key, action_id_string, field_values)
150
+ issue_key, action_id, field_values)
157
151
  end
158
152
 
159
153
  ##
@@ -164,6 +158,5 @@ module JIRA::RemoteAPI
164
158
  def available_actions issue_key
165
159
  array_jira_call JIRA::NamedEntity, 'getAvailableActions', issue_key
166
160
  end
167
- deprecate :available_actions
168
161
 
169
162
  end
@@ -6,14 +6,12 @@ module JIRA::RemoteAPI
6
6
  def project_roles
7
7
  array_jira_call JIRA::ProjectRole, 'getProjectRoles'
8
8
  end
9
- deprecate :project_roles
10
9
 
11
10
  # @param [String] role_id
12
11
  # @return [JIRA::ProjectRole]
13
12
  def project_role_with_id role_id
14
13
  JIRA::ProjectRole.new_with_xml jira_call( 'getProjectRole', role_id )
15
14
  end
16
- deprecate :project_role_with_id
17
15
 
18
16
  # @param [JIRA::ProjectRole] project_role
19
17
  # @return [JIRA::ProjectRole] the role that was created
@@ -12,14 +12,12 @@ module JIRA::RemoteAPI
12
12
  def project_with_key project_key
13
13
  JIRA::Project.new_with_xml jira_call( 'getProjectByKey', project_key )
14
14
  end
15
- deprecate :project_with_key
16
15
 
17
16
  # @param [String] project_id
18
17
  # @return [JIRA::Project]
19
18
  def project_with_id project_id
20
19
  JIRA::Project.new_with_xml jira_call( 'getProjectById', project_id )
21
20
  end
22
- deprecate :project_with_id
23
21
 
24
22
  ##
25
23
  # @todo Parse the permission scheme
@@ -30,7 +28,6 @@ module JIRA::RemoteAPI
30
28
  def project_including_schemes_with_id project_id
31
29
  JIRA::Project.new_with_xml jira_call( 'getProjectWithSchemesById', project_id )
32
30
  end
33
- deprecate :project_including_schemes_with_id
34
31
 
35
32
  ##
36
33
  # @note This will not fill in {JIRA::Scheme} data for the projects.
@@ -40,8 +37,6 @@ module JIRA::RemoteAPI
40
37
  array_jira_call JIRA::Project, 'getProjectsNoSchemes'
41
38
  end
42
39
  alias_method :projects_without_schemes, :projects
43
- deprecate :projects
44
- deprecate :projects_without_schemes
45
40
 
46
41
  ##
47
42
  # Requires you to set at least a project name, key, and lead.
@@ -6,12 +6,10 @@ module JIRA::RemoteAPI
6
6
  def notification_schemes
7
7
  array_jira_call JIRA::NotificationScheme, 'getNotificationSchemes'
8
8
  end
9
- deprecate :notification_schemes
10
9
 
11
10
  # @return [Array<JIRA::PermissionScheme>]
12
11
  def permission_schemes
13
12
  array_jira_call JIRA::PermissionScheme, 'getPermissionSchemes'
14
13
  end
15
- deprecate :permission_schemes
16
14
 
17
15
  end
@@ -9,12 +9,10 @@ module JIRA::RemoteAPI
9
9
  def server_info
10
10
  JIRA::ServerInfo.new_with_xml jira_call( 'getServerInfo' )
11
11
  end
12
- deprecate :server_info
13
12
 
14
13
  # @return [JIRA::ServerConfiguration]
15
14
  def server_configuration
16
15
  JIRA::ServerConfiguration.new_with_xml jira_call( 'getConfiguration' )
17
16
  end
18
- deprecate :server_configuration
19
17
 
20
18
  end
@@ -7,7 +7,6 @@ module JIRA::RemoteAPI
7
7
  def user_with_name user_name
8
8
  JIRA::User.new_with_xml jira_call( 'getUser', user_name )
9
9
  end
10
- deprecate :user_with_name
11
10
 
12
11
  ##
13
12
  # It seems that creating a user without any permission groups will trigger
@@ -39,7 +38,6 @@ module JIRA::RemoteAPI
39
38
  frag = jira_call 'getGroup', group_name
40
39
  JIRA::UserGroup.new_with_xml frag
41
40
  end
42
- deprecate :group_with_name
43
41
 
44
42
  # @param [JIRA::UserGroup] group
45
43
  # @param [JIRA::User] user
@@ -7,7 +7,6 @@ module JIRA::RemoteAPI
7
7
  def versions_for_project project_key
8
8
  array_jira_call JIRA::Version, 'getVersions', project_key
9
9
  end
10
- deprecate :versions_for_project
11
10
 
12
11
  ##
13
12
  # New versions cannot have the archived bit set and the release date
@@ -18,7 +18,7 @@ require 'jiraSOAP/entities/custom_field_value'
18
18
  require 'jiraSOAP/entities/avatar'
19
19
  require 'jiraSOAP/entities/comment'
20
20
  require 'jiraSOAP/entities/version'
21
- require 'jiraSOAP/entities/attachment_metadata'
21
+ require 'jiraSOAP/entities/attachment'
22
22
 
23
23
  require 'jiraSOAP/entities/scheme'
24
24
  require 'jiraSOAP/entities/notification_scheme'
@@ -0,0 +1,59 @@
1
+ ##
2
+ # Only contains the metadata for an attachment. The URI for an attachment
3
+ # appears to be of the form
4
+ # "{JIRA::JIRAService.endpoint_url}/secure/attachment/{#id}/{#file_name}".
5
+ class JIRA::Attachment < JIRA::NamedEntity
6
+
7
+ # @return [String]
8
+ add_attribute :author, 'author', :content
9
+
10
+ # @return [String]
11
+ add_attribute :file_name, 'filename', :content
12
+ alias_method :filename, :file_name
13
+ alias_method :filename=, :file_name=
14
+
15
+ # @return [String]
16
+ add_attribute :file_name, 'filename', :content
17
+
18
+ ##
19
+ # @note This method does not allow you to read the content of an existing
20
+ # attachment on the issue; only the metadata for the attachment may
21
+ # be read at this time.
22
+ #
23
+ # Content to be used for adding attachments, using
24
+ # {RemoteAPI#add_attachments_to_issue_with_key}. Do _not_ base64 encode
25
+ # the data yourself, it will be done for you when the attachment is
26
+ # uploaded.
27
+ #
28
+ # However, attachment data coming from the server will come down in base64
29
+ # encoded format...
30
+ #
31
+ # @return [String]
32
+ attr_accessor :content
33
+
34
+ # @return [String]
35
+ add_attribute :mime_type, 'mimetype', :content
36
+ alias_method :content_type, :mime_type
37
+ alias_method :content_type=, :mime_type=
38
+
39
+ ##
40
+ # Measured in bytes
41
+ #
42
+ # @return [Number]
43
+ add_attribute :file_size, 'filesize', :to_i
44
+
45
+ # @return [Time]
46
+ add_attribute :create_time, 'created', :to_iso_date
47
+
48
+ ##
49
+ # Fetch the attachment from the server.
50
+ def attachment
51
+ raise NotImplementedError, 'Please implement me. :('
52
+ end
53
+ end
54
+
55
+ ##
56
+ # @deprecated This is just an alias, please use {JIRA::Attachment} instead
57
+ #
58
+ # Just an alias for {JIRA::Attachment}.
59
+ JIRA::AttachmentMetadata = JIRA::Attachment
@@ -4,7 +4,7 @@
4
4
  # @todo Add attributes for the comments and the attachment metadata
5
5
  #
6
6
  # Contains most of the data and metadata for a JIRA issue, but does
7
- # not contain the {JIRA::Comment}s or {JIRA::AttachmentMetadata}.
7
+ # not contain the {JIRA::Comment}s or {JIRA::Attachment}s.
8
8
  #
9
9
  # This class is easily the most convoluted structure in the API, and will
10
10
  # likely be the greatest source of bugs. The irony of the situation is that
@@ -27,11 +27,3 @@ class Handsoap::XmlMason::Node
27
27
  array.each { |element| element.soapify_for node, name }
28
28
  end
29
29
  end
30
-
31
- ##
32
- # Monkey patch to expose the underlying Nokogiri object as jiraSOAP
33
- # can parse much faster without the Handsoap layer in between.
34
- class Handsoap::XmlQueryFront::NokogiriDriver
35
- # @return [Nokogiri::XML::Element]
36
- attr_reader :element
37
- end
@@ -13,7 +13,7 @@ class JIRA::JIRAService < Handsoap::Service
13
13
  include JIRA::RemoteAPIAdditions
14
14
 
15
15
  # @return [String]
16
- attr_accessor :auth_token
16
+ attr_reader :auth_token
17
17
 
18
18
  # @return [String]
19
19
  attr_reader :user
@@ -21,6 +21,16 @@ class JIRA::JIRAService < Handsoap::Service
21
21
  # @return [String]
22
22
  attr_reader :endpoint_url
23
23
 
24
+ class << self
25
+ ##
26
+ # Expose endpoint URL
27
+ #
28
+ # @return [String]
29
+ def endpoint_url
30
+ @@endpoint_url
31
+ end
32
+ end
33
+
24
34
  ##
25
35
  # Initialize _and_ log in. Fancy.
26
36
  #
@@ -36,7 +46,7 @@ class JIRA::JIRAService < Handsoap::Service
36
46
 
37
47
  # @param [String,URI::HTTP,NSURL] endpoint for the JIRA server
38
48
  def initialize endpoint
39
- @endpoint_url = endpoint.to_s
49
+ @@endpoint_url = @endpoint_url = endpoint.to_s
40
50
  self.class.endpoint({
41
51
  uri:"#{endpoint_url}/rpc/soap/jirasoapservice-v2",
42
52
  version:2
@@ -1,4 +1,4 @@
1
1
  module JIRA
2
2
  # @return [String]
3
- VERSION = '0.9.2'
3
+ VERSION = '0.10.0'
4
4
  end
@@ -0,0 +1,203 @@
1
+ require 'base64'
2
+
3
+ # @note These tests will bloat up your server after a while
4
+ class TestAddAttachmentsToIssueWithKey < MiniTest::Unit::TestCase
5
+ setup_usual
6
+
7
+ def key
8
+ 'JIRA-1'
9
+ end
10
+
11
+ def image1
12
+ @image1 ||= "switcheroo-#{Time.now.to_f}.rb"
13
+ end
14
+
15
+ def image2
16
+ @image2 ||= "colemak-#{Time.now.to_f}.png"
17
+ end
18
+
19
+ def attachment1
20
+ @attachment ||= JIRA::Attachment.new.tap do |x|
21
+ x.content = File.read(File.join(File.dirname(__FILE__), '..', 'Rakefile'))
22
+ x.file_name = "Rakefile-#{Time.now.to_f}"
23
+ end
24
+ end
25
+
26
+ def attachment2
27
+ @attachment ||= JIRA::Attachment.new.tap do |x|
28
+ x.content = File.read(File.join(File.dirname(__FILE__), '..', 'jiraSOAP.gemspec'))
29
+ x.file_name = "Rakefile-#{Time.now.to_f}"
30
+ end
31
+ end
32
+
33
+ def test_returns_true
34
+ assert_equal true,
35
+ db.add_attachments_to_issue_with_key(key, attachment1)
36
+ end
37
+
38
+ def test_attachment_data_is_unaltered # for some definition of unaltered
39
+ skip 'Need to implement the method for getting attachments first'
40
+ end
41
+
42
+ def test_add_one_attachment
43
+ db.add_attachments_to_issue_with_key key, attachment1
44
+ issue = db.issue_with_key key
45
+ refute_nil issue.attachment_names.find { |x| x == attachment1.file_name }
46
+ end
47
+
48
+ def test_add_two_attachments
49
+ db.add_attachments_to_issue_with_key key, attachment1, attachment2
50
+ issue = db.issue_with_key key
51
+ refute_nil issue.attachment_names.find { |x| x == attachment1.file_name }
52
+ refute_nil issue.attachment_names.find { |x| x == attachment2.file_name }
53
+ end
54
+
55
+ def test_returns_true_base64
56
+ assert_equal true,
57
+ db.add_base64_encoded_attachments_to_issue_with_key(key,
58
+ [image1],
59
+ [switcheroo])
60
+ end
61
+
62
+ def test_add_one_attachment_base64
63
+ db.add_base64_encoded_attachments_to_issue_with_key(key,
64
+ [image1],
65
+ [switcheroo])
66
+ issue = db.issue_with_key key
67
+ refute_nil issue.attachment_names.find { |x| x == image1 }
68
+ end
69
+
70
+ def test_add_two_attachments_base64
71
+ db.add_base64_encoded_attachments_to_issue_with_key(key,
72
+ [image1, image2],
73
+ [switcheroo, colemak])
74
+ issue = db.issue_with_key key
75
+ refute_nil issue.attachment_names.find { |x| x == image1 }
76
+ refute_nil issue.attachment_names.find { |x| x == image2 }
77
+ end
78
+
79
+ def switcheroo
80
+ <<-EOF
81
+ IyEvdXNyL2Jpbi9lbnYgbWFjcnVieQoKZmlsZSA9IElPLnJlYWQoJ0xvY2FsaXphYmxlLnR4dCcp
82
+ LnNwbGl0KC9cbi8pLnNlbGVjdCB7IHxsaW5lfCAhbGluZS5tYXRjaCgvOyQvKS5uaWw/IH0uZWFj
83
+ aCB7IHxsaW5lfAogIG1hZ2ljID0gbGluZS5tYXRjaCAvIiguKykiXHMrPVxzKyIoLispIjsvdQoK
84
+ ICBwdXRzIDw8RU9GCiAgICAgICA8ZGljdD4KICAgICAgICAgICAgICAgPGtleT5DcmVhdGVEYXRl
85
+ PC9rZXk+CiAgICAgICAgICAgICAgIDxyZWFsPjEuMDwvcmVhbD4KICAgICAgICAgICAgICAgPGtl
86
+ eT5LZXk8L2tleT4KICAgICAgICAgICAgICAgPHN0cmluZz4jeyQxfTwvc3RyaW5nPgogICAgICAg
87
+ ICAgICAgICA8a2V5PlZhbHVlPC9rZXk+CiAgICAgICAgICAgICAgIDxzdHJpbmc+I3skMn08L3N0
88
+ cmluZz4KICAgICAgIDwvZGljdD4KRU9GCn0K
89
+ EOF
90
+ end
91
+
92
+ def colemak
93
+ <<-EOF
94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'jiraSOAP'
2
+
3
+ require 'rubygems'
4
+ gem 'minitest', '~> 2.5'
5
+ require 'minitest/autorun'
6
+ require 'minitest/pride'
7
+
8
+ class MiniTest::Unit::TestCase
9
+
10
+ def user
11
+ 'marada'
12
+ end
13
+
14
+ def password
15
+ 'test'
16
+ end
17
+
18
+ def host
19
+ 'http://169.254.199.62:8080'
20
+ end
21
+
22
+ def db
23
+ @db ||= JIRA::JIRAService.new host
24
+ end
25
+
26
+ def self.setup_usual
27
+ define_method :setup do
28
+ db.login user, password
29
+ end
30
+ end
31
+
32
+ def teardown
33
+ db.logout
34
+ end
35
+
36
+ def assert_instance_of_boolean value, msg = nil
37
+ if value == true || value == false
38
+ assert true
39
+ else
40
+ msg = "Expected #{mu_pp(value)} to be a boolean" unless msg
41
+ assert false, msg
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+
48
+ basic = ['login_test', 'logout_test']
49
+ create = ['attachments_test']
50
+ read = basic + []
51
+ update = []
52
+ delete = []
53
+ all = basic + create + read + update + delete
54
+
55
+ # Look at environment variables to decide which tests to run
56
+ tests = case ENV['JIRASOAP']
57
+ when 'all' then all
58
+ when 'basic' then basic
59
+ when 'create' then create
60
+ when 'read' then read
61
+ when 'update' then update
62
+ when 'delete' then delete
63
+ else read # hmm, for safeties sake, but maybe it should be all...
64
+ end
65
+ tests.each do |test| require test end
@@ -0,0 +1,21 @@
1
+ class TestLogin < MiniTest::Unit::TestCase
2
+
3
+ def test_returns_token
4
+ assert_match /^[a-zA-Z0-9]+$/, db.login(user, password)
5
+ end
6
+
7
+ def test_caches_the_token
8
+ db.login(user, password)
9
+ assert_match /^[a-zA-Z0-9]+$/, db.auth_token
10
+ end
11
+
12
+ def test_caches_the_user
13
+ db.login(user, password)
14
+ assert_equal user, db.instance_variable_get(:@user)
15
+ end
16
+
17
+ def test_aliased
18
+ assert_equal db.method(:login), db.method(:log_in)
19
+ end
20
+
21
+ end
@@ -0,0 +1,30 @@
1
+ class TestLogout < MiniTest::Unit::TestCase
2
+ setup_usual
3
+
4
+ def test_normal
5
+ db.login user, password
6
+ assert db.logout
7
+ end
8
+
9
+ def test_no_session
10
+ # strongly assert is false, not nil
11
+ db.logout
12
+ assert_equal false, db.logout
13
+ end
14
+
15
+ def test_unsets_cached_attributes
16
+ db.login user, password
17
+ db.logout
18
+ assert_nil db.instance_variable_get(:@user)
19
+ assert_nil db.auth_token
20
+ end
21
+
22
+ def test_aliased
23
+ assert_equal db.method(:logout), db.method(:log_out)
24
+ end
25
+
26
+ # override since we logout during the test
27
+ def teardown
28
+ end
29
+
30
+ end
@@ -0,0 +1,25 @@
1
+ class TestProgressWorkflowAction < MiniTest::Unit::TestCase
2
+ setup_usual
3
+
4
+ def key
5
+ 'JIRA-1'
6
+ end
7
+
8
+ def test_progress_only
9
+ action = jira.available_actions(key).find do |action|
10
+ action.name == 'Close Issue'
11
+ end
12
+ db.progress_workflow_action key, action.id
13
+
14
+ action = jira.available_actions(key).find do |action|
15
+ action.name == 'Reopen Issue'
16
+ end
17
+ db.progress_workflow_action key, action.id
18
+ end
19
+
20
+ # def test_progress_and_update_field
21
+ # assignee = JIRA::FieldValue.new 'assignee', 'mrada'
22
+ # jira.progress_workflow_action 'TST-14', action.id, assignee
23
+ # end
24
+
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jiraSOAP
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-20 00:00:00.000000000 Z
12
+ date: 2011-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &70093685999780 !ruby/object:Gem::Requirement
16
+ requirement: &70273483161760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.5.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70093685999780
24
+ version_requirements: *70273483161760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: handsoap
27
- requirement: &70093686013700 !ruby/object:Gem::Requirement
27
+ requirement: &70273483161180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.8
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70093686013700
35
+ version_requirements: *70273483161180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &70093686011780 !ruby/object:Gem::Requirement
38
+ requirement: &70273483160560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.7.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70093686011780
46
+ version_requirements: *70273483160560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: redcarpet
49
- requirement: &70093686008040 !ruby/object:Gem::Requirement
49
+ requirement: &70273483160040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,18 +54,18 @@ dependencies:
54
54
  version: '1.17'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70093686008040
57
+ version_requirements: *70273483160040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: minitest
60
- requirement: &70093686022720 !ruby/object:Gem::Requirement
60
+ requirement: &70273483159100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 2.3.1
65
+ version: '2.5'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70093686022720
68
+ version_requirements: *70273483159100
69
69
  description: Written to run fast and work on Ruby 1.9 as well as MacRuby
70
70
  email:
71
71
  - markrada26@gmail.com
@@ -82,6 +82,7 @@ files:
82
82
  - lib/jiraSOAP/api/attachments.rb
83
83
  - lib/jiraSOAP/api/avatars.rb
84
84
  - lib/jiraSOAP/api/comments.rb
85
+ - lib/jiraSOAP/api/components.rb
85
86
  - lib/jiraSOAP/api/filters.rb
86
87
  - lib/jiraSOAP/api/issue_data_types.rb
87
88
  - lib/jiraSOAP/api/issues.rb
@@ -94,7 +95,7 @@ files:
94
95
  - lib/jiraSOAP/api/worklog.rb
95
96
  - lib/jiraSOAP/api.rb
96
97
  - lib/jiraSOAP/core_extensions.rb
97
- - lib/jiraSOAP/entities/attachment_metadata.rb
98
+ - lib/jiraSOAP/entities/attachment.rb
98
99
  - lib/jiraSOAP/entities/avatar.rb
99
100
  - lib/jiraSOAP/entities/comment.rb
100
101
  - lib/jiraSOAP/entities/component.rb
@@ -138,8 +139,11 @@ files:
138
139
  - lib/jiraSOAP.rb
139
140
  - .yardopts
140
141
  - Rakefile
141
- - test/jiraSOAP_test.rb
142
- - test/test_helper.rb
142
+ - test/attachments_test.rb
143
+ - test/helper.rb
144
+ - test/login_test.rb
145
+ - test/logout_test.rb
146
+ - test/progress_workflow_action_test.rb
143
147
  - README.markdown
144
148
  - ChangeLog
145
149
  - LICENSE.txt
@@ -166,10 +170,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
170
  version: '0'
167
171
  requirements: []
168
172
  rubyforge_project:
169
- rubygems_version: 1.8.6
173
+ rubygems_version: 1.8.5
170
174
  signing_key:
171
175
  specification_version: 3
172
176
  summary: A Ruby client for the JIRA SOAP API
173
177
  test_files:
174
- - test/jiraSOAP_test.rb
175
- - test/test_helper.rb
178
+ - test/attachments_test.rb
179
+ - test/helper.rb
180
+ - test/login_test.rb
181
+ - test/logout_test.rb
182
+ - test/progress_workflow_action_test.rb
@@ -1,35 +0,0 @@
1
- ##
2
- # Only contains the metadata for an attachment. The URI for an attachment
3
- # appears to be of the form
4
- # "{JIRA::JIRAService.endpoint_url}/secure/attachment/{#id}/{#file_name}"
5
- class JIRA::AttachmentMetadata < JIRA::NamedEntity
6
-
7
- # @return [String]
8
- add_attribute :author, 'author', :content
9
-
10
- # @return [String]
11
- add_attribute :file_name, 'filename', :content
12
- alias_method :filename, :file_name
13
- alias_method :filename=, :file_name=
14
-
15
- # @return [String]
16
- add_attribute :mime_type, 'mimetype', :content
17
- alias_method :content_type, :mime_type
18
- alias_method :content_type=, :mime_type=
19
-
20
- ##
21
- # Measured in bytes
22
- #
23
- # @return [Number]
24
- add_attribute :file_size, 'filesize', :to_i
25
-
26
- # @return [Time]
27
- add_attribute :create_time, 'created', :to_iso_date
28
-
29
- ##
30
- # Fetch the attachment from the server.
31
- def attachment
32
- raise NotImplementedError, 'Please implement me. :('
33
- end
34
-
35
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class JirasoapTest < Mini::Test::TestCase
4
- def test_something_for_real
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end
data/test/test_helper.rb DELETED
@@ -1,11 +0,0 @@
1
- require 'rubygems'
2
- require 'mini/test'
3
-
4
- $LOAD_PATH.unshift(File.dirname(__FILE__))
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- require 'jiraSOAP'
7
-
8
- class Mini::Test::TestCase
9
- end
10
-
11
- Mini::Test.autorun