rcs 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/lib/environment.rb +7 -0
  3. data/lib/gemconfig.rb +14 -0
  4. data/lib/rcs/company/client.rb +416 -0
  5. data/lib/rcs/company/types/company_register_response.rb +63 -0
  6. data/lib/rcs/company/types/company_register_response_brand.rb +67 -0
  7. data/lib/rcs/company/types/company_update_response.rb +63 -0
  8. data/lib/rcs/company/types/company_update_response_brand.rb +67 -0
  9. data/lib/rcs/send/client.rb +343 -0
  10. data/lib/rcs/send/types/send_mms_response.rb +67 -0
  11. data/lib/rcs/send/types/send_rcs_response.rb +67 -0
  12. data/lib/rcs/send/types/send_sms_response.rb +67 -0
  13. data/lib/rcs/types/action.rb +146 -0
  14. data/lib/rcs/types/action_lat_long.rb +68 -0
  15. data/lib/rcs/types/action_type.rb +16 -0
  16. data/lib/rcs/types/additional_email.rb +65 -0
  17. data/lib/rcs/types/additional_phone_number.rb +65 -0
  18. data/lib/rcs/types/additional_website.rb +65 -0
  19. data/lib/rcs/types/bad_request_error_body.rb +57 -0
  20. data/lib/rcs/types/card.rb +90 -0
  21. data/lib/rcs/types/company.rb +268 -0
  22. data/lib/rcs/types/company_additional_emails_item.rb +67 -0
  23. data/lib/rcs/types/company_additional_phone_numbers_item.rb +67 -0
  24. data/lib/rcs/types/company_additional_websites_item.rb +67 -0
  25. data/lib/rcs/types/company_contact.rb +117 -0
  26. data/lib/rcs/types/company_details.rb +110 -0
  27. data/lib/rcs/types/forbidden_error_body.rb +57 -0
  28. data/lib/rcs/types/internal_server_error_body.rb +57 -0
  29. data/lib/rcs/types/optionals.rb +99 -0
  30. data/lib/rcs/types/point_of_contact.rb +72 -0
  31. data/lib/rcs/types/rcs_functionalities.rb +117 -0
  32. data/lib/rcs/types/unauthorized_error_body.rb +57 -0
  33. data/lib/rcs.rb +126 -0
  34. data/lib/requests.rb +163 -0
  35. data/lib/types_export.rb +29 -0
  36. metadata +158 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f65329659fa99fc103cbac99eca161f7703560a665a9e8c2a60c7ccc6555e074
4
+ data.tar.gz: d81483384221c609fa37dad833cb683d2c8fc3d516a08024f87cb3c922eeaf1d
5
+ SHA512:
6
+ metadata.gz: fb28d812c14f45fed3c74e32e0e6177fd939b1b94e3fc2941b43d3ad556fde1729ab9b41c66185c9f5ba8d2cc82706016a17b9c0bfae595544d0f339fca91a8e
7
+ data.tar.gz: 42c5b7d35da195ab0b37031792e5badf9721d3b9ed69a67c3b1de9deb1bbecbfe1690a1f25ecccce8322f311994e0006406d7e3362e3cc0c047a32c0bc9e36eb
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ class Environment
5
+ DEFAULT = "https://www.trypinnacle.dev/api"
6
+ end
7
+ end
data/lib/gemconfig.rb ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Gemconfig
5
+ VERSION = ""
6
+ AUTHORS = [""].freeze
7
+ EMAIL = ""
8
+ SUMMARY = ""
9
+ DESCRIPTION = ""
10
+ HOMEPAGE = "https://github.com/pinnacle-dev/rcs-ruby"
11
+ SOURCE_CODE_URI = "https://github.com/pinnacle-dev/rcs-ruby"
12
+ CHANGELOG_URI = "https://github.com/pinnacle-dev/rcs-ruby/blob/master/CHANGELOG.md"
13
+ end
14
+ end
@@ -0,0 +1,416 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../requests"
4
+ require_relative "../types/company"
5
+ require "json"
6
+ require_relative "../types/company_details"
7
+ require_relative "../types/company_contact"
8
+ require_relative "../types/point_of_contact"
9
+ require_relative "../types/optionals"
10
+ require_relative "types/company_register_response"
11
+ require_relative "types/company_update_response"
12
+ require "async"
13
+
14
+ module Pinnacle
15
+ class CompanyClient
16
+ # @return [Pinnacle::RequestClient]
17
+ attr_reader :request_client
18
+
19
+ # @param request_client [Pinnacle::RequestClient]
20
+ # @return [Pinnacle::CompanyClient]
21
+ def initialize(request_client:)
22
+ @request_client = request_client
23
+ end
24
+
25
+ # Retrieve the company's information (i.e. approval status, company name, etc.).
26
+ # Search by company ID or company name.
27
+ #
28
+ # @param company_id [Integer] The unique identifier for the company
29
+ # @param company_name [String] The name of the company
30
+ # @param request_options [Pinnacle::RequestOptions]
31
+ # @return [Array<Pinnacle::Company>]
32
+ # @example
33
+ # api = Pinnacle::Client.new(
34
+ # base_url: "https://api.example.com",
35
+ # environment: Pinnacle::Environment::DEFAULT,
36
+ # api_key: "YOUR_API_KEY"
37
+ # )
38
+ # api.company.get
39
+ def get(company_id: nil, company_name: nil, request_options: nil)
40
+ response = @request_client.conn.get do |req|
41
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
42
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
43
+ req.headers = {
44
+ **(req.headers || {}),
45
+ **@request_client.get_headers,
46
+ **(request_options&.additional_headers || {})
47
+ }.compact
48
+ req.params = {
49
+ **(request_options&.additional_query_parameters || {}),
50
+ "companyId": company_id,
51
+ "companyName": company_name
52
+ }.compact
53
+ unless request_options.nil? || request_options&.additional_body_parameters.nil?
54
+ req.body = { **(request_options&.additional_body_parameters || {}) }.compact
55
+ end
56
+ req.url "#{@request_client.get_url(request_options: request_options)}/company"
57
+ end
58
+ parsed_json = JSON.parse(response.body)
59
+ parsed_json&.map do |item|
60
+ item = item.to_json
61
+ Pinnacle::Company.from_json(json_object: item)
62
+ end
63
+ end
64
+
65
+ # Register a company for RCS with the Pinnacle platform
66
+ #
67
+ # @param company [Hash] Request of type Pinnacle::CompanyDetails, as a Hash
68
+ # * :name (String)
69
+ # * :address (String)
70
+ # * :ein (String)
71
+ # * :description (String)
72
+ # * :brand_color (String)
73
+ # * :logo_url (String)
74
+ # * :hero_url (String)
75
+ # @param company_contact [Hash] Request of type Pinnacle::CompanyContact, as a Hash
76
+ # * :primary_website_url (String)
77
+ # * :primary_website_label (String)
78
+ # * :primary_phone (String)
79
+ # * :primary_phone_label (String)
80
+ # * :primary_email (String)
81
+ # * :primary_email_label (String)
82
+ # * :privacy_policy_url (String)
83
+ # * :tos_url (String)
84
+ # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
85
+ # * :poc_name (String)
86
+ # * :poc_title (String)
87
+ # * :poc_email (String)
88
+ # @param optionals [Hash] Request of type Pinnacle::Optionals, as a Hash
89
+ # * :additional_websites (Array<Pinnacle::AdditionalWebsite>)
90
+ # * :additional_phone_numbers (Array<Pinnacle::AdditionalPhoneNumber>)
91
+ # * :additional_emails (Array<Pinnacle::AdditionalEmail>)
92
+ # * :test_numbers (Array<String>)
93
+ # @param request_options [Pinnacle::RequestOptions]
94
+ # @return [Pinnacle::Company::CompanyRegisterResponse]
95
+ # @example
96
+ # api = Pinnacle::Client.new(
97
+ # base_url: "https://api.example.com",
98
+ # environment: Pinnacle::Environment::DEFAULT,
99
+ # api_key: "YOUR_API_KEY"
100
+ # )
101
+ # api.company.register(
102
+ # company: { name: "name", address: "address", ein: "ein", description: "description", brand_color: "brandColor", logo_url: "logoUrl", hero_url: "heroUrl" },
103
+ # company_contact: { primary_website_url: "primaryWebsiteUrl", primary_website_label: "primaryWebsiteLabel", primary_phone: "primaryPhone", primary_phone_label: "primaryPhoneLabel", primary_email: "primaryEmail", primary_email_label: "primaryEmailLabel", privacy_policy_url: "privacyPolicyUrl", tos_url: "tosUrl" },
104
+ # point_of_contact: { poc_name: "pocName", poc_title: "pocTitle", poc_email: "pocEmail" }
105
+ # )
106
+ def register(company:, company_contact:, point_of_contact:, optionals: nil, request_options: nil)
107
+ response = @request_client.conn.post do |req|
108
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
109
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
110
+ req.headers = {
111
+ **(req.headers || {}),
112
+ **@request_client.get_headers,
113
+ **(request_options&.additional_headers || {})
114
+ }.compact
115
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
116
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
117
+ end
118
+ req.body = {
119
+ **(request_options&.additional_body_parameters || {}),
120
+ company: company,
121
+ companyContact: company_contact,
122
+ pointOfContact: point_of_contact,
123
+ optionals: optionals
124
+ }.compact
125
+ req.url "#{@request_client.get_url(request_options: request_options)}/company/register"
126
+ end
127
+ Pinnacle::Company::CompanyRegisterResponse.from_json(json_object: response.body)
128
+ end
129
+
130
+ # Update a company on the Pinnacle platform
131
+ #
132
+ # @param company_id [String]
133
+ # @param company [Hash] Request of type Pinnacle::Company, as a Hash
134
+ # * :id (Integer)
135
+ # * :created_at (DateTime)
136
+ # * :name (String)
137
+ # * :address (String)
138
+ # * :ein (String)
139
+ # * :description (String)
140
+ # * :brand_color (String)
141
+ # * :logo_url (String)
142
+ # * :hero_url (String)
143
+ # * :primary_website_url (String)
144
+ # * :primary_website_label (String)
145
+ # * :primary_phone (String)
146
+ # * :primary_phone_label (String)
147
+ # * :primary_email (String)
148
+ # * :primary_email_label (String)
149
+ # * :privacy_policy_url (String)
150
+ # * :tos_url (String)
151
+ # * :poc_name (String)
152
+ # * :poc_title (String)
153
+ # * :poc_email (String)
154
+ # * :test_numbers (Array<String>)
155
+ # * :status (String)
156
+ # * :additional_websites (Array<Pinnacle::CompanyAdditionalWebsitesItem>)
157
+ # * :additional_emails (Array<Pinnacle::CompanyAdditionalEmailsItem>)
158
+ # * :additional_phone_numbers (Array<Pinnacle::CompanyAdditionalPhoneNumbersItem>)
159
+ # @param company_contact [Hash] Request of type Pinnacle::CompanyContact, as a Hash
160
+ # * :primary_website_url (String)
161
+ # * :primary_website_label (String)
162
+ # * :primary_phone (String)
163
+ # * :primary_phone_label (String)
164
+ # * :primary_email (String)
165
+ # * :primary_email_label (String)
166
+ # * :privacy_policy_url (String)
167
+ # * :tos_url (String)
168
+ # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
169
+ # * :poc_name (String)
170
+ # * :poc_title (String)
171
+ # * :poc_email (String)
172
+ # @param optionals [Hash] Request of type Pinnacle::Optionals, as a Hash
173
+ # * :additional_websites (Array<Pinnacle::AdditionalWebsite>)
174
+ # * :additional_phone_numbers (Array<Pinnacle::AdditionalPhoneNumber>)
175
+ # * :additional_emails (Array<Pinnacle::AdditionalEmail>)
176
+ # * :test_numbers (Array<String>)
177
+ # @param request_options [Pinnacle::RequestOptions]
178
+ # @return [Pinnacle::Company::CompanyUpdateResponse]
179
+ # @example
180
+ # api = Pinnacle::Client.new(
181
+ # base_url: "https://api.example.com",
182
+ # environment: Pinnacle::Environment::DEFAULT,
183
+ # api_key: "YOUR_API_KEY"
184
+ # )
185
+ # api.company.update(company_id: "companyId")
186
+ def update(company_id:, company: nil, company_contact: nil, point_of_contact: nil, optionals: nil,
187
+ request_options: nil)
188
+ response = @request_client.conn.post do |req|
189
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
190
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
191
+ req.headers = {
192
+ **(req.headers || {}),
193
+ **@request_client.get_headers,
194
+ **(request_options&.additional_headers || {})
195
+ }.compact
196
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
197
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
198
+ end
199
+ req.body = {
200
+ **(request_options&.additional_body_parameters || {}),
201
+ companyId: company_id,
202
+ company: company,
203
+ companyContact: company_contact,
204
+ pointOfContact: point_of_contact,
205
+ optionals: optionals
206
+ }.compact
207
+ req.url "#{@request_client.get_url(request_options: request_options)}/company/update"
208
+ end
209
+ Pinnacle::Company::CompanyUpdateResponse.from_json(json_object: response.body)
210
+ end
211
+ end
212
+
213
+ class AsyncCompanyClient
214
+ # @return [Pinnacle::AsyncRequestClient]
215
+ attr_reader :request_client
216
+
217
+ # @param request_client [Pinnacle::AsyncRequestClient]
218
+ # @return [Pinnacle::AsyncCompanyClient]
219
+ def initialize(request_client:)
220
+ @request_client = request_client
221
+ end
222
+
223
+ # Retrieve the company's information (i.e. approval status, company name, etc.).
224
+ # Search by company ID or company name.
225
+ #
226
+ # @param company_id [Integer] The unique identifier for the company
227
+ # @param company_name [String] The name of the company
228
+ # @param request_options [Pinnacle::RequestOptions]
229
+ # @return [Array<Pinnacle::Company>]
230
+ # @example
231
+ # api = Pinnacle::Client.new(
232
+ # base_url: "https://api.example.com",
233
+ # environment: Pinnacle::Environment::DEFAULT,
234
+ # api_key: "YOUR_API_KEY"
235
+ # )
236
+ # api.company.get
237
+ def get(company_id: nil, company_name: nil, request_options: nil)
238
+ Async do
239
+ response = @request_client.conn.get do |req|
240
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
241
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
242
+ req.headers = {
243
+ **(req.headers || {}),
244
+ **@request_client.get_headers,
245
+ **(request_options&.additional_headers || {})
246
+ }.compact
247
+ req.params = {
248
+ **(request_options&.additional_query_parameters || {}),
249
+ "companyId": company_id,
250
+ "companyName": company_name
251
+ }.compact
252
+ unless request_options.nil? || request_options&.additional_body_parameters.nil?
253
+ req.body = { **(request_options&.additional_body_parameters || {}) }.compact
254
+ end
255
+ req.url "#{@request_client.get_url(request_options: request_options)}/company"
256
+ end
257
+ parsed_json = JSON.parse(response.body)
258
+ parsed_json&.map do |item|
259
+ item = item.to_json
260
+ Pinnacle::Company.from_json(json_object: item)
261
+ end
262
+ end
263
+ end
264
+
265
+ # Register a company for RCS with the Pinnacle platform
266
+ #
267
+ # @param company [Hash] Request of type Pinnacle::CompanyDetails, as a Hash
268
+ # * :name (String)
269
+ # * :address (String)
270
+ # * :ein (String)
271
+ # * :description (String)
272
+ # * :brand_color (String)
273
+ # * :logo_url (String)
274
+ # * :hero_url (String)
275
+ # @param company_contact [Hash] Request of type Pinnacle::CompanyContact, as a Hash
276
+ # * :primary_website_url (String)
277
+ # * :primary_website_label (String)
278
+ # * :primary_phone (String)
279
+ # * :primary_phone_label (String)
280
+ # * :primary_email (String)
281
+ # * :primary_email_label (String)
282
+ # * :privacy_policy_url (String)
283
+ # * :tos_url (String)
284
+ # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
285
+ # * :poc_name (String)
286
+ # * :poc_title (String)
287
+ # * :poc_email (String)
288
+ # @param optionals [Hash] Request of type Pinnacle::Optionals, as a Hash
289
+ # * :additional_websites (Array<Pinnacle::AdditionalWebsite>)
290
+ # * :additional_phone_numbers (Array<Pinnacle::AdditionalPhoneNumber>)
291
+ # * :additional_emails (Array<Pinnacle::AdditionalEmail>)
292
+ # * :test_numbers (Array<String>)
293
+ # @param request_options [Pinnacle::RequestOptions]
294
+ # @return [Pinnacle::Company::CompanyRegisterResponse]
295
+ # @example
296
+ # api = Pinnacle::Client.new(
297
+ # base_url: "https://api.example.com",
298
+ # environment: Pinnacle::Environment::DEFAULT,
299
+ # api_key: "YOUR_API_KEY"
300
+ # )
301
+ # api.company.register(
302
+ # company: { name: "name", address: "address", ein: "ein", description: "description", brand_color: "brandColor", logo_url: "logoUrl", hero_url: "heroUrl" },
303
+ # company_contact: { primary_website_url: "primaryWebsiteUrl", primary_website_label: "primaryWebsiteLabel", primary_phone: "primaryPhone", primary_phone_label: "primaryPhoneLabel", primary_email: "primaryEmail", primary_email_label: "primaryEmailLabel", privacy_policy_url: "privacyPolicyUrl", tos_url: "tosUrl" },
304
+ # point_of_contact: { poc_name: "pocName", poc_title: "pocTitle", poc_email: "pocEmail" }
305
+ # )
306
+ def register(company:, company_contact:, point_of_contact:, optionals: nil, request_options: nil)
307
+ Async do
308
+ response = @request_client.conn.post do |req|
309
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
310
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
311
+ req.headers = {
312
+ **(req.headers || {}),
313
+ **@request_client.get_headers,
314
+ **(request_options&.additional_headers || {})
315
+ }.compact
316
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
317
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
318
+ end
319
+ req.body = {
320
+ **(request_options&.additional_body_parameters || {}),
321
+ company: company,
322
+ companyContact: company_contact,
323
+ pointOfContact: point_of_contact,
324
+ optionals: optionals
325
+ }.compact
326
+ req.url "#{@request_client.get_url(request_options: request_options)}/company/register"
327
+ end
328
+ Pinnacle::Company::CompanyRegisterResponse.from_json(json_object: response.body)
329
+ end
330
+ end
331
+
332
+ # Update a company on the Pinnacle platform
333
+ #
334
+ # @param company_id [String]
335
+ # @param company [Hash] Request of type Pinnacle::Company, as a Hash
336
+ # * :id (Integer)
337
+ # * :created_at (DateTime)
338
+ # * :name (String)
339
+ # * :address (String)
340
+ # * :ein (String)
341
+ # * :description (String)
342
+ # * :brand_color (String)
343
+ # * :logo_url (String)
344
+ # * :hero_url (String)
345
+ # * :primary_website_url (String)
346
+ # * :primary_website_label (String)
347
+ # * :primary_phone (String)
348
+ # * :primary_phone_label (String)
349
+ # * :primary_email (String)
350
+ # * :primary_email_label (String)
351
+ # * :privacy_policy_url (String)
352
+ # * :tos_url (String)
353
+ # * :poc_name (String)
354
+ # * :poc_title (String)
355
+ # * :poc_email (String)
356
+ # * :test_numbers (Array<String>)
357
+ # * :status (String)
358
+ # * :additional_websites (Array<Pinnacle::CompanyAdditionalWebsitesItem>)
359
+ # * :additional_emails (Array<Pinnacle::CompanyAdditionalEmailsItem>)
360
+ # * :additional_phone_numbers (Array<Pinnacle::CompanyAdditionalPhoneNumbersItem>)
361
+ # @param company_contact [Hash] Request of type Pinnacle::CompanyContact, as a Hash
362
+ # * :primary_website_url (String)
363
+ # * :primary_website_label (String)
364
+ # * :primary_phone (String)
365
+ # * :primary_phone_label (String)
366
+ # * :primary_email (String)
367
+ # * :primary_email_label (String)
368
+ # * :privacy_policy_url (String)
369
+ # * :tos_url (String)
370
+ # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
371
+ # * :poc_name (String)
372
+ # * :poc_title (String)
373
+ # * :poc_email (String)
374
+ # @param optionals [Hash] Request of type Pinnacle::Optionals, as a Hash
375
+ # * :additional_websites (Array<Pinnacle::AdditionalWebsite>)
376
+ # * :additional_phone_numbers (Array<Pinnacle::AdditionalPhoneNumber>)
377
+ # * :additional_emails (Array<Pinnacle::AdditionalEmail>)
378
+ # * :test_numbers (Array<String>)
379
+ # @param request_options [Pinnacle::RequestOptions]
380
+ # @return [Pinnacle::Company::CompanyUpdateResponse]
381
+ # @example
382
+ # api = Pinnacle::Client.new(
383
+ # base_url: "https://api.example.com",
384
+ # environment: Pinnacle::Environment::DEFAULT,
385
+ # api_key: "YOUR_API_KEY"
386
+ # )
387
+ # api.company.update(company_id: "companyId")
388
+ def update(company_id:, company: nil, company_contact: nil, point_of_contact: nil, optionals: nil,
389
+ request_options: nil)
390
+ Async do
391
+ response = @request_client.conn.post do |req|
392
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
393
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
394
+ req.headers = {
395
+ **(req.headers || {}),
396
+ **@request_client.get_headers,
397
+ **(request_options&.additional_headers || {})
398
+ }.compact
399
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
400
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
401
+ end
402
+ req.body = {
403
+ **(request_options&.additional_body_parameters || {}),
404
+ companyId: company_id,
405
+ company: company,
406
+ companyContact: company_contact,
407
+ pointOfContact: point_of_contact,
408
+ optionals: optionals
409
+ }.compact
410
+ req.url "#{@request_client.get_url(request_options: request_options)}/company/update"
411
+ end
412
+ Pinnacle::Company::CompanyUpdateResponse.from_json(json_object: response.body)
413
+ end
414
+ end
415
+ end
416
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "company_register_response_brand"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Pinnacle
8
+ class Company
9
+ class CompanyRegisterResponse
10
+ # @return [Pinnacle::Company::CompanyRegisterResponseBrand]
11
+ attr_reader :brand
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param brand [Pinnacle::Company::CompanyRegisterResponseBrand]
21
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
+ # @return [Pinnacle::Company::CompanyRegisterResponse]
23
+ def initialize(brand:, additional_properties: nil)
24
+ @brand = brand
25
+ @additional_properties = additional_properties
26
+ @_field_set = { "brand": brand }
27
+ end
28
+
29
+ # Deserialize a JSON object to an instance of CompanyRegisterResponse
30
+ #
31
+ # @param json_object [String]
32
+ # @return [Pinnacle::Company::CompanyRegisterResponse]
33
+ def self.from_json(json_object:)
34
+ struct = JSON.parse(json_object, object_class: OpenStruct)
35
+ parsed_json = JSON.parse(json_object)
36
+ if parsed_json["brand"].nil?
37
+ brand = nil
38
+ else
39
+ brand = parsed_json["brand"].to_json
40
+ brand = Pinnacle::Company::CompanyRegisterResponseBrand.from_json(json_object: brand)
41
+ end
42
+ new(brand: brand, additional_properties: struct)
43
+ end
44
+
45
+ # Serialize an instance of CompanyRegisterResponse to a JSON object
46
+ #
47
+ # @return [String]
48
+ def to_json(*_args)
49
+ @_field_set&.to_json
50
+ end
51
+
52
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
53
+ # hash and check each fields type against the current object's property
54
+ # definitions.
55
+ #
56
+ # @param obj [Object]
57
+ # @return [Void]
58
+ def self.validate_raw(obj:)
59
+ Pinnacle::Company::CompanyRegisterResponseBrand.validate_raw(obj: obj.brand)
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ class Company
8
+ class CompanyRegisterResponseBrand
9
+ # @return [String]
10
+ attr_reader :name
11
+ # @return [Float]
12
+ attr_reader :id
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param name [String]
22
+ # @param id [Float]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Pinnacle::Company::CompanyRegisterResponseBrand]
25
+ def initialize(name:, id:, additional_properties: nil)
26
+ @name = name
27
+ @id = id
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "name": name, "id": id }
30
+ end
31
+
32
+ # Deserialize a JSON object to an instance of CompanyRegisterResponseBrand
33
+ #
34
+ # @param json_object [String]
35
+ # @return [Pinnacle::Company::CompanyRegisterResponseBrand]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ name = parsed_json["name"]
40
+ id = parsed_json["id"]
41
+ new(
42
+ name: name,
43
+ id: id,
44
+ additional_properties: struct
45
+ )
46
+ end
47
+
48
+ # Serialize an instance of CompanyRegisterResponseBrand to a JSON object
49
+ #
50
+ # @return [String]
51
+ def to_json(*_args)
52
+ @_field_set&.to_json
53
+ end
54
+
55
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
56
+ # hash and check each fields type against the current object's property
57
+ # definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
63
+ obj.id.is_a?(Float) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "company_update_response_brand"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Pinnacle
8
+ class Company
9
+ class CompanyUpdateResponse
10
+ # @return [Pinnacle::Company::CompanyUpdateResponseBrand]
11
+ attr_reader :brand
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param brand [Pinnacle::Company::CompanyUpdateResponseBrand]
21
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
+ # @return [Pinnacle::Company::CompanyUpdateResponse]
23
+ def initialize(brand:, additional_properties: nil)
24
+ @brand = brand
25
+ @additional_properties = additional_properties
26
+ @_field_set = { "brand": brand }
27
+ end
28
+
29
+ # Deserialize a JSON object to an instance of CompanyUpdateResponse
30
+ #
31
+ # @param json_object [String]
32
+ # @return [Pinnacle::Company::CompanyUpdateResponse]
33
+ def self.from_json(json_object:)
34
+ struct = JSON.parse(json_object, object_class: OpenStruct)
35
+ parsed_json = JSON.parse(json_object)
36
+ if parsed_json["brand"].nil?
37
+ brand = nil
38
+ else
39
+ brand = parsed_json["brand"].to_json
40
+ brand = Pinnacle::Company::CompanyUpdateResponseBrand.from_json(json_object: brand)
41
+ end
42
+ new(brand: brand, additional_properties: struct)
43
+ end
44
+
45
+ # Serialize an instance of CompanyUpdateResponse to a JSON object
46
+ #
47
+ # @return [String]
48
+ def to_json(*_args)
49
+ @_field_set&.to_json
50
+ end
51
+
52
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
53
+ # hash and check each fields type against the current object's property
54
+ # definitions.
55
+ #
56
+ # @param obj [Object]
57
+ # @return [Void]
58
+ def self.validate_raw(obj:)
59
+ Pinnacle::Company::CompanyUpdateResponseBrand.validate_raw(obj: obj.brand)
60
+ end
61
+ end
62
+ end
63
+ end