createissue_jira 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d218c86c1ea84edea27cb5d617a99d80bb7ea225487b1c4883beeff9dc8d5a3c
4
- data.tar.gz: 87da6386ff118dc7a4efd3083c488b3c0656d7364ee3ee4986d35e4b133a16b4
3
+ metadata.gz: 8ddd1e79a3d28d6bf5e20cf3e9717d4c016017992d02060e474db6555568c54c
4
+ data.tar.gz: 1a739441f44a43cbe88be50dc6e569e16ab1f49ed607ee4eabeb75aebf96393e
5
5
  SHA512:
6
- metadata.gz: 0f13a3acd51054fd749f7f4cfbf952f4f030ca87c74c6eba35c8be7cc9e1cccc9a210581c2b52aad2083fe642f008b917c3a2272499a874a852e53127d06501f
7
- data.tar.gz: de400be7b4186299d7376063bfcccba840652eb0e4bb1bd05c81b0f1b0af7987f4e92a0813e2af62db522af899e86c871e5fadda62438d977396085908302f0f
6
+ metadata.gz: 4ac7fafe471865de2b2c2338834f3b046ae47884a6b8a607f77cf49bf8ab179aaa8eec47c139dd46636e21e8bcaa4cb874cf32dc9f61f033c8c2884cc0c8fbc7
7
+ data.tar.gz: 38c98832b2570f6e40e44692f4902e2f9c46ef4111887158280fd9f1ba76fa58df4f7afc887129793879ac56a7a2a09f5d6d769ea7f886c21a4d35b7452ba382
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- createissue_jira (0.1.8)
4
+ createissue_jira (0.1.9)
5
5
  base64 (~> 0.1, >= 0.1.0)
6
6
  json (~> 2.1, >= 2.1.0)
7
7
  rest-client (~> 2.0, >= 2.0.2)
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/createissue_jira/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "createissue_jira"
7
+ spec.version = CreateissueJira::VERSION
8
+ spec.authors = ["SachinPatel"]
9
+ spec.email = ["sachinpatel8890@outlook.com"]
10
+
11
+ spec.summary = "This gem can be use to create a jira ticket specifically for the QA test case under Jira Epic"
12
+ spec.description = "Write a longer description or delete this line."
13
+ spec.homepage = "https://github.com/Sachin8890/createissue_jira"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.5.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/Sachin8890/createissue_jira"
21
+ spec.metadata["changelog_uri"] = "https://rubygems.org"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+ spec.add_runtime_dependency 'rest-client', '~> 2.0', '>=2.0.2'
37
+ spec.add_runtime_dependency 'json', '~> 2.1', '>=2.1.0'
38
+ spec.add_runtime_dependency 'roo', '~> 2.8', '>=2.8.3'
39
+ spec.add_runtime_dependency 'base64', '~> 0.1', '>=0.1.0'
40
+
41
+
42
+ # For more information and examples about making a new gem, check out our
43
+ # guide at: https://bundler.io/guides/creating_gem.html
44
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CreateissueJira
4
- VERSION = "0.1.9"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -8,11 +8,12 @@ require 'roo'
8
8
 
9
9
  module CreateissueJira
10
10
  class Datafile
11
- def jira_api_credentials base_url, jira_api_token, assignee_id, acceptance_criteria_id
11
+ def jira_api_credentials email,base_url, jira_api_token, assignee_id, acceptance_criteria_id
12
12
  @base_url = base_url
13
13
  @jira_api_token = jira_api_token
14
14
  @assignee_id = assignee_id
15
15
  @acceptance_criteria_id = acceptance_criteria_id
16
+ @email = email
16
17
  end
17
18
 
18
19
  def load_file (file_path, sheet_no, header_name)
@@ -60,72 +61,73 @@ module CreateissueJira
60
61
  i = 0
61
62
  @summary.size.times do
62
63
  payload = {
63
- "fields":
64
+ "fields":
65
+ {
66
+ "project":
67
+ {
68
+ "key": project_key
69
+ },
70
+ "parent":
71
+ {
72
+ "key": epic_key
73
+ },
74
+ "summary": @summary[i],
75
+ "description": @description[i],
76
+
77
+ "issuetype":
64
78
  {
65
- "project":
66
- {
67
- "key": project_key
68
- },
69
- "parent":
70
- {
71
- "key": epic_key
72
- },
73
- "summary": @summary[i],
74
- "description": @description[i],
75
-
76
- "issuetype":
77
- {
78
- "name": "Story"
79
- },
80
- "#{@acceptance_criteria_id}": @business_acceptance[i],
81
- "labels": [
82
- label
83
- ]
84
- }
79
+ "name": "Story"
80
+ },
81
+ "#{@acceptance_criteria_id}": @business_acceptance[i],
82
+ "labels": [
83
+ label
84
+ ]
85
+ }
85
86
  }
86
87
 
88
+ #2022 - atlassian - jira password updated with api token
89
+ @auth = "Basic #{Base64.strict_encode64("#{@email + ":" + @jira_api_token}")}"
90
+
87
91
  response = RestClient.post(
88
- "#{@base_url}/rest/api/2/issue/",
89
- payload.to_json,
90
- headers = {
91
- content_type: :json,
92
- :Authorization => "Basic #{@jira_api_token}"
93
- }
92
+ "#{@base_url}/rest/api/2/issue/",
93
+ payload.to_json,
94
+ headers = {
95
+ content_type: :json,
96
+ :Authorization => @auth
97
+ }
94
98
  )
95
99
 
96
- #extract the key
100
+ # extract the key
97
101
  @response = JSON.parse response.gsub(':', ':')
98
102
  @issue_key = @response["key"]
99
103
 
100
-
101
- #Assign the issue to someone
102
- #get the assignee id - by clicking on profile link : which will something like
104
+ # Assign the issue to someone
105
+ # get the assignee id - by clicking on profile link : which will something like
103
106
  # https://abcperson.atlassian.net/jira/people/67gv54hmnj8798ujhhu
104
107
  # After - people what is there is the acount id :
105
108
 
106
- #request - put
109
+ # request - put
107
110
  # endpoint : https://abcperson.atlassian.net/rest/api/2/issue/Issue-ID/assignee
108
111
  # body : {"accountID" : "67gv54hmnj8798ujhhu"}
109
112
  # expected response - 204
110
113
 
111
-
112
114
  payload =
113
- {
114
- "accountId": assignee_id
115
- }
115
+ {
116
+ "accountId": assignee_id
117
+ }
116
118
 
117
119
  url = "#{@base_url}/rest/api/2/issue/#{@issue_key}/assignee"
118
120
 
119
121
  response = RestClient.put(
120
- url,
121
- payload.to_json,
122
- headers = {
123
- # content_type: 'application/json',
124
- content_type: :json,
125
- # accept: :json,
126
- # accept: 'application,json',
127
- :Authorization => "Basic #{@jira_api_token}"
128
- }
122
+ url,
123
+ payload.to_json,
124
+ headers = {
125
+ # content_type: 'application/json',
126
+ content_type: :json,
127
+ # accept: :json,
128
+ # accept: 'application,json',
129
+ :Authorization => "Basic #{@jira_api_token}"
130
+ }
129
131
  )
130
132
  i += 1
131
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: createissue_jira
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SachinPatel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-29 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -115,6 +115,7 @@ files:
115
115
  - createissue_jira-0.1.6.gem
116
116
  - createissue_jira-0.1.7.gem
117
117
  - createissue_jira-0.1.8.gem
118
+ - createissue_jira.gemspec
118
119
  - lib/createissue_jira.rb
119
120
  - lib/createissue_jira/version.rb
120
121
  - sig/createissue_jira.rbs