Module: RedmineTicketClient

Defined in:
lib/redmine-ticket/client.rb

Defined Under Namespace

Classes: Sender

Constant Summary collapse

VERSION =
'0.2.2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hostObject

The host to connect to.



21
22
23
# File 'lib/redmine-ticket/client.rb', line 21

def host
  @host
end

.http_open_timeoutObject

The HTTP open timeout (defaults to 2 seconds).



26
27
28
# File 'lib/redmine-ticket/client.rb', line 26

def http_open_timeout
  @http_open_timeout
end

.http_read_timeoutObject

The HTTP read timeout (defaults to 5 seconds).



31
32
33
# File 'lib/redmine-ticket/client.rb', line 31

def http_read_timeout
  @http_read_timeout
end

.paramsObject

Returns the value of attribute params.



12
13
14
# File 'lib/redmine-ticket/client.rb', line 12

def params
  @params
end

.portObject

The port on which your Redmine server runs.



16
17
18
# File 'lib/redmine-ticket/client.rb', line 16

def port
  @port
end

.proxy_hostObject

Returns the value of attribute proxy_host.



12
13
14
# File 'lib/redmine-ticket/client.rb', line 12

def proxy_host
  @proxy_host
end

.proxy_passObject

Returns the value of attribute proxy_pass.



12
13
14
# File 'lib/redmine-ticket/client.rb', line 12

def proxy_pass
  @proxy_pass
end

.proxy_portObject

Returns the value of attribute proxy_port.



12
13
14
# File 'lib/redmine-ticket/client.rb', line 12

def proxy_port
  @proxy_port
end

.proxy_userObject

Returns the value of attribute proxy_user.



12
13
14
# File 'lib/redmine-ticket/client.rb', line 12

def proxy_user
  @proxy_user
end

.secureObject

Returns the value of attribute secure.



12
13
14
# File 'lib/redmine-ticket/client.rb', line 12

def secure
  @secure
end

Class Method Details

.configure {|_self| ... } ⇒ Object

NOTE: secure connections are not yet supported.

Yields:

  • (_self)

Yield Parameters:



36
37
38
# File 'lib/redmine-ticket/client.rb', line 36

def configure
  yield self
end

.default_request_paramsObject



58
59
60
# File 'lib/redmine-ticket/client.rb', line 58

def default_request_params
  {}.merge RedmineTicketClient.params
end

.default_ticket_optionsObject

:nodoc:



48
49
50
51
52
53
54
55
56
# File 'lib/redmine-ticket/client.rb', line 48

def default_ticket_options #:nodoc:
  {
    :params       => RedmineTicketClient.params,
    :error_message => 'Notification',
    :request       => {},
    :session       => {},
    :environment   => ENV.to_hash
  }
end

.issue_statusObject



66
67
68
# File 'lib/redmine-ticket/client.rb', line 66

def issue_status
  RestClient.post("#{protocol}://#{host}:#{port}/ticket_server/issue_status", :api_key => default_request_params[:api_key], :issue_id => default_request_params[:issue_id])
end

.issuesObject



69
70
71
# File 'lib/redmine-ticket/client.rb', line 69

def issues
  RestClient.post("#{protocol}://#{host}:#{port}/ticket_server/issues", :api_key => default_request_params[:api_key], :issue_id => default_request_params[:issue_id])
end

.journalsObject



75
76
77
# File 'lib/redmine-ticket/client.rb', line 75

def journals 
  RestClient.post("#{protocol}://#{host}:#{port}/ticket_server/journals", :api_key => default_request_params[:api_key], :issue_id => default_request_params[:issue_id])
end

.post_ticketObject



62
63
64
# File 'lib/redmine-ticket/client.rb', line 62

def post_ticket
  Sender.new.post_to_redmine( default_ticket_options )
end

.projectsObject



72
73
74
# File 'lib/redmine-ticket/client.rb', line 72

def projects 
  RestClient.post("#{protocol}://#{host}:#{port}/ticket_server/projects", :api_key => default_request_params[:api_key], :issue_id => default_request_params[:issue_id])
end

.protocolObject

:nodoc:



40
41
42
# File 'lib/redmine-ticket/client.rb', line 40

def protocol #:nodoc:
  secure ? "https" : "http"
end

.urlObject

:nodoc:



44
45
46
# File 'lib/redmine-ticket/client.rb', line 44

def url #:nodoc:
  URI.parse("#{protocol}://#{host}:#{port}/ticket_server/")
end