Class: Gitgut::Jira::Request
- Inherits:
-
Object
- Object
- Gitgut::Jira::Request
- Defined in:
- lib/gitgut/jira.rb
Overview
Wrapper around a JQL query for JIR
Constant Summary collapse
- DEFAULT_OPTIONS =
{ headers: { 'Content-Type' => 'application/json' } }.freeze
- JQL_PARAM_NAME =
'jql'.freeze
Instance Method Summary collapse
- #auth_options ⇒ Object
-
#initialize(query) ⇒ Request
constructor
A new instance of Request.
-
#perform! ⇒ Object
TODO: Maybe use a flag like performed? and store the response in an attr_reader.
- #url ⇒ Object
Constructor Details
#initialize(query) ⇒ Request
Returns a new instance of Request.
83 84 85 |
# File 'lib/gitgut/jira.rb', line 83 def initialize(query) @query = query end |
Instance Method Details
#auth_options ⇒ Object
102 103 104 105 106 107 |
# File 'lib/gitgut/jira.rb', line 102 def { username: Settings.jira.username, password: Settings.jira.password } end |
#perform! ⇒ Object
TODO: Maybe use a flag like performed? and store the response in an attr_reader
89 90 91 92 93 94 |
# File 'lib/gitgut/jira.rb', line 89 def perform! = DEFAULT_OPTIONS.merge( basic_auth: ) HTTParty.get(url, ) end |
#url ⇒ Object
96 97 98 99 100 |
# File 'lib/gitgut/jira.rb', line 96 def url url = URI.parse(Settings.jira.endpoint) url.query = "#{JQL_PARAM_NAME}=#{URI.escape(@query)}" url end |