sib-api-v3-sdk 5.2.2 → 5.2.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.
@@ -0,0 +1,8 @@
1
+ # SibApiV3Sdk::UpdateChildDomain
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **domain** | **String** | Value for the sender domain that will replace the existing domain | [optional]
7
+
8
+
@@ -17,6 +17,7 @@ require 'sib-api-v3-sdk/version'
17
17
  require 'sib-api-v3-sdk/configuration'
18
18
 
19
19
  # Models
20
+ require 'sib-api-v3-sdk/models/add_child_domain'
20
21
  require 'sib-api-v3-sdk/models/add_contact_to_list'
21
22
  require 'sib-api-v3-sdk/models/add_credits'
22
23
  require 'sib-api-v3-sdk/models/create_attribute'
@@ -55,6 +56,8 @@ require 'sib-api-v3-sdk/models/get_attributes_enumeration'
55
56
  require 'sib-api-v3-sdk/models/get_campaign_overview'
56
57
  require 'sib-api-v3-sdk/models/get_campaign_recipients'
57
58
  require 'sib-api-v3-sdk/models/get_campaign_stats'
59
+ require 'sib-api-v3-sdk/models/get_child_domain'
60
+ require 'sib-api-v3-sdk/models/get_child_domains'
58
61
  require 'sib-api-v3-sdk/models/get_child_info_api_keys'
59
62
  require 'sib-api-v3-sdk/models/get_child_info_api_keys_v2'
60
63
  require 'sib-api-v3-sdk/models/get_child_info_api_keys_v3'
@@ -108,6 +111,7 @@ require 'sib-api-v3-sdk/models/get_sms_event_report_events'
108
111
  require 'sib-api-v3-sdk/models/get_smtp_template_overview'
109
112
  require 'sib-api-v3-sdk/models/get_smtp_template_overview_sender'
110
113
  require 'sib-api-v3-sdk/models/get_smtp_templates'
114
+ require 'sib-api-v3-sdk/models/get_sso_token'
111
115
  require 'sib-api-v3-sdk/models/get_stats_by_domain'
112
116
  require 'sib-api-v3-sdk/models/get_transac_aggregated_sms_report'
113
117
  require 'sib-api-v3-sdk/models/get_transac_sms_report'
@@ -148,6 +152,7 @@ require 'sib-api-v3-sdk/models/update_attribute'
148
152
  require 'sib-api-v3-sdk/models/update_attribute_enumeration'
149
153
  require 'sib-api-v3-sdk/models/update_campaign_status'
150
154
  require 'sib-api-v3-sdk/models/update_child'
155
+ require 'sib-api-v3-sdk/models/update_child_domain'
151
156
  require 'sib-api-v3-sdk/models/update_contact'
152
157
  require 'sib-api-v3-sdk/models/update_email_campaign'
153
158
  require 'sib-api-v3-sdk/models/update_email_campaign_recipients'
@@ -141,6 +141,66 @@ module SibApiV3Sdk
141
141
  return data, status_code, headers
142
142
  end
143
143
 
144
+ # Creates a domain for a child account
145
+ #
146
+ # @param child_auth_key auth key of reseller's child
147
+ # @param add_child_domain Sender domain to add for a specific child account
148
+ # @param [Hash] opts the optional parameters
149
+ # @return [nil]
150
+ def create_child_domain(child_auth_key, add_child_domain, opts = {})
151
+ create_child_domain_with_http_info(child_auth_key, add_child_domain, opts)
152
+ return nil
153
+ end
154
+
155
+ # Creates a domain for a child account
156
+ #
157
+ # @param child_auth_key auth key of reseller's child
158
+ # @param add_child_domain Sender domain to add for a specific child account
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
161
+ def create_child_domain_with_http_info(child_auth_key, add_child_domain, opts = {})
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug "Calling API: ResellerApi.create_child_domain ..."
164
+ end
165
+ # verify the required parameter 'child_auth_key' is set
166
+ if @api_client.config.client_side_validation && child_auth_key.nil?
167
+ fail ArgumentError, "Missing the required parameter 'child_auth_key' when calling ResellerApi.create_child_domain"
168
+ end
169
+ # verify the required parameter 'add_child_domain' is set
170
+ if @api_client.config.client_side_validation && add_child_domain.nil?
171
+ fail ArgumentError, "Missing the required parameter 'add_child_domain' when calling ResellerApi.create_child_domain"
172
+ end
173
+ # resource path
174
+ local_var_path = "/reseller/children/{childAuthKey}/domains".sub('{' + 'childAuthKey' + '}', child_auth_key.to_s)
175
+
176
+ # query parameters
177
+ query_params = {}
178
+
179
+ # header parameters
180
+ header_params = {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
183
+ # HTTP header 'Content-Type'
184
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
185
+
186
+ # form parameters
187
+ form_params = {}
188
+
189
+ # http body (model)
190
+ post_body = @api_client.object_to_http_body(add_child_domain)
191
+ auth_names = ['api-key', 'partner-key']
192
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
193
+ :header_params => header_params,
194
+ :query_params => query_params,
195
+ :form_params => form_params,
196
+ :body => post_body,
197
+ :auth_names => auth_names)
198
+ if @api_client.config.debugging
199
+ @api_client.config.logger.debug "API called: ResellerApi#create_child_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
200
+ end
201
+ return data, status_code, headers
202
+ end
203
+
144
204
  # Creates a reseller child
145
205
  #
146
206
  # @param [Hash] opts the optional parameters
@@ -192,6 +252,66 @@ module SibApiV3Sdk
192
252
  return data, status_code, headers
193
253
  end
194
254
 
255
+ # Deletes the sender domain of the reseller child based on the childAuthKey and domainName passed
256
+ #
257
+ # @param child_auth_key auth key of reseller&#39;s child
258
+ # @param domain_name Pass the existing domain that needs to be deleted
259
+ # @param [Hash] opts the optional parameters
260
+ # @return [nil]
261
+ def delete_child_domain(child_auth_key, domain_name, opts = {})
262
+ delete_child_domain_with_http_info(child_auth_key, domain_name, opts)
263
+ return nil
264
+ end
265
+
266
+ # Deletes the sender domain of the reseller child based on the childAuthKey and domainName passed
267
+ #
268
+ # @param child_auth_key auth key of reseller&#39;s child
269
+ # @param domain_name Pass the existing domain that needs to be deleted
270
+ # @param [Hash] opts the optional parameters
271
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
272
+ def delete_child_domain_with_http_info(child_auth_key, domain_name, opts = {})
273
+ if @api_client.config.debugging
274
+ @api_client.config.logger.debug "Calling API: ResellerApi.delete_child_domain ..."
275
+ end
276
+ # verify the required parameter 'child_auth_key' is set
277
+ if @api_client.config.client_side_validation && child_auth_key.nil?
278
+ fail ArgumentError, "Missing the required parameter 'child_auth_key' when calling ResellerApi.delete_child_domain"
279
+ end
280
+ # verify the required parameter 'domain_name' is set
281
+ if @api_client.config.client_side_validation && domain_name.nil?
282
+ fail ArgumentError, "Missing the required parameter 'domain_name' when calling ResellerApi.delete_child_domain"
283
+ end
284
+ # resource path
285
+ local_var_path = "/reseller/children/{childAuthKey}/domains/{domainName}".sub('{' + 'childAuthKey' + '}', child_auth_key.to_s).sub('{' + 'domainName' + '}', domain_name.to_s)
286
+
287
+ # query parameters
288
+ query_params = {}
289
+
290
+ # header parameters
291
+ header_params = {}
292
+ # HTTP header 'Accept' (if needed)
293
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
294
+ # HTTP header 'Content-Type'
295
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
296
+
297
+ # form parameters
298
+ form_params = {}
299
+
300
+ # http body (model)
301
+ post_body = nil
302
+ auth_names = ['api-key', 'partner-key']
303
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
304
+ :header_params => header_params,
305
+ :query_params => query_params,
306
+ :form_params => form_params,
307
+ :body => post_body,
308
+ :auth_names => auth_names)
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug "API called: ResellerApi#delete_child_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
311
+ end
312
+ return data, status_code, headers
313
+ end
314
+
195
315
  # Deletes a single reseller child based on the childAuthKey supplied
196
316
  #
197
317
  # @param child_auth_key auth key of reseller&#39;s child
@@ -306,6 +426,61 @@ module SibApiV3Sdk
306
426
  return data, status_code, headers
307
427
  end
308
428
 
429
+ # Gets all the sender domains of a specific child account
430
+ #
431
+ # @param child_auth_key auth key of reseller&#39;s child
432
+ # @param [Hash] opts the optional parameters
433
+ # @return [GetChildDomains]
434
+ def get_child_domains(child_auth_key, opts = {})
435
+ data, _status_code, _headers = get_child_domains_with_http_info(child_auth_key, opts)
436
+ return data
437
+ end
438
+
439
+ # Gets all the sender domains of a specific child account
440
+ #
441
+ # @param child_auth_key auth key of reseller&#39;s child
442
+ # @param [Hash] opts the optional parameters
443
+ # @return [Array<(GetChildDomains, Fixnum, Hash)>] GetChildDomains data, response status code and response headers
444
+ def get_child_domains_with_http_info(child_auth_key, opts = {})
445
+ if @api_client.config.debugging
446
+ @api_client.config.logger.debug "Calling API: ResellerApi.get_child_domains ..."
447
+ end
448
+ # verify the required parameter 'child_auth_key' is set
449
+ if @api_client.config.client_side_validation && child_auth_key.nil?
450
+ fail ArgumentError, "Missing the required parameter 'child_auth_key' when calling ResellerApi.get_child_domains"
451
+ end
452
+ # resource path
453
+ local_var_path = "/reseller/children/{childAuthKey}/domains".sub('{' + 'childAuthKey' + '}', child_auth_key.to_s)
454
+
455
+ # query parameters
456
+ query_params = {}
457
+
458
+ # header parameters
459
+ header_params = {}
460
+ # HTTP header 'Accept' (if needed)
461
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
462
+ # HTTP header 'Content-Type'
463
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
464
+
465
+ # form parameters
466
+ form_params = {}
467
+
468
+ # http body (model)
469
+ post_body = nil
470
+ auth_names = ['api-key', 'partner-key']
471
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
472
+ :header_params => header_params,
473
+ :query_params => query_params,
474
+ :form_params => form_params,
475
+ :body => post_body,
476
+ :auth_names => auth_names,
477
+ :return_type => 'GetChildDomains')
478
+ if @api_client.config.debugging
479
+ @api_client.config.logger.debug "API called: ResellerApi#get_child_domains\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
480
+ end
481
+ return data, status_code, headers
482
+ end
483
+
309
484
  # Gets the info about a specific child account
310
485
  #
311
486
  # @param child_auth_key auth key of reseller&#39;s child
@@ -410,6 +585,61 @@ module SibApiV3Sdk
410
585
  return data, status_code, headers
411
586
  end
412
587
 
588
+ # Generates a session token which will remain valid for a short period of time only.
589
+ #
590
+ # @param child_auth_key auth key of reseller&#39;s child
591
+ # @param [Hash] opts the optional parameters
592
+ # @return [GetSsoToken]
593
+ def get_sso_token(child_auth_key, opts = {})
594
+ data, _status_code, _headers = get_sso_token_with_http_info(child_auth_key, opts)
595
+ return data
596
+ end
597
+
598
+ # Generates a session token which will remain valid for a short period of time only.
599
+ #
600
+ # @param child_auth_key auth key of reseller&#39;s child
601
+ # @param [Hash] opts the optional parameters
602
+ # @return [Array<(GetSsoToken, Fixnum, Hash)>] GetSsoToken data, response status code and response headers
603
+ def get_sso_token_with_http_info(child_auth_key, opts = {})
604
+ if @api_client.config.debugging
605
+ @api_client.config.logger.debug "Calling API: ResellerApi.get_sso_token ..."
606
+ end
607
+ # verify the required parameter 'child_auth_key' is set
608
+ if @api_client.config.client_side_validation && child_auth_key.nil?
609
+ fail ArgumentError, "Missing the required parameter 'child_auth_key' when calling ResellerApi.get_sso_token"
610
+ end
611
+ # resource path
612
+ local_var_path = "/reseller/children/{childAuthKey}/auth".sub('{' + 'childAuthKey' + '}', child_auth_key.to_s)
613
+
614
+ # query parameters
615
+ query_params = {}
616
+
617
+ # header parameters
618
+ header_params = {}
619
+ # HTTP header 'Accept' (if needed)
620
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
621
+ # HTTP header 'Content-Type'
622
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
623
+
624
+ # form parameters
625
+ form_params = {}
626
+
627
+ # http body (model)
628
+ post_body = nil
629
+ auth_names = ['api-key', 'partner-key']
630
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
631
+ :header_params => header_params,
632
+ :query_params => query_params,
633
+ :form_params => form_params,
634
+ :body => post_body,
635
+ :auth_names => auth_names,
636
+ :return_type => 'GetSsoToken')
637
+ if @api_client.config.debugging
638
+ @api_client.config.logger.debug "API called: ResellerApi#get_sso_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
639
+ end
640
+ return data, status_code, headers
641
+ end
642
+
413
643
  # Remove Email and/or SMS credits from a specific child account
414
644
  #
415
645
  # @param child_auth_key auth key of reseller&#39;s child
@@ -471,6 +701,72 @@ module SibApiV3Sdk
471
701
  return data, status_code, headers
472
702
  end
473
703
 
704
+ # Updates the sender domain of reseller's child based on the childAuthKey and domainName passed
705
+ #
706
+ # @param child_auth_key auth key of reseller&#39;s child
707
+ # @param domain_name Pass the existing domain that needs to be updated
708
+ # @param update_child_domain value to update for sender domain
709
+ # @param [Hash] opts the optional parameters
710
+ # @return [nil]
711
+ def update_child_domain(child_auth_key, domain_name, update_child_domain, opts = {})
712
+ update_child_domain_with_http_info(child_auth_key, domain_name, update_child_domain, opts)
713
+ return nil
714
+ end
715
+
716
+ # Updates the sender domain of reseller&#39;s child based on the childAuthKey and domainName passed
717
+ #
718
+ # @param child_auth_key auth key of reseller&#39;s child
719
+ # @param domain_name Pass the existing domain that needs to be updated
720
+ # @param update_child_domain value to update for sender domain
721
+ # @param [Hash] opts the optional parameters
722
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
723
+ def update_child_domain_with_http_info(child_auth_key, domain_name, update_child_domain, opts = {})
724
+ if @api_client.config.debugging
725
+ @api_client.config.logger.debug "Calling API: ResellerApi.update_child_domain ..."
726
+ end
727
+ # verify the required parameter 'child_auth_key' is set
728
+ if @api_client.config.client_side_validation && child_auth_key.nil?
729
+ fail ArgumentError, "Missing the required parameter 'child_auth_key' when calling ResellerApi.update_child_domain"
730
+ end
731
+ # verify the required parameter 'domain_name' is set
732
+ if @api_client.config.client_side_validation && domain_name.nil?
733
+ fail ArgumentError, "Missing the required parameter 'domain_name' when calling ResellerApi.update_child_domain"
734
+ end
735
+ # verify the required parameter 'update_child_domain' is set
736
+ if @api_client.config.client_side_validation && update_child_domain.nil?
737
+ fail ArgumentError, "Missing the required parameter 'update_child_domain' when calling ResellerApi.update_child_domain"
738
+ end
739
+ # resource path
740
+ local_var_path = "/reseller/children/{childAuthKey}/domains/{domainName}".sub('{' + 'childAuthKey' + '}', child_auth_key.to_s).sub('{' + 'domainName' + '}', domain_name.to_s)
741
+
742
+ # query parameters
743
+ query_params = {}
744
+
745
+ # header parameters
746
+ header_params = {}
747
+ # HTTP header 'Accept' (if needed)
748
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
749
+ # HTTP header 'Content-Type'
750
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
751
+
752
+ # form parameters
753
+ form_params = {}
754
+
755
+ # http body (model)
756
+ post_body = @api_client.object_to_http_body(update_child_domain)
757
+ auth_names = ['api-key', 'partner-key']
758
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
759
+ :header_params => header_params,
760
+ :query_params => query_params,
761
+ :form_params => form_params,
762
+ :body => post_body,
763
+ :auth_names => auth_names)
764
+ if @api_client.config.debugging
765
+ @api_client.config.logger.debug "API called: ResellerApi#update_child_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
766
+ end
767
+ return data, status_code, headers
768
+ end
769
+
474
770
  # Updates infos of reseller's child based on the childAuthKey supplied
475
771
  #
476
772
  # @param child_auth_key auth key of reseller&#39;s child
@@ -0,0 +1,189 @@
1
+ =begin
2
+ #SendinBlue API
3
+
4
+ #SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
5
+
6
+ OpenAPI spec version: 3.0.0
7
+ Contact: contact@sendinblue.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SibApiV3Sdk
16
+
17
+ class AddChildDomain
18
+ # Sender domain to add for a specific child account
19
+ attr_accessor :domain
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'domain' => :'domain'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'domain' => :'String'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'domain')
45
+ self.domain = attributes[:'domain']
46
+ end
47
+
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properties with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ return invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return true
61
+ end
62
+
63
+ # Checks equality by comparing each attribute.
64
+ # @param [Object] Object to be compared
65
+ def ==(o)
66
+ return true if self.equal?(o)
67
+ self.class == o.class &&
68
+ domain == o.domain
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [domain].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def build_from_hash(attributes)
87
+ return nil unless attributes.is_a?(Hash)
88
+ self.class.swagger_types.each_pair do |key, type|
89
+ if type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
93
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
98
+ end
99
+
100
+ self
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def _deserialize(type, value)
108
+ case type.to_sym
109
+ when :DateTime
110
+ DateTime.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :BOOLEAN
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ temp_model = SibApiV3Sdk.const_get(type).new
141
+ temp_model.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map{ |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+
187
+ end
188
+
189
+ end