createissue_jira 0.1.9 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d218c86c1ea84edea27cb5d617a99d80bb7ea225487b1c4883beeff9dc8d5a3c
4
- data.tar.gz: 87da6386ff118dc7a4efd3083c488b3c0656d7364ee3ee4986d35e4b133a16b4
3
+ metadata.gz: 149e36e69be40905e87e0607ce3b669cc4fe4eee55a19226ee647f0f6e73562d
4
+ data.tar.gz: ff59d92277f004eabb3ff59230208129fc5369458209624a24c8d5291b3286a8
5
5
  SHA512:
6
- metadata.gz: 0f13a3acd51054fd749f7f4cfbf952f4f030ca87c74c6eba35c8be7cc9e1cccc9a210581c2b52aad2083fe642f008b917c3a2272499a874a852e53127d06501f
7
- data.tar.gz: de400be7b4186299d7376063bfcccba840652eb0e4bb1bd05c81b0f1b0af7987f4e92a0813e2af62db522af899e86c871e5fadda62438d977396085908302f0f
6
+ metadata.gz: acfe67c2d3d3423f59b0b0c2af8366e298ce1375c5a886fd4e3fca840a627c8c95eb1234960cbbce758f668efcd47125be98db1f555c546427d71069025b338d
7
+ data.tar.gz: 78d467e1255b4edc50dfe6c76a791e5e1fe5fb0e1de85be8dcd693f3e648199be19f0f0cf1adb7ea6cb9b43e76cf6b46486cd2bf50091975b5c5964da3192c57
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.2.0)
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.1"
5
5
  end
@@ -8,11 +8,14 @@ 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
17
+ #2022 - atlassian - jira password updated with api token
18
+ @auth = "Basic #{Base64.strict_encode64("#{@email + ":" + @jira_api_token}")}"
16
19
  end
17
20
 
18
21
  def load_file (file_path, sheet_no, header_name)
@@ -60,72 +63,71 @@ module CreateissueJira
60
63
  i = 0
61
64
  @summary.size.times do
62
65
  payload = {
63
- "fields":
66
+ "fields":
67
+ {
68
+ "project":
69
+ {
70
+ "key": project_key
71
+ },
72
+ "parent":
73
+ {
74
+ "key": epic_key
75
+ },
76
+ "summary": @summary[i],
77
+ "description": @description[i],
78
+
79
+ "issuetype":
64
80
  {
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
- }
81
+ "name": "Story"
82
+ },
83
+ "#{@acceptance_criteria_id}": @business_acceptance[i],
84
+ "labels": [
85
+ label
86
+ ]
87
+ }
85
88
  }
86
89
 
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.1
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-25 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