Class: JIRA::JwtClient::JwtUriBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/jira/jwt_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_url, http_method, shared_secret, site, issuer) ⇒ JwtUriBuilder

Returns a new instance of JwtUriBuilder.



20
21
22
23
24
25
26
# File 'lib/jira/jwt_client.rb', line 20

def initialize(request_url, http_method, shared_secret, site, issuer)
  @request_url = request_url
  @http_method = http_method
  @shared_secret = shared_secret
  @site = site
  @issuer = issuer
end

Instance Attribute Details

#http_methodObject (readonly)

Returns the value of attribute http_method.



18
19
20
# File 'lib/jira/jwt_client.rb', line 18

def http_method
  @http_method
end

#issuerObject (readonly)

Returns the value of attribute issuer.



18
19
20
# File 'lib/jira/jwt_client.rb', line 18

def issuer
  @issuer
end

#request_urlObject (readonly)

Returns the value of attribute request_url.



18
19
20
# File 'lib/jira/jwt_client.rb', line 18

def request_url
  @request_url
end

#shared_secretObject (readonly)

Returns the value of attribute shared_secret.



18
19
20
# File 'lib/jira/jwt_client.rb', line 18

def shared_secret
  @shared_secret
end

#siteObject (readonly)

Returns the value of attribute site.



18
19
20
# File 'lib/jira/jwt_client.rb', line 18

def site
  @site
end

Instance Method Details

#buildObject



28
29
30
31
32
33
34
35
36
# File 'lib/jira/jwt_client.rb', line 28

def build
  uri = URI.parse(request_url)
  new_query = URI.decode_www_form(String(uri.query)) << ['jwt', jwt_header]
  uri.query = URI.encode_www_form(new_query)

  return uri.to_s unless uri.is_a?(URI::HTTP)

  uri.request_uri
end