Class: JiraGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/handlers/jira_gateway.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http, config) ⇒ JiraGateway

Returns a new instance of JiraGateway.



5
6
7
8
# File 'lib/lita/handlers/jira_gateway.rb', line 5

def initialize(http, config)
  @http = http
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/lita/handlers/jira_gateway.rb', line 3

def config
  @config
end

#httpObject (readonly)

Returns the value of attribute http.



3
4
5
# File 'lib/lita/handlers/jira_gateway.rb', line 3

def http
  @http
end

Instance Method Details

#data_for_issue(key) ⇒ Object



10
11
12
13
14
15
# File 'lib/lita/handlers/jira_gateway.rb', line 10

def data_for_issue(key)
  http.basic_auth(config.username, config.password)
  response = http.get(config.url + '/rest/api/2/issue/' + key)
  return MultiJson.load(response.body, symbolize_keys: true) if response.success?
  {}
end