redmine_remotes 0.8.2 → 0.9.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: bd846a3cc1a788360a4b120472ea5fe1d8f8d55835a95a3af3e842fe77e1d898
4
- data.tar.gz: d4c1a544d79c5cedd5db4030df30d61cb021813a2b96457d039c77e1c35d5821
3
+ metadata.gz: 7d3b9ae54d882f36e34f1ff7a0e76d75f8bf601730101584fc0ee6bd3026ae59
4
+ data.tar.gz: dada38afebcf9b89d454a7163b637b658834178561d48260aff831c507a6337d
5
5
  SHA512:
6
- metadata.gz: 429c14c070e2c1d8fe18aa45d08eeb2561fc144397811e45c6f0b6571fc85e8fce06dd3c01798c47aa78b9b7ecef313e43d6352c2dd4615dd1d87e588085a2b0
7
- data.tar.gz: 87dbdb0ddf2fb97b7db523512c5687e38c8982abf08cc1d4013c3bcd708162a9b240b93a2b39b002b078c9db883068367df158e646cf8bb5bfafecd2323b697f
6
+ metadata.gz: 335421b0f747cc7db893a74e7c351760cafb4d9a360473abbc7f362e0b6b6be663f87ef801738b72d32a59a3b107d7816a09aaf3036c506d55b6a79bca6d2e74
7
+ data.tar.gz: 3ebc5ee52fc4a9dd4b7ee67b3cb3ffbeb65bee168a86a9533a376643a4d16647c0798a9ecd1e2608fdc7ac6935a6cfc346eade934db098e26195e54f4a801c27
@@ -6,14 +6,14 @@ require 'validate_url'
6
6
 
7
7
  class RemoteTracker < ActiveRecord::Base
8
8
  include ::EacRubyUtils::Listable
9
- include ::RemoteTracker::Jira
9
+ include ::RemoteTracker::Remote
10
10
 
11
11
  has_many :issues, class_name: 'RemoteIssue', inverse_of: :remote_tracker,
12
12
  dependent: :restrict_with_error
13
13
  has_many :settings, class_name: 'RemoteTrackerSetting', inverse_of: :remote_tracker,
14
14
  dependent: :destroy
15
15
 
16
- lists.add_string :profile, :jira
16
+ lists.add_string :profile, :esosti, :jira
17
17
 
18
18
  has_many :issue_statuses, class_name: 'RemoteIssueStatus', inverse_of: :remote_tracker,
19
19
  dependent: :destroy
@@ -31,12 +31,6 @@ class RemoteTracker < ActiveRecord::Base
31
31
  "#{root_url} [#{profile_label}, #{username}]"
32
32
  end
33
33
 
34
- def find_remote_issue(issue_id)
35
- raise 'Profile blank' if profile.blank?
36
-
37
- send("#{profile}_find_remote_issue", issue_id)
38
- end
39
-
40
34
  def setting_value(name)
41
35
  ::RemoteTrackerSetting.where(remote_tracker: self, name: name).first.if_present(&:value)
42
36
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoteTracker < ActiveRecord::Base
4
+ module Remote
5
+ def find_remote_issue(issue_id)
6
+ remote_instance.find_issue(issue_id)
7
+ end
8
+
9
+ def remote_instance
10
+ remote_instance_class.new(self, root_url, username, password)
11
+ end
12
+
13
+ def remote_instance_class
14
+ raise 'Profile blank' if profile.blank?
15
+
16
+ ::RedmineRemotes.const_get(profile.capitalize).const_get('Instance')
17
+ end
18
+ end
19
+ end
@@ -3,6 +3,8 @@ en:
3
3
  listable:
4
4
  remote_tracker:
5
5
  profile:
6
+ esosti:
7
+ label: e-Sosti (Control Desk)
6
8
  jira:
7
9
  label: Jira
8
10
  remote_tracker_setting:
@@ -3,6 +3,8 @@ pt-BR:
3
3
  listable:
4
4
  remote_tracker:
5
5
  profile:
6
+ esosti:
7
+ label: e-Sosti (Control Desk)
6
8
  jira:
7
9
  label: Jira
8
10
  remote_tracker_setting:
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avmtrf1/esosti/entities/issue'
4
+
5
+ module RedmineRemotes
6
+ module Esosti
7
+ module Entities
8
+ class Issue < ::Avmtrf1::Esosti::Entities::Issue
9
+ def author_login
10
+ attributes.fetch('CREATEDBY').if_present { |v| v.gsub(/@[^@]+\z/, '') }
11
+ end
12
+
13
+ def attributes
14
+ data.first.fetch('Attributes')
15
+ end
16
+
17
+ def code
18
+ attributes.fetch('TICKETID')
19
+ end
20
+
21
+ def created_on
22
+ attributes.fetch('CREATIONDATE')
23
+ end
24
+
25
+ def description
26
+ related_mbos.fetch('LONGDESCRIPTION').first.fetch('Attributes').fetch('LDTEXT')
27
+ end
28
+
29
+ def related_mbos
30
+ data.first.fetch('RelatedMbos')
31
+ end
32
+
33
+ def status_name
34
+ attributes.fetch('STATUS')
35
+ end
36
+
37
+ def subject
38
+ attributes.fetch('DESCRIPTION')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RedmineRemotes
4
+ module Esosti
5
+ class Instance < ::RedmineRemotes::RestProvider::Instance
6
+ ISSUE_ID_PATTERN = /\A(?:ss|in)[0-9]+\z/i.freeze
7
+
8
+ class << self
9
+ def parse_issue_id(global_issue_id)
10
+ m = ISSUE_ID_PATTERN.match(global_issue_id)
11
+ return nil unless m
12
+
13
+ ::OpenStruct.new(provider_issue_id: m[0], project_id: nil, project_issue_id: nil)
14
+ end
15
+ end
16
+
17
+ def build_service_url(service_url_suffix)
18
+ "#{root_url}/maxrest/rest#{service_url_suffix}"
19
+ end
20
+
21
+ def issue_get_url_suffix(provider_issue_id)
22
+ "/os/MS_RMTICKET/?ticketid=#{provider_issue_id}"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -3,7 +3,7 @@
3
3
  module RedmineRemotes
4
4
  SLUG = 'redmine_remotes'
5
5
  NAME = 'Redmine Remotes'
6
- VERSION = '0.8.2'
6
+ VERSION = '0.9.0'
7
7
  AUTHOR = 'Eduardo Henrique Bogoni'
8
8
  SUMMARY = 'Integração do Redmine com trackers diversos.'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_remotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Henrique Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-07 00:00:00.000000000 Z
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -145,7 +145,7 @@ files:
145
145
  - app/models/remote_issue.rb
146
146
  - app/models/remote_issue_status.rb
147
147
  - app/models/remote_tracker.rb
148
- - app/models/remote_tracker/jira.rb
148
+ - app/models/remote_tracker/remote.rb
149
149
  - app/models/remote_tracker_setting.rb
150
150
  - app/models/remote_user.rb
151
151
  - app/views/project_remote_issues/_issues.html.erb
@@ -170,6 +170,8 @@ files:
170
170
  - db/migrate/20200505161002_add_timestamps_to_remote_users.rb
171
171
  - init.rb
172
172
  - lib/redmine_remotes.rb
173
+ - lib/redmine_remotes/esosti/entities/issue.rb
174
+ - lib/redmine_remotes/esosti/instance.rb
173
175
  - lib/redmine_remotes/jira/entities/issue.rb
174
176
  - lib/redmine_remotes/jira/instance.rb
175
177
  - lib/redmine_remotes/patches/issue.rb
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RemoteTracker < ActiveRecord::Base
4
- module Jira
5
- def jira_find_remote_issue(issue_id)
6
- jira_create_instance.find_issue(issue_id)
7
- end
8
-
9
- def jira_create_instance
10
- ::RedmineRemotes::Jira::Instance.new(self, root_url, username, password)
11
- end
12
- end
13
- end