Class: JIRA::JIRAService

Inherits:
Handsoap::Service
  • Object
show all
Includes:
RemoteAPI, RemoteAPIAdditions
Defined in:
lib/jiraSOAP/jira_service.rb

Overview

Note:

HTTPS is not supported out of the box in this version.

Interface to the JIRA endpoint server.

Due to limitations in Handsoap::Service, there can only be one endpoint. You can have multiple instances of that one endpoint if you would like (different users); but if you try to set a differnt endpoint for a new instance you will end up messing up any other instances currently being used.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RemoteAPIAdditions

#custom_field_with_name

Methods included from RemoteAPI

#add_attachments_to_issue_with_key, #add_base64_encoded_attachments_to_issue_with_key, #add_comment_to_issue_with_key, #add_user_to_group, #add_version_to_project_with_key, #add_worklog_and_auto_adjust_remaining_estimate, #attachments_for_issue_with_key, #available_actions, #comment_with_id, #comments_for_issue_with_key, #components_for_project_with_key, #create_issue_with_issue, #create_issue_with_issue_and_parent, #create_project_role_with_role, #create_project_with_project, #create_user, #create_user_group, #custom_fields, #delete_project_avatar_with_id, #delete_project_role, #delete_project_with_key, #delete_user_group, #delete_user_with_name, #favourite_filters, #group_with_name, #issue_count_for_filter_with_id, #issue_types, #issue_types_for_project_with_id, #issue_with_id, #issue_with_key, #issues_from_filter_with_id, #issues_from_jql_search, #login, #logout, #notification_schemes, #permission_schemes, #permission_to_edit_comment?, #priorities, #progress_workflow_action, #project_avatar_for_key, #project_avatars_for_key, #project_including_schemes_with_id, #project_role_name_unique?, #project_role_with_id, #project_roles, #project_with_id, #project_with_key, #projects, #refresh_custom_fields, #release_state_for_version_for_project, #remove_user_from_group, #resolution_date_for_issue_with_id, #resolution_date_for_issue_with_key, #resolutions, #server_configuration, #server_info, #set_archive_state_for_version_for_project, #set_new_project_avatar_for_project_with_key, #set_project_avatar_for_project_with_key, #statuses, #subtask_issue_types, #subtask_issue_types_for_project_with_id, #update_comment, #update_issue, #update_project_role_with_role, #update_project_with_project, #user_with_name, #versions_for_project

Constructor Details

#initialize(endpoint) ⇒ JIRAService

Returns a new instance of JIRAService.

Parameters:

  • endpoint (String, URI::HTTP, NSURL)

    for the JIRA server



63
64
65
66
67
68
69
# File 'lib/jiraSOAP/jira_service.rb', line 63

def initialize endpoint
  @@endpoint_url = @endpoint_url = endpoint.to_s
  self.class.endpoint({
    :uri => "#{endpoint_url}/rpc/soap/jirasoapservice-v2",
    :version => 2
  })
end

Instance Attribute Details

#auth_tokenString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/jiraSOAP/jira_service.rb', line 16

def auth_token
  @auth_token
end

#endpoint_urlString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/jiraSOAP/jira_service.rb', line 22

def endpoint_url
  @endpoint_url
end

#userString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/jiraSOAP/jira_service.rb', line 19

def user
  @user
end

Class Method Details

.endpoint_urlString

Expose endpoint URL

Returns:

  • (String)


29
30
31
# File 'lib/jiraSOAP/jira_service.rb', line 29

def endpoint_url
  @@endpoint_url
end

.instance_with_endpoint(url, user, password) ⇒ JIRA::JIRAService

Initialize and log in. Fancy.

Parameters:

  • url (String, URI::HTTP, NSURL)

    URL for the JIRA server

  • user (String)

    JIRA user name to login with

  • password (String)

Returns:



41
42
43
44
45
# File 'lib/jiraSOAP/jira_service.rb', line 41

def self.instance_with_endpoint url, user, password
  jira = JIRA::JIRAService.new url
  jira. user, password
  jira
end

.instance_with_token(url, user, token) ⇒ JIRA::JIRAService

Create an instance with an existing authorization token. In cases where you have cached the auth token elsewhere, you can avoid having to login again by initializing the instance with the token.

Parameters:

  • url (String, URI::HTTP, NSURL)
  • user (String)
  • token (String)

Returns:



56
57
58
59
60
# File 'lib/jiraSOAP/jira_service.rb', line 56

def self.instance_with_token url, user, token
  obj = allocate
  obj.initialize_with_token url, user, token
  obj
end

Instance Method Details

#initialize_with_token(endpoint, user, token) ⇒ Object

Special constructor meant for

Parameters:

  • endpoint (String, URI::HTTP, NSURL)
  • user (String)
  • token (String)


77
78
79
80
81
# File 'lib/jiraSOAP/jira_service.rb', line 77

def initialize_with_token endpoint, user, token
  initialize endpoint
  @user       = user
  @auth_token = token
end

#on_create_document(doc) ⇒ Object (protected)

Makes sure the correct namespace is set



88
89
90
# File 'lib/jiraSOAP/jira_service.rb', line 88

def on_create_document doc
  doc.alias 'soap', 'http://soap.rpc.jira.atlassian.com'
end

#on_response_document(doc) ⇒ Object (protected)

Make sure that the required namespace is added



94
95
96
# File 'lib/jiraSOAP/jira_service.rb', line 94

def on_response_document doc
  doc.add_namespace 'jir', @endpoint_url
end