ticket_abstractor_client 2.0.2 → 2.0.3

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
  SHA1:
3
- metadata.gz: 5e5d71cc98d22ffbab8164cbcd6d91d19360d516
4
- data.tar.gz: ecb8e7f3ba91f51fc9eb47b7776a93d6b76b77b2
3
+ metadata.gz: 26806a758f7eaca613dcd28dbd8e65656a5ac091
4
+ data.tar.gz: f7dd4851cd90bde7dd4988d9467f5e633184b703
5
5
  SHA512:
6
- metadata.gz: cf1de47f64d0c61c21791d8853e4853292788c364bdff38cd0d61badae1802b91b982ead7f5747cd8082a32aee3a3409a5fdc906603b0520541001bd8c47ddc0
7
- data.tar.gz: 39abe1cee3c2a8c4e6aa120cbef44a6ca7d5ace53ce05dcec6866026005a94d9fac27541528c0a791a9b298eb07161ecc1607076f840ac7185d3314325603427
6
+ metadata.gz: 4a65523bb783c5293a78942105afe15df86886d15ec669965875ffd8188dfb3bb1083dd6c1316b5ed0736639ac6bbf00b33f785b4ec6a72805a4b8a1bf64c858
7
+ data.tar.gz: 87c6e84066af5160d523dc258a5eee1fc55174bf18e011792a3c4c80d9707281860eec3a52d1f5acc7bd9a557ece2791c7171d36df8573c8619ae6a12b06100a
data/README.md CHANGED
@@ -62,9 +62,16 @@ For more available ssl options see **[SSL/TLS support](https://github.com/rest-c
62
62
  Meta information is refreshed automatically after `jira_meta_expiration_period` (**604800**
63
63
  seconds by default, one week).
64
64
 
65
+ TicketAbstractorClient.configuration.jira_fields_meta(endpoint)
66
+
65
67
  Meta information can be manually updated:
68
+ * For all endpoints:
69
+
70
+ TicketAbstractorClient.configuration.jira_fields_meta_hash = TicketAbstractorClient::ClientHelper.get_jira_fields_meta
71
+
72
+ * For a specific endpoint only:
66
73
 
67
- TicketAbstractorClient.configuration.jira_fields_meta = TicketAbstractorClient::ClientHelper.get_jira_fields_meta
74
+ TicketAbstractorClient.configuration.jira_fields_meta_hash.update! TicketAbstractorClient::ClientHelper.get_jira_fields_meta(endpoint)
68
75
 
69
76
  **ServiceNow specific options:**
70
77
 
@@ -20,8 +20,11 @@ module TicketAbstractorClient
20
20
  Time::DATE_FORMATS[:unix_timestamp] = '%s'
21
21
  Time::DATE_FORMATS[:unix_timestamp_with_ms] = '%s.%5N'
22
22
 
23
- def get_jira_fields_meta
24
- Jira::Client.new.endpoints.each_with_object({}) do |(endpoint, _), result|
23
+ def get_jira_fields_meta(*jira_endpoint)
24
+ jira_endpoints = Jira::Client.new.endpoints
25
+ jira_endpoints = jira_endpoints.slice(*jira_endpoint) if jira_endpoint.present?
26
+
27
+ jira_endpoints.each_with_object({}) do |(endpoint, _), result|
25
28
  result[endpoint.to_sym] = Jira::FieldsMeta.new(endpoint)
26
29
  end
27
30
  end
@@ -1,6 +1,6 @@
1
1
  module TicketAbstractorClient
2
2
  class Configuration
3
- attr_accessor :ticket_abstractor_url, :security_token, :snow_display_value, :jira_fields_meta,
3
+ attr_accessor :ticket_abstractor_url, :security_token, :snow_display_value, :jira_fields_meta_hash,
4
4
  :jira_meta_expiration_period, :ssl_options, :trace_communications
5
5
 
6
6
  DEFAULT_JIRA_META_EXPIRATION_PERIOD = 604800 # 1 week
@@ -27,8 +27,14 @@ module TicketAbstractorClient
27
27
  @jira_tickets_filter_class = filter_class
28
28
  end
29
29
 
30
- def jira_fields_meta
31
- @jira_fields_meta ||= ClientHelper.get_jira_fields_meta
30
+ def jira_fields_meta(endpoint = nil)
31
+ @jira_fields_meta_hash ||= {}
32
+
33
+ if endpoint.present?
34
+ @jira_fields_meta_hash[endpoint.to_sym] ||= ClientHelper.get_jira_fields_meta(endpoint)[endpoint.to_sym]
35
+ else
36
+ @jira_fields_meta_hash ||= ClientHelper.get_jira_fields_meta
37
+ end
32
38
  end
33
39
 
34
40
  def jira_meta_expiration_period
@@ -87,7 +87,7 @@ module TicketAbstractorClient
87
87
  end
88
88
 
89
89
  def fields_meta(endpoint)
90
- meta = TicketAbstractorClient.configuration.jira_fields_meta[endpoint.to_sym]
90
+ meta = TicketAbstractorClient.configuration.jira_fields_meta(endpoint)
91
91
  meta.update! if meta.expired?
92
92
  meta
93
93
  end
@@ -20,14 +20,14 @@ module TicketAbstractorClient
20
20
 
21
21
  def add_attachment(attachment)
22
22
  @attachments ||= []
23
- @attachments << Attachment.new(attachment.merge!(ticket_id: @ticket_id, endpoint: @endpoint))
23
+ @attachments << Attachment.new(attachment.merge(ticket_id: @ticket_id, endpoint: @endpoint, project: @project))
24
24
  @changes[:new_attachments] += 1
25
25
  self
26
26
  end
27
27
 
28
28
  def add_comment(comment)
29
29
  @comments ||= []
30
- @comments << Comment.new(comment.merge!(ticket_id: @ticket_id, endpoint: @endpoint))
30
+ @comments << Comment.new(comment.merge(ticket_id: @ticket_id, endpoint: @endpoint, project: @project))
31
31
  @changes[:new_comments] += 1
32
32
  self
33
33
  end
@@ -111,6 +111,8 @@ module TicketAbstractorClient
111
111
  @ticket_id = response['key']
112
112
  self.reload!
113
113
  self.reset_changes!
114
+
115
+ self
114
116
  end
115
117
 
116
118
  def update_status
@@ -1,3 +1,3 @@
1
1
  module TicketAbstractorClient
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticket_abstractor_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Samoilov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-08 00:00:00.000000000 Z
12
+ date: 2017-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler