qat-reporter-xray-sa 1.0.0 → 1.1.1

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: 38d6b57f31e3eca19dc06fe60e05ca40d1913036ce926df4e541638b730295b4
4
- data.tar.gz: 46538af29e00d3038fe04d517019212587b98b26f966a6ab51ffb8a45ed07868
3
+ metadata.gz: 42cc4ff05122b7c099ffa5aa7acef04781df4874d9abd8b1c36a034fcfdaf129
4
+ data.tar.gz: ba7b357de9ab827e2b438ecc10572f94ca7c753c470a2db9f337f0e1a86558c3
5
5
  SHA512:
6
- metadata.gz: bff21ebb0f0b833b418c9aa9f285605e19b559db7a6c42abe2f85fad780497f212eb2ac80c0adac790e8f2ed826768a199453718130ca69be5e3bf19ac7b024e
7
- data.tar.gz: 33861c2deca303693bc5888f13e3946dc31e2b95252a0f72c81cec431348d792be44df4dfe6cc1e32bb017ccaba4f74de10be81adb19ec6c6e75bd5191e9d1ec
6
+ metadata.gz: a5dc6ba3a819823f69fe6ed430be3d247628c57455e93fbea6f259240e085a19e81972a8a65303f32ba4454dff091ce4523e1015e1c4732d283be0839756b5c1
7
+ data.tar.gz: 7b1eaef7dd6a6cf0923ee25d2eafdbad4e853dbecd75a6db58e4deeb107df4f0bac53e8eab7c1a6376219380fac338cf138b04da5f6546a89612d1fbe1be341b
@@ -1,142 +1,145 @@
1
1
  require_relative 'publisher'
2
2
 
3
3
  module QAT
4
- module Reporter
5
- class Xray
6
- # QAT::Reporter::Xray configuration module
7
- module Config
8
- class << self
9
-
10
- attr_accessor :project_key, :jira_url, :xray_default_api_url, :login_credentials, :publisher, :jira_type,
11
- :cloud_xray_api_credentials, :xray_test_environment, :xray_test_version, :xray_test_revision, :xray_export_test_keys, :xray_export_test_filter
12
-
13
- # Default xray API url (Jira Cloud)
14
- DEFAULT_XRAY_URL = 'https://xray.cloud.getxray.app'
15
-
16
- # Returns the xray instanced type (hosted or cloud)
17
- def jira_type
18
- @jira_type
19
- end
20
-
21
- # Returns the jira url
22
- def jira_url
23
- @jira_url
24
- end
25
-
26
- # Returns the default xray jira url for cloud api
27
- def xray_default_api_url
28
- DEFAULT_XRAY_URL
29
- end
30
-
31
- # Returns the login credentials array could -> [username, password, apiToken]
32
- def login_credentials
33
- @login_credentials
34
- end
35
-
36
- # Returns the login credentials array for cloud api [client_id, client_secret]
37
- def cloud_xray_api_credentials
38
- @cloud_xray_api_credentials || nil
39
- end
40
-
41
- # Returns the test keys to export
42
- def xray_export_test_keys
43
- @keys || nil
44
- end
45
-
46
- # Returns the test filter to export
47
- def xray_export_test_filter
48
- @filter || nil
49
- end
50
-
51
- # Returns the project key value
52
- def project_key
53
- @project_key
54
- end
55
-
56
- # Returns the xray test environment value
57
- def xray_test_environment
58
- @xray_test_environment || get_env_from_qat_config
59
- end
60
-
61
- # Returns the xray test version value
62
- def xray_test_version
63
- @xray_test_version || get_version_from_qat_config
64
- end
65
-
66
- # Returns the xray test revision value
67
- def xray_test_revision
68
- @xray_test_revision || get_revision_from_qat_config
69
- end
70
-
71
- def publisher=(publisher)
72
- @publisher = publisher
73
- end
74
-
75
- def publisher
76
- @publisher
77
- end
78
-
79
-
80
- private
81
-
82
- def get_env_from_qat_config
83
- begin
84
- QAT.configuration.dig(:xray, :environment_name)
85
- rescue ArgumentError
86
- raise(NoEnvironmentDefined, 'JIRA\'s environment must be defined!')
87
- end
88
- end
89
-
90
- def get_version_from_qat_config
91
- begin
92
- QAT.configuration.dig(:xray, :version)
93
- rescue ArgumentError
94
- raise(NoVersionDefined, 'JIRA\'s version must be defined!')
95
- end
96
- end
97
-
98
- def get_revision_from_qat_config
99
- begin
100
- QAT.configuration.dig(:xray, :revision)
101
- rescue ArgumentError
102
- raise(NoRevisionDefined, 'JIRA\'s revision must be defined!')
103
- end
104
- end
105
-
106
- # Error returned when the QAT project has not defined the Jira Environment
107
- class NoEnvironmentDefined < StandardError
108
- end
109
- # Error returned when the QAT project has not defined the Jira Version
110
- class NoVersionDefined < StandardError
111
- end
112
- # Error returned when the QAT project has not defined the Jira Revision
113
- class NoRevisionDefined < StandardError
114
- end
115
- end
116
- end
117
-
118
- class << self
119
- # Configures the QAT::Formatter::Xray
120
- def configure(&block)
121
- yield Config
122
-
123
- QAT::Reporter::Xray::Config.publisher = QAT::Reporter::Xray::Publisher.const_get(QAT::Reporter::Xray::Config.jira_type.capitalize).new
124
-
125
- raise(LoginCredentialsUndefinedError, 'JIRA\'s login credentials must be defined!') unless QAT::Reporter::Xray::Config.login_credentials
126
- raise(PublisherUndefinedError, 'XRAY\'s publisher is not defined!') unless QAT::Reporter::Xray::Config.publisher.present?
127
- return QAT::Reporter::Xray::Config.publisher
128
- end
129
-
130
- # Error returned when the the JIRA project key is not defined
131
- class ProjectKeyUndefinedError < StandardError
132
- end
133
- # Error returned when the the JIRA login credentials is not defined
134
- class LoginCredentialsUndefinedError < StandardError
135
- end
136
- # Error returned when not publisher was defined
137
- class PublisherUndefinedError < StandardError
138
- end
139
- end
140
- end
141
- end
4
+ module Reporter
5
+ class Xray
6
+ # QAT::Reporter::Xray configuration module
7
+ module Config
8
+ class << self
9
+
10
+ attr_accessor :project_key, :jira_url, :xray_default_api_url, :login_credentials, :publisher, :jira_type,
11
+ :cloud_xray_api_credentials, :xray_test_environment, :xray_test_version, :xray_test_revision, :xray_export_test_keys, :xray_export_test_filter
12
+
13
+ # Default xray API url (Jira Cloud)
14
+ DEFAULT_XRAY_URL = 'https://xray.cloud.getxray.app'
15
+
16
+ # Returns the xray instanced type (hosted or cloud)
17
+ def jira_type
18
+ @jira_type
19
+ end
20
+
21
+ # Returns the jira url
22
+ def jira_url
23
+ @jira_url
24
+ end
25
+
26
+ # Returns the default xray jira url for cloud api
27
+ def xray_default_api_url
28
+ DEFAULT_XRAY_URL
29
+ end
30
+
31
+ # Returns the login credentials array could -> [username, password, apiToken]
32
+ def login_credentials
33
+ @login_credentials
34
+ end
35
+
36
+ # Returns the login credentials array for cloud api [client_id, client_secret]
37
+ def cloud_xray_api_credentials
38
+ @cloud_xray_api_credentials || nil
39
+ end
40
+
41
+ # Returns the test keys to export
42
+ def xray_export_test_keys
43
+ @keys || nil
44
+ end
45
+
46
+ # Returns the test filter to export
47
+ def xray_export_test_filter
48
+ @filter || nil
49
+ end
50
+
51
+ # Returns the project key value
52
+ def project_key
53
+ @project_key
54
+ end
55
+
56
+ # Returns the xray test environment value
57
+ def xray_test_environment
58
+ @xray_test_environment || get_env_from_qat_config
59
+ end
60
+
61
+ # Returns the xray test version value
62
+ def xray_test_version
63
+ @xray_test_version || get_version_from_qat_config
64
+ end
65
+
66
+ # Returns the xray test revision value
67
+ def xray_test_revision
68
+ @xray_test_revision || get_revision_from_qat_config
69
+ end
70
+
71
+ def publisher=(publisher)
72
+ @publisher = publisher
73
+ end
74
+
75
+ def publisher
76
+ @publisher
77
+ end
78
+
79
+ private
80
+
81
+ def get_env_from_qat_config
82
+ begin
83
+ QAT.configuration.dig(:xray, :environment_name)
84
+ rescue ArgumentError
85
+ raise(NoEnvironmentDefined, 'JIRA\'s environment must be defined!')
86
+ end
87
+ end
88
+
89
+ def get_version_from_qat_config
90
+ begin
91
+ QAT.configuration.dig(:xray, :version)
92
+ rescue ArgumentError
93
+ raise(NoVersionDefined, 'JIRA\'s version must be defined!')
94
+ end
95
+ end
96
+
97
+ def get_revision_from_qat_config
98
+ begin
99
+ QAT.configuration.dig(:xray, :revision)
100
+ rescue ArgumentError
101
+ raise(NoRevisionDefined, 'JIRA\'s revision must be defined!')
102
+ end
103
+ end
104
+
105
+ # Error returned when the QAT project has not defined the Jira Environment
106
+ class NoEnvironmentDefined < StandardError
107
+ end
108
+
109
+ # Error returned when the QAT project has not defined the Jira Version
110
+ class NoVersionDefined < StandardError
111
+ end
112
+
113
+ # Error returned when the QAT project has not defined the Jira Revision
114
+ class NoRevisionDefined < StandardError
115
+ end
116
+ end
117
+ end
118
+
119
+ class << self
120
+ # Configures the QAT::Formatter::Xray
121
+ def configure(&block)
122
+ yield Config
123
+
124
+ QAT::Reporter::Xray::Config.publisher = QAT::Reporter::Xray::Publisher.const_get(QAT::Reporter::Xray::Config.jira_type.capitalize).new
125
+
126
+ raise(LoginCredentialsUndefinedError, 'JIRA\'s login credentials must be defined!') unless QAT::Reporter::Xray::Config.login_credentials
127
+ raise(PublisherUndefinedError, 'XRAY\'s publisher is not defined!') unless QAT::Reporter::Xray::Config.publisher.present?
128
+ return QAT::Reporter::Xray::Config.publisher
129
+ end
130
+
131
+ # Error returned when the the JIRA project key is not defined
132
+ class ProjectKeyUndefinedError < StandardError
133
+ end
134
+
135
+ # Error returned when the the JIRA login credentials is not defined
136
+ class LoginCredentialsUndefinedError < StandardError
137
+ end
138
+
139
+ # Error returned when not publisher was defined
140
+ class PublisherUndefinedError < StandardError
141
+ end
142
+ end
143
+ end
144
+ end
142
145
  end
@@ -14,10 +14,10 @@ module QAT
14
14
 
15
15
  # Initializes Xray Publisher url and login information
16
16
  def initialize
17
- @base_url = QAT::Reporter::Xray::Config.jira_url
18
- @login_credentials = QAT::Reporter::Xray::Config.login_credentials
19
- @default_cloud_api_url = QAT::Reporter::Xray::Config.xray_default_api_url
20
- @cloud_xray_api_credentials = QAT::Reporter::Xray::Config.cloud_xray_api_credentials
17
+ @base_url = QAT::Reporter::Xray::Config.jira_url
18
+ @login_credentials = QAT::Reporter::Xray::Config.login_credentials
19
+ @default_cloud_api_url_graphql = QAT::Reporter::Xray::Config.xray_default_api_url_graphql
20
+ @cloud_xray_api_credentials = QAT::Reporter::Xray::Config.cloud_xray_api_credentials
21
21
  end
22
22
 
23
23
  # Creates a Jira issue
@@ -37,6 +37,10 @@ module QAT
37
37
  }.merge(headers)
38
38
  end
39
39
 
40
+ def cloud_graphql_headers
41
+ auth_headers
42
+ end
43
+
40
44
  private
41
45
 
42
46
  # Authentication header for xray, Basic authentication done with: username, password
@@ -96,9 +100,8 @@ module QAT
96
100
 
97
101
  # log_request operation, final_url, args
98
102
  # begin
99
- response = RestClient.method(operation).call(final_url, *args)
100
- log_response response
101
- response
103
+ RestClient.method(operation).call(final_url, *args)
104
+ #log_response response
102
105
  # validate response
103
106
  # rescue RestClient::ExceptionWithResponse => e
104
107
  # puts e.response
@@ -7,7 +7,6 @@ module QAT
7
7
  module Publisher
8
8
  # QAT::Reporter::Xray::Publisher::Cloud integrator class
9
9
  class Cloud < Base
10
-
11
10
  def get_jira_issue(issue_key)
12
11
  headers = { 'Content-Type': 'application/json' }.merge(auth_headers)
13
12
  Client.new(base_url).get("/rest/api/3/issue/#{issue_key}", headers)
@@ -5,7 +5,7 @@ module QAT
5
5
  # Namespace for QAT Reporter's Xray integrations
6
6
  class Xray
7
7
  # Represents QAT Reporter's Xray integrations' version
8
- VERSION = '1.0.0'
8
+ VERSION = '1.1.1'
9
9
  end
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qat-reporter-xray-sa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - QAT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-29 00:00:00.000000000 Z
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vcr
@@ -98,6 +98,20 @@ dependencies:
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
+ - !ruby/object:Gem::Dependency
102
+ name: graphql-client
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :runtime
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
101
115
  description: |2
102
116
  QAT Report Xray Standalone belongs to QAT Report collection but stand alone version, so no dependencies from other
103
117
  QAT gems are required.