cirro-ruby-client 2.5.12 → 2.5.14

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: 54ec8bba00d06538a146b978a969bc666870301ee49524fdfe565008fd49f059
4
- data.tar.gz: ac3f9401adc1dfac45deda3a8532e6762d784f3933169f2cdd10857746f3ffa6
3
+ metadata.gz: 868245706e02e651fa051316ae152a8453a4e79f208766c25fecdb5fc5631264
4
+ data.tar.gz: 97e8826feb75ded1297dfe07450a87c422c73db6c2e0125a59a8afa8484fc0ad
5
5
  SHA512:
6
- metadata.gz: 91bfb50504e0002561613a0a4b1cb87512011f12e2bd8c482ee6989d30d0bf970cc2dc87e0216ef830ffc9aec29feb55ec097801da389ce34aa81586ded6c4a8
7
- data.tar.gz: 77ded5629a2fdcf12a47fa474a98ee681fe5e2c81ba25b8a33a9d86ed74c65a67ededa44d1a98efc601896d5bfd1abae82797b3a5012a8fe061a3e49a2ac4096
6
+ metadata.gz: 63435ad60ac25619a88b26805ca13bb1a8ded1abe3438183b2c80a85c6d034adb39b38dc84893a3bdf21dc6e22ff24b5c6909a3e1d095a995b468ff3f00f9d75
7
+ data.tar.gz: 726e85f95df11e3b22cb1359fecb1f63cb0f1cfb4813482e72630ea9765005331c310a272ada9c72a09815a074f109807ec8fe44b7dd7d152a013421f731dda5
data/.rubocop.yml CHANGED
@@ -128,6 +128,9 @@ RSpec/EmptyExampleGroup:
128
128
  RSpec/MultipleExpectations:
129
129
  Enabled: false
130
130
 
131
+ RSpec/MultipleMemoizedHelpers:
132
+ Max: 12
133
+
131
134
  Style/SymbolArray:
132
135
  EnforcedStyle: brackets
133
136
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (2.5.12)
4
+ cirro-ruby-client (2.5.14)
5
5
  activesupport
6
6
  faraday (< 1.2.0)
7
7
  faraday_middleware
@@ -11,9 +11,9 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (7.0.4.2)
15
- activesupport (= 7.0.4.2)
16
- activesupport (7.0.4.2)
14
+ activemodel (7.0.4.3)
15
+ activesupport (= 7.0.4.3)
16
+ activesupport (7.0.4.3)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '2.5.12'
4
+ VERSION = '2.5.14'
5
5
  end
6
6
  end
7
7
  # rubocop:enable Style/MutableConstant
@@ -3,29 +3,22 @@ module CirroIOV2
3
3
  module Base
4
4
  def initialize(body)
5
5
  body = body.deep_symbolize_keys
6
+
6
7
  if body[:object] == 'list'
7
8
  list_item_class = self.class.name.gsub('List', '').constantize
8
- values_hash = body.slice(*members.excluding(:data)).merge(
9
- data: body[:data].map { |list_item| list_item_class.new(list_item) },
10
- )
11
- super(*members.map { |attr| values_hash[attr] })
12
- elsif list_attribute(body)
13
- values_hash = body.slice(*members.excluding(list_attribute(body))).merge(
14
- list_attribute(body) => create_sub_resource(list_attribute(body), body[list_attribute(body)]),
15
- )
16
- super(*body.slice(*members).keys.map { |attr| values_hash[attr] })
17
- else
18
- super(*body.slice(*members).values)
9
+ body[:data] = body[:data].map { |list_item| list_item_class.new(list_item) }
19
10
  end
20
- end
21
11
 
22
- def list_attribute(data)
23
- data.keys.find { |key| data[key].is_a?(Hash) && data[key][:object] == 'list' }
24
- end
12
+ if self.class.const_defined?('NESTED_RESPONSES')
13
+ self.class::NESTED_RESPONSES.each do |attribute_name, class_name|
14
+ next unless members.include?(attribute_name)
15
+ next unless body[attribute_name]
16
+
17
+ body[attribute_name] = "CirroIOV2::Responses::#{class_name}".constantize.new(body[attribute_name])
18
+ end
19
+ end
25
20
 
26
- def create_sub_resource(resource_name, body)
27
- sub_resource_class = "CirroIOV2::Responses::#{self.class::NESTED_RESPONSES[resource_name]}".constantize
28
- sub_resource_class.new(body)
21
+ super(**body.slice(*members))
29
22
  end
30
23
  end
31
24
  end
@@ -23,19 +23,39 @@ module CirroIOV2
23
23
  :NotificationTopicDeleteResponse,
24
24
  ].freeze
25
25
 
26
- UserResponse = Struct.new(:id, :object, :first_name, :last_name, :time_zone, :birthday, :country_code, :epam, :worker, :anonymous_email) do
26
+ UserResponse = Struct.new(:id,
27
+ :object,
28
+ :first_name,
29
+ :last_name,
30
+ :time_zone,
31
+ :birthday,
32
+ :country_code,
33
+ :epam,
34
+ :worker,
35
+ :anonymous_email,
36
+ keyword_init: true) do
27
37
  include Base
28
38
  end
29
39
 
30
- UserNotificationPreferenceResponse = Struct.new(:id, :object, :locale, :topics) do
40
+ UserNotificationPreferenceResponse = Struct.new(:id, :object, :locale, :topics, keyword_init: true) do
31
41
  self::NESTED_RESPONSES = { topics: :NotificationTopicPreferenceListResponse }.freeze
32
42
  include Base
33
43
  end
34
44
 
35
- SpaceInvitationResponse = Struct.new(:id, :object, :token, :subject, :email, :name, :inviter_name, :skip_background_check, :expires_at) do
45
+ SpaceInvitationResponse = Struct.new(:id,
46
+ :object,
47
+ :token,
48
+ :subject,
49
+ :email,
50
+ :name,
51
+ :inviter_name,
52
+ :skip_background_check,
53
+ :expires_at,
54
+ keyword_init: true) do
36
55
  include Base
37
56
  end
38
57
 
58
+ InvitationNotificationTopicResponse = Struct.new(:id, :object, :name, keyword_init: true)
39
59
  GigResponse = Struct.new(:id,
40
60
  :object,
41
61
  :title,
@@ -51,20 +71,22 @@ module CirroIOV2
51
71
  :filter_query,
52
72
  :tasks,
53
73
  :notification_payload,
54
- :epam_options) do
55
- self::NESTED_RESPONSES = { tasks: :GigTaskListResponse }.freeze
74
+ :invitation_notification_topic,
75
+ :epam_options,
76
+ keyword_init: true) do
77
+ self::NESTED_RESPONSES = { tasks: :GigTaskListResponse, invitation_notification_topic: :InvitationNotificationTopicResponse }.freeze
56
78
  include Base
57
79
  end
58
80
 
59
- GigTaskResponse = Struct.new(:id, :object, :title, :base_price) do
81
+ GigTaskResponse = Struct.new(:id, :object, :title, :base_price, keyword_init: true) do
60
82
  include Base
61
83
  end
62
84
 
63
- GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id, :no_reward, :epam_bench_status) do
85
+ GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id, :no_reward, :epam_bench_status, keyword_init: true) do
64
86
  include Base
65
87
  end
66
88
 
67
- GigTimeActivityResponse = Struct.new(:id, :object, :gig_id, :user_id, :description, :duration_in_ms, :date) do
89
+ GigTimeActivityResponse = Struct.new(:id, :object, :gig_id, :user_id, :description, :duration_in_ms, :date, keyword_init: true) do
68
90
  include Base
69
91
  end
70
92
 
@@ -78,7 +100,8 @@ module CirroIOV2
78
100
  :multiplier,
79
101
  :delivery_date,
80
102
  :cost_center_key,
81
- :cost_center_data) do
103
+ :cost_center_data,
104
+ keyword_init: true) do
82
105
  include Base
83
106
  end
84
107
 
@@ -92,46 +115,47 @@ module CirroIOV2
92
115
  :reference_type,
93
116
  :user_id,
94
117
  :cost_center_key,
95
- :cost_center_data) do
118
+ :cost_center_data,
119
+ keyword_init: true) do
96
120
  include Base
97
121
  end
98
122
 
99
- NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id) do
123
+ NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id, keyword_init: true) do
100
124
  include Base
101
125
  end
102
126
 
103
- NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations) do
127
+ NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations, keyword_init: true) do
104
128
  self::NESTED_RESPONSES = { configurations: :NotificationConfigurationListResponse }.freeze
105
129
  include Base
106
130
  end
107
131
 
108
- NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale) do
132
+ NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale, keyword_init: true) do
109
133
  include Base
110
134
  end
111
135
 
112
- NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates) do
136
+ NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates, keyword_init: true) do
113
137
  self::NESTED_RESPONSES = { templates: :NotificationLayoutTemplateListResponse }.freeze
114
138
  include Base
115
139
  end
116
140
 
117
- NotificationLayoutTemplateResponse = Struct.new(:id, :notification_configuration_id, :notification_layout_id, :body) do
141
+ NotificationLayoutTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_layout_id, :body, keyword_init: true) do
118
142
  include Base
119
143
  end
120
144
 
121
- NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates) do
145
+ NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates, keyword_init: true) do
122
146
  self::NESTED_RESPONSES = { templates: :NotificationTemplateListResponse }.freeze
123
147
  include Base
124
148
  end
125
149
 
126
- NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body) do
150
+ NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body, keyword_init: true) do
127
151
  include Base
128
152
  end
129
153
 
130
- NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id) do
154
+ NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id, keyword_init: true) do
131
155
  include Base
132
156
  end
133
157
 
134
- EpamHeroesBadgeResponse = Struct.new(:content, :refs, :paging, :hasMoreResults) do
158
+ EpamHeroesBadgeResponse = Struct.new(:content, :refs, :paging, :hasMoreResults, keyword_init: true) do
135
159
  include Base
136
160
  end
137
161
 
@@ -140,8 +164,8 @@ module CirroIOV2
140
164
  return const_get(name) if const_defined? name
141
165
 
142
166
  struct = nil
143
- struct = Struct.new(:object, :url, :has_more, :data) if LIST_RESPONSES.include?(name)
144
- struct = Struct.new(:id, :object, :deleted) if DELETE_RESPONSES.include?(name)
167
+ struct = Struct.new(:object, :url, :has_more, :data, keyword_init: true) if LIST_RESPONSES.include?(name)
168
+ struct = Struct.new(:id, :object, :deleted, keyword_init: true) if DELETE_RESPONSES.include?(name)
145
169
 
146
170
  return unless struct.present?
147
171
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirro-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.12
4
+ version: 2.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cirro Dev Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport