license_manager 0.3.1 → 0.3.2

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.
@@ -19,6 +19,69 @@ module LicenseManager
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Start connecting a Slack channel
23
+ # Returns the URL of Slack's consent screen, where the user picks the channel getting the product's notifications. Slack then redirects to the app's integrations page. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
+ # @param product_id [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [SlackAuthorize]
27
+ def authorize_slack(product_id, opts = {})
28
+ data, _status_code, _headers = authorize_slack_with_http_info(product_id, opts)
29
+ data
30
+ end
31
+
32
+ # Start connecting a Slack channel
33
+ # Returns the URL of Slack's consent screen, where the user picks the channel getting the product's notifications. Slack then redirects to the app's integrations page. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
34
+ # @param product_id [String]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(SlackAuthorize, Integer, Hash)>] SlackAuthorize data, response status code and response headers
37
+ def authorize_slack_with_http_info(product_id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: IntegrationsApi.authorize_slack ...'
40
+ end
41
+ # verify the required parameter 'product_id' is set
42
+ if @api_client.config.client_side_validation && product_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'product_id' when calling IntegrationsApi.authorize_slack"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/products/{productId}/integrations/slack/authorize'.sub('{productId}', CGI.escape(product_id.to_s))
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:debug_body]
61
+
62
+ # return_type
63
+ return_type = opts[:debug_return_type] || 'SlackAuthorize'
64
+
65
+ # auth_names
66
+ auth_names = opts[:debug_auth_names] || ['apiKey']
67
+
68
+ new_options = opts.merge(
69
+ :operation => :"IntegrationsApi.authorize_slack",
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => return_type
76
+ )
77
+
78
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: IntegrationsApi#authorize_slack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+
22
85
  # Check an integration
23
86
  # Checks right away, as done every day, that the API key still works and can manage the webhook endpoint, which is pointed at the server's webhook URL again (or created again when it was deleted). Updates the status. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
87
  # @param id [String]
@@ -230,6 +293,69 @@ module LicenseManager
230
293
  return data, status_code, headers
231
294
  end
232
295
 
296
+ # Remove a Slack connection
297
+ # Stops posting to the channel and revokes the installation's token in Slack. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:delete` when called with a session, granted by the member's role. API keys aren't limited by roles.
298
+ # @param id [String]
299
+ # @param [Hash] opts the optional parameters
300
+ # @return [nil]
301
+ def delete_slack_connection(id, opts = {})
302
+ delete_slack_connection_with_http_info(id, opts)
303
+ nil
304
+ end
305
+
306
+ # Remove a Slack connection
307
+ # Stops posting to the channel and revokes the installation&#39;s token in Slack. Doesn&#39;t accept tokens: only API keys and sessions. **Required role permission**: &#x60;integration:delete&#x60; when called with a session, granted by the member&#39;s role. API keys aren&#39;t limited by roles.
308
+ # @param id [String]
309
+ # @param [Hash] opts the optional parameters
310
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
311
+ def delete_slack_connection_with_http_info(id, opts = {})
312
+ if @api_client.config.debugging
313
+ @api_client.config.logger.debug 'Calling API: IntegrationsApi.delete_slack_connection ...'
314
+ end
315
+ # verify the required parameter 'id' is set
316
+ if @api_client.config.client_side_validation && id.nil?
317
+ fail ArgumentError, "Missing the required parameter 'id' when calling IntegrationsApi.delete_slack_connection"
318
+ end
319
+ # resource path
320
+ local_var_path = '/v1/slack-connections/{id}'.sub('{id}', CGI.escape(id.to_s))
321
+
322
+ # query parameters
323
+ query_params = opts[:query_params] || {}
324
+
325
+ # header parameters
326
+ header_params = opts[:header_params] || {}
327
+ # HTTP header 'Accept' (if needed)
328
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
329
+
330
+ # form parameters
331
+ form_params = opts[:form_params] || {}
332
+
333
+ # http body (model)
334
+ post_body = opts[:debug_body]
335
+
336
+ # return_type
337
+ return_type = opts[:debug_return_type]
338
+
339
+ # auth_names
340
+ auth_names = opts[:debug_auth_names] || ['apiKey']
341
+
342
+ new_options = opts.merge(
343
+ :operation => :"IntegrationsApi.delete_slack_connection",
344
+ :header_params => header_params,
345
+ :query_params => query_params,
346
+ :form_params => form_params,
347
+ :body => post_body,
348
+ :auth_names => auth_names,
349
+ :return_type => return_type
350
+ )
351
+
352
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug "API called: IntegrationsApi#delete_slack_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
355
+ end
356
+ return data, status_code, headers
357
+ end
358
+
233
359
  # Delete a mapping
234
360
  # Paying the price no longer creates licenses. The licenses it created stay. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
235
361
  # @param id [String]
@@ -356,6 +482,69 @@ module LicenseManager
356
482
  return data, status_code, headers
357
483
  end
358
484
 
485
+ # Get the Slack integration of a product
486
+ # Slack channels getting notifications about the product's licenses: purchases, renewals, failed payments and cancellations. Doesn't accept tokens: only API keys and sessions.
487
+ # @param product_id [String]
488
+ # @param [Hash] opts the optional parameters
489
+ # @return [SlackIntegration]
490
+ def get_slack_integration(product_id, opts = {})
491
+ data, _status_code, _headers = get_slack_integration_with_http_info(product_id, opts)
492
+ data
493
+ end
494
+
495
+ # Get the Slack integration of a product
496
+ # Slack channels getting notifications about the product&#39;s licenses: purchases, renewals, failed payments and cancellations. Doesn&#39;t accept tokens: only API keys and sessions.
497
+ # @param product_id [String]
498
+ # @param [Hash] opts the optional parameters
499
+ # @return [Array<(SlackIntegration, Integer, Hash)>] SlackIntegration data, response status code and response headers
500
+ def get_slack_integration_with_http_info(product_id, opts = {})
501
+ if @api_client.config.debugging
502
+ @api_client.config.logger.debug 'Calling API: IntegrationsApi.get_slack_integration ...'
503
+ end
504
+ # verify the required parameter 'product_id' is set
505
+ if @api_client.config.client_side_validation && product_id.nil?
506
+ fail ArgumentError, "Missing the required parameter 'product_id' when calling IntegrationsApi.get_slack_integration"
507
+ end
508
+ # resource path
509
+ local_var_path = '/v1/products/{productId}/integrations/slack'.sub('{productId}', CGI.escape(product_id.to_s))
510
+
511
+ # query parameters
512
+ query_params = opts[:query_params] || {}
513
+
514
+ # header parameters
515
+ header_params = opts[:header_params] || {}
516
+ # HTTP header 'Accept' (if needed)
517
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
518
+
519
+ # form parameters
520
+ form_params = opts[:form_params] || {}
521
+
522
+ # http body (model)
523
+ post_body = opts[:debug_body]
524
+
525
+ # return_type
526
+ return_type = opts[:debug_return_type] || 'SlackIntegration'
527
+
528
+ # auth_names
529
+ auth_names = opts[:debug_auth_names] || ['apiKey']
530
+
531
+ new_options = opts.merge(
532
+ :operation => :"IntegrationsApi.get_slack_integration",
533
+ :header_params => header_params,
534
+ :query_params => query_params,
535
+ :form_params => form_params,
536
+ :body => post_body,
537
+ :auth_names => auth_names,
538
+ :return_type => return_type
539
+ )
540
+
541
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
542
+ if @api_client.config.debugging
543
+ @api_client.config.logger.debug "API called: IntegrationsApi#get_slack_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
544
+ end
545
+ return data, status_code, headers
546
+ end
547
+
359
548
  # Get the Stripe integration of a product
360
549
  # The organization connects one Stripe account for its live products, and one in test mode for its test products. Its mappings tell which Stripe prices create licenses of the product. Doesn't accept tokens: only API keys and sessions.
361
550
  # @param product_id [String]
@@ -482,6 +671,69 @@ module LicenseManager
482
671
  return data, status_code, headers
483
672
  end
484
673
 
674
+ # Send a test message to a Slack channel
675
+ # Posts a message to the channel, to check it gets the notifications. Marks the connection `revoked` when Slack says it won't work again. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
676
+ # @param id [String]
677
+ # @param [Hash] opts the optional parameters
678
+ # @return [SlackConnection]
679
+ def test_slack_connection(id, opts = {})
680
+ data, _status_code, _headers = test_slack_connection_with_http_info(id, opts)
681
+ data
682
+ end
683
+
684
+ # Send a test message to a Slack channel
685
+ # Posts a message to the channel, to check it gets the notifications. Marks the connection &#x60;revoked&#x60; when Slack says it won&#39;t work again. Doesn&#39;t accept tokens: only API keys and sessions. **Required role permission**: &#x60;integration:update&#x60; when called with a session, granted by the member&#39;s role. API keys aren&#39;t limited by roles.
686
+ # @param id [String]
687
+ # @param [Hash] opts the optional parameters
688
+ # @return [Array<(SlackConnection, Integer, Hash)>] SlackConnection data, response status code and response headers
689
+ def test_slack_connection_with_http_info(id, opts = {})
690
+ if @api_client.config.debugging
691
+ @api_client.config.logger.debug 'Calling API: IntegrationsApi.test_slack_connection ...'
692
+ end
693
+ # verify the required parameter 'id' is set
694
+ if @api_client.config.client_side_validation && id.nil?
695
+ fail ArgumentError, "Missing the required parameter 'id' when calling IntegrationsApi.test_slack_connection"
696
+ end
697
+ # resource path
698
+ local_var_path = '/v1/slack-connections/{id}/test'.sub('{id}', CGI.escape(id.to_s))
699
+
700
+ # query parameters
701
+ query_params = opts[:query_params] || {}
702
+
703
+ # header parameters
704
+ header_params = opts[:header_params] || {}
705
+ # HTTP header 'Accept' (if needed)
706
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
707
+
708
+ # form parameters
709
+ form_params = opts[:form_params] || {}
710
+
711
+ # http body (model)
712
+ post_body = opts[:debug_body]
713
+
714
+ # return_type
715
+ return_type = opts[:debug_return_type] || 'SlackConnection'
716
+
717
+ # auth_names
718
+ auth_names = opts[:debug_auth_names] || ['apiKey']
719
+
720
+ new_options = opts.merge(
721
+ :operation => :"IntegrationsApi.test_slack_connection",
722
+ :header_params => header_params,
723
+ :query_params => query_params,
724
+ :form_params => form_params,
725
+ :body => post_body,
726
+ :auth_names => auth_names,
727
+ :return_type => return_type
728
+ )
729
+
730
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
731
+ if @api_client.config.debugging
732
+ @api_client.config.logger.debug "API called: IntegrationsApi#test_slack_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
733
+ end
734
+ return data, status_code, headers
735
+ end
736
+
485
737
  # Update an integration
486
738
  # Changes the settings of the integration, for every product of its mode. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
487
739
  # @param id [String]
@@ -556,6 +808,80 @@ module LicenseManager
556
808
  return data, status_code, headers
557
809
  end
558
810
 
811
+ # Update a Slack connection
812
+ # Changes the notifications the channel gets. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
813
+ # @param id [String]
814
+ # @param update_slack_connection [UpdateSlackConnection]
815
+ # @param [Hash] opts the optional parameters
816
+ # @return [SlackConnection]
817
+ def update_slack_connection(id, update_slack_connection, opts = {})
818
+ data, _status_code, _headers = update_slack_connection_with_http_info(id, update_slack_connection, opts)
819
+ data
820
+ end
821
+
822
+ # Update a Slack connection
823
+ # Changes the notifications the channel gets. Doesn&#39;t accept tokens: only API keys and sessions. **Required role permission**: &#x60;integration:update&#x60; when called with a session, granted by the member&#39;s role. API keys aren&#39;t limited by roles.
824
+ # @param id [String]
825
+ # @param update_slack_connection [UpdateSlackConnection]
826
+ # @param [Hash] opts the optional parameters
827
+ # @return [Array<(SlackConnection, Integer, Hash)>] SlackConnection data, response status code and response headers
828
+ def update_slack_connection_with_http_info(id, update_slack_connection, opts = {})
829
+ if @api_client.config.debugging
830
+ @api_client.config.logger.debug 'Calling API: IntegrationsApi.update_slack_connection ...'
831
+ end
832
+ # verify the required parameter 'id' is set
833
+ if @api_client.config.client_side_validation && id.nil?
834
+ fail ArgumentError, "Missing the required parameter 'id' when calling IntegrationsApi.update_slack_connection"
835
+ end
836
+ # verify the required parameter 'update_slack_connection' is set
837
+ if @api_client.config.client_side_validation && update_slack_connection.nil?
838
+ fail ArgumentError, "Missing the required parameter 'update_slack_connection' when calling IntegrationsApi.update_slack_connection"
839
+ end
840
+ # resource path
841
+ local_var_path = '/v1/slack-connections/{id}'.sub('{id}', CGI.escape(id.to_s))
842
+
843
+ # query parameters
844
+ query_params = opts[:query_params] || {}
845
+
846
+ # header parameters
847
+ header_params = opts[:header_params] || {}
848
+ # HTTP header 'Accept' (if needed)
849
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
850
+ # HTTP header 'Content-Type'
851
+ content_type = @api_client.select_header_content_type(['application/json'])
852
+ if !content_type.nil?
853
+ header_params['Content-Type'] = content_type
854
+ end
855
+
856
+ # form parameters
857
+ form_params = opts[:form_params] || {}
858
+
859
+ # http body (model)
860
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_slack_connection)
861
+
862
+ # return_type
863
+ return_type = opts[:debug_return_type] || 'SlackConnection'
864
+
865
+ # auth_names
866
+ auth_names = opts[:debug_auth_names] || ['apiKey']
867
+
868
+ new_options = opts.merge(
869
+ :operation => :"IntegrationsApi.update_slack_connection",
870
+ :header_params => header_params,
871
+ :query_params => query_params,
872
+ :form_params => form_params,
873
+ :body => post_body,
874
+ :auth_names => auth_names,
875
+ :return_type => return_type
876
+ )
877
+
878
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
879
+ if @api_client.config.debugging
880
+ @api_client.config.logger.debug "API called: IntegrationsApi#update_slack_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
881
+ end
882
+ return data, status_code, headers
883
+ end
884
+
559
885
  # Change the policy of a mapping
560
886
  # Only affects the licenses created afterwards. Doesn't accept tokens: only API keys and sessions. **Required role permission**: `integration:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
561
887
  # @param id [String]
@@ -0,0 +1,178 @@
1
+ =begin
2
+ #LicenseManager API
3
+
4
+ #Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LicenseManager
17
+ class SlackAuthorize < ApiModelBase
18
+ # Slack's consent screen: open it in the browser to pick the channel. Valid 10 minutes.
19
+ attr_accessor :url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'url' => :'url'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Returns attribute type mapping
52
+ def self.acceptable_openapi_types
53
+ openapi_types
54
+ end
55
+
56
+ # Returns the nullable attributes
57
+ def self.acceptable_openapi_nullable
58
+ openapi_nullable
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::SlackAuthorize` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::SlackAuthorize`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'url')
78
+ self.url = attributes[:'url']
79
+ else
80
+ self.url = nil
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ if @url.nil?
90
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ return false if @url.nil?
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] url Value to be assigned
106
+ def url=(url)
107
+ if url.nil?
108
+ fail ArgumentError, 'url cannot be nil'
109
+ end
110
+
111
+ @url = url
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ url == o.url
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [url].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ # include attributes inherited from allOf parents (the nearest declaration wins)
141
+ map = acceptable_attribute_map
142
+ transformed_hash = {}
143
+ acceptable_openapi_types.each_pair do |key, type|
144
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ # include attributes inherited from allOf parents (the nearest declaration wins)
164
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
165
+ value = self.send(attr)
166
+ if value.nil?
167
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
168
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
169
+ end
170
+
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ end
177
+
178
+ end