cirro-ruby-client 2.5.12 → 2.5.13

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: 54ec8bba00d06538a146b978a969bc666870301ee49524fdfe565008fd49f059
4
- data.tar.gz: ac3f9401adc1dfac45deda3a8532e6762d784f3933169f2cdd10857746f3ffa6
3
+ metadata.gz: c75643dbc6c63d1b537edeb0d49d8f0d1b4049a30dd10c823e5dd681548029ba
4
+ data.tar.gz: 42db942af4c2eb64066904a6a9d49fb6f216b129e1abbcb23051ddf7fa0472ff
5
5
  SHA512:
6
- metadata.gz: 91bfb50504e0002561613a0a4b1cb87512011f12e2bd8c482ee6989d30d0bf970cc2dc87e0216ef830ffc9aec29feb55ec097801da389ce34aa81586ded6c4a8
7
- data.tar.gz: 77ded5629a2fdcf12a47fa474a98ee681fe5e2c81ba25b8a33a9d86ed74c65a67ededa44d1a98efc601896d5bfd1abae82797b3a5012a8fe061a3e49a2ac4096
6
+ metadata.gz: 4cf217669485713bbb6da8f17f607cdf121a64d3bdc7f4ec4c4a36b4b4fa9b913ae14f407fdf524b0eb110e85d9be6b743d8e606a623178c4cc06a19d871d663
7
+ data.tar.gz: db83bb8efd1368fd8023d105fba6c8ba0e8f8c591e80ffc73a16e6251d7468937f0ab965cd1c561f681c2336ebd7e3cc69d33fb3107d07e03b8ab56c47d3bc99
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.13)
5
5
  activesupport
6
6
  faraday (< 1.2.0)
7
7
  faraday_middleware
@@ -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.13'
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,16 +23,35 @@ 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
 
@@ -51,20 +70,21 @@ module CirroIOV2
51
70
  :filter_query,
52
71
  :tasks,
53
72
  :notification_payload,
54
- :epam_options) do
73
+ :epam_options,
74
+ keyword_init: true) do
55
75
  self::NESTED_RESPONSES = { tasks: :GigTaskListResponse }.freeze
56
76
  include Base
57
77
  end
58
78
 
59
- GigTaskResponse = Struct.new(:id, :object, :title, :base_price) do
79
+ GigTaskResponse = Struct.new(:id, :object, :title, :base_price, keyword_init: true) do
60
80
  include Base
61
81
  end
62
82
 
63
- GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id, :no_reward, :epam_bench_status) do
83
+ GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id, :no_reward, :epam_bench_status, keyword_init: true) do
64
84
  include Base
65
85
  end
66
86
 
67
- GigTimeActivityResponse = Struct.new(:id, :object, :gig_id, :user_id, :description, :duration_in_ms, :date) do
87
+ GigTimeActivityResponse = Struct.new(:id, :object, :gig_id, :user_id, :description, :duration_in_ms, :date, keyword_init: true) do
68
88
  include Base
69
89
  end
70
90
 
@@ -78,7 +98,8 @@ module CirroIOV2
78
98
  :multiplier,
79
99
  :delivery_date,
80
100
  :cost_center_key,
81
- :cost_center_data) do
101
+ :cost_center_data,
102
+ keyword_init: true) do
82
103
  include Base
83
104
  end
84
105
 
@@ -92,46 +113,47 @@ module CirroIOV2
92
113
  :reference_type,
93
114
  :user_id,
94
115
  :cost_center_key,
95
- :cost_center_data) do
116
+ :cost_center_data,
117
+ keyword_init: true) do
96
118
  include Base
97
119
  end
98
120
 
99
- NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id) do
121
+ NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id, keyword_init: true) do
100
122
  include Base
101
123
  end
102
124
 
103
- NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations) do
125
+ NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations, keyword_init: true) do
104
126
  self::NESTED_RESPONSES = { configurations: :NotificationConfigurationListResponse }.freeze
105
127
  include Base
106
128
  end
107
129
 
108
- NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale) do
130
+ NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale, keyword_init: true) do
109
131
  include Base
110
132
  end
111
133
 
112
- NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates) do
134
+ NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates, keyword_init: true) do
113
135
  self::NESTED_RESPONSES = { templates: :NotificationLayoutTemplateListResponse }.freeze
114
136
  include Base
115
137
  end
116
138
 
117
- NotificationLayoutTemplateResponse = Struct.new(:id, :notification_configuration_id, :notification_layout_id, :body) do
139
+ NotificationLayoutTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_layout_id, :body, keyword_init: true) do
118
140
  include Base
119
141
  end
120
142
 
121
- NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates) do
143
+ NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates, keyword_init: true) do
122
144
  self::NESTED_RESPONSES = { templates: :NotificationTemplateListResponse }.freeze
123
145
  include Base
124
146
  end
125
147
 
126
- NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body) do
148
+ NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body, keyword_init: true) do
127
149
  include Base
128
150
  end
129
151
 
130
- NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id) do
152
+ NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id, keyword_init: true) do
131
153
  include Base
132
154
  end
133
155
 
134
- EpamHeroesBadgeResponse = Struct.new(:content, :refs, :paging, :hasMoreResults) do
156
+ EpamHeroesBadgeResponse = Struct.new(:content, :refs, :paging, :hasMoreResults, keyword_init: true) do
135
157
  include Base
136
158
  end
137
159
 
@@ -140,8 +162,8 @@ module CirroIOV2
140
162
  return const_get(name) if const_defined? name
141
163
 
142
164
  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)
165
+ struct = Struct.new(:object, :url, :has_more, :data, keyword_init: true) if LIST_RESPONSES.include?(name)
166
+ struct = Struct.new(:id, :object, :deleted, keyword_init: true) if DELETE_RESPONSES.include?(name)
145
167
 
146
168
  return unless struct.present?
147
169
 
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.13
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-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport