createissue_jira 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6b3bab4154ed351b6b6fd109f775c7d0c0bca54cd0484b708419d86831800fb1
4
+ data.tar.gz: 99af02b839687005ffc4c1bbbeb0a001ac8ef68fa99724ed52e3e9449cf4153a
5
+ SHA512:
6
+ metadata.gz: 5341bb5a09c4720fc0896c8f9082ad93890c05639320fbae2ec83066daede103d14c3d013149fea9cabd3a9723b6614b96ce39f00d5578749ba95bd5d4a02986
7
+ data.tar.gz: 49d30395da6a741404a7356bb36e9b3f3eadbcebc569e0973e56689788a95bf1093e5084eb49062f722fce12774b274a72c943b37e3bafbcc24956c08a9056fb
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-04-29
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at sachin.patel@olrretail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in createissue_jira.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 sacpate
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # CreateissueJira
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/createissue_jira`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add createissue_jira
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install createissue_jira
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/createissue_jira. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/createissue_jira/blob/master/CODE_OF_CONDUCT.md).
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the CreateissueJira project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/createissue_jira/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CreateissueJira
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "createissue_jira/version"
4
+ require 'rest-client'
5
+ require 'json'
6
+ require 'base64'
7
+ require 'roo'
8
+
9
+ module CreateissueJira
10
+ class Datafile
11
+ def jira_api_credentials base_url, jira_api_token, assignee_id, acceptance_criteria_id
12
+ @base_url = base_url
13
+ @jira_api_token = jira_api_token
14
+ @assignee_id = assignee_id
15
+ @acceptance_criteria_id = acceptance_criteria_id
16
+ end
17
+
18
+ def load_file (file_path, sheet_no, header_name)
19
+ sheet_no = sheet_no.to_i
20
+ xls = Roo::Spreadsheet.open(file_path)
21
+ @datasheet = xls.sheet(sheet_no)
22
+ @all_data = xls.parse(header_search: [/#{header_name}/])
23
+ end
24
+
25
+ def summary idColNo, summaryRowNo, summaryColNo
26
+ rowNo = summaryRowNo.to_i
27
+ colNo = summaryColNo.to_i
28
+ idColNo = idColNo.to_i
29
+
30
+ @summary = []
31
+ rowNo
32
+ @all_data.count.times do
33
+ @summary.push(@datasheet.cell(rowNo, idColNo).rstrip + " " + " " + @datasheet.cell(rowNo, colNo))
34
+ rowNo += 1
35
+ end
36
+ end
37
+
38
+ def description rowNo, colNo, acceptance_criteria_name
39
+ rowNo = rowNo.to_i
40
+ colNo = colNo.to_i
41
+ rowNo
42
+ @description = []
43
+ @all_data.count.times do
44
+ @description.push(@datasheet.cell(rowNo, colNo).split(acceptance_criteria_name)[0])
45
+ rowNo += 1
46
+ end
47
+ end
48
+
49
+ def business_acceptace rowNo, colNo, acceptance_criteria_name
50
+ rowNo = rowNo.to_i
51
+ colNo = colNo.to_i
52
+ @business_acceptance = []
53
+ @all_data.count.times do
54
+ @business_acceptance.push(@datasheet.cell(rowNo, colNo).split(acceptance_criteria_name)[1])
55
+ rowNo += 1
56
+ end
57
+ end
58
+
59
+ def create_api project_key, epic_key, assignee_id, label
60
+ i = 0
61
+ @summary.size.times do
62
+ payload = {
63
+ "fields":
64
+ {
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
+ }
85
+ }
86
+
87
+ 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
+ }
94
+ )
95
+
96
+ #extract the key
97
+ @response = JSON.parse response.gsub(':', ':')
98
+ @issue_key = @response["key"]
99
+
100
+
101
+ #Assign the issue to someone
102
+ #get the assignee id - by clicking on profile link : which will something like
103
+ # https://abcperson.atlassian.net/jira/people/67gv54hmnj8798ujhhu
104
+ # After - people what is there is the acount id :
105
+
106
+ #request - put
107
+ # endpoint : https://abcperson.atlassian.net/rest/api/2/issue/Issue-ID/assignee
108
+ # body : {"accountID" : "67gv54hmnj8798ujhhu"}
109
+ # expected response - 204
110
+
111
+
112
+ payload =
113
+ {
114
+ "accountId": assignee_id
115
+ }
116
+
117
+ url = "#{@base_url}/rest/api/2/issue/#{@issue_key}/assignee"
118
+
119
+ 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
+ }
129
+ )
130
+ i += 1
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,4 @@
1
+ module CreateissueJira
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: createissue_jira
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sacpate
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Write a longer description or delete this line.
14
+ email:
15
+ - sachin.patel@olrretail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - CHANGELOG.md
21
+ - CODE_OF_CONDUCT.md
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - lib/createissue_jira.rb
27
+ - lib/createissue_jira/version.rb
28
+ - sig/createissue_jira.rbs
29
+ homepage: https://rubygems.org
30
+ licenses:
31
+ - MIT
32
+ metadata:
33
+ allowed_push_host: https://rubygems.org
34
+ homepage_uri: https://rubygems.org
35
+ source_code_uri: https://rubygems.org
36
+ changelog_uri: https://rubygems.org
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.5.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 2.7.6
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Write a short summary, because RubyGems requires one.
57
+ test_files: []