late-sdk 0.0.619 → 0.0.621

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -0
  3. data/docs/EnableWhatsAppCallingLegacy200Response.md +3 -1
  4. data/docs/GetWhatsAppCalling200Response.md +5 -1
  5. data/docs/GetWhatsAppCallingConfig200Response.md +5 -1
  6. data/docs/StartWhatsAppCallerIdVerification200Response.md +22 -0
  7. data/docs/StartWhatsAppCallerIdVerificationRequest.md +18 -0
  8. data/docs/VerifyWhatsAppCallerIdRequest.md +18 -0
  9. data/docs/WhatsAppCallingApi.md +146 -0
  10. data/lib/zernio-sdk/api/whats_app_calling_api.rb +144 -0
  11. data/lib/zernio-sdk/models/enable_whats_app_calling_legacy200_response.rb +48 -4
  12. data/lib/zernio-sdk/models/get_whats_app_calling200_response.rb +58 -4
  13. data/lib/zernio-sdk/models/get_whats_app_calling_config200_response.rb +59 -5
  14. data/lib/zernio-sdk/models/start_whats_app_caller_id_verification200_response.rb +199 -0
  15. data/lib/zernio-sdk/models/start_whats_app_caller_id_verification_request.rb +183 -0
  16. data/lib/zernio-sdk/models/verify_whats_app_caller_id_request.rb +182 -0
  17. data/lib/zernio-sdk/version.rb +1 -1
  18. data/lib/zernio-sdk.rb +3 -0
  19. data/openapi.yaml +94 -2
  20. data/spec/api/whats_app_calling_api_spec.rb +26 -0
  21. data/spec/models/enable_whats_app_calling_legacy200_response_spec.rb +10 -0
  22. data/spec/models/get_whats_app_calling200_response_spec.rb +16 -0
  23. data/spec/models/get_whats_app_calling_config200_response_spec.rb +16 -0
  24. data/spec/models/start_whats_app_caller_id_verification200_response_spec.rb +52 -0
  25. data/spec/models/start_whats_app_caller_id_verification_request_spec.rb +40 -0
  26. data/spec/models/verify_whats_app_caller_id_request_spec.rb +36 -0
  27. data/zernio-sdk-0.0.621.gem +0 -0
  28. metadata +14 -2
  29. data/zernio-sdk-0.0.619.gem +0 -0
@@ -37,6 +37,34 @@ module Zernio
37
37
  # True when the number's country blocks business-initiated (outbound) WhatsApp calling; inbound still works.
38
38
  attr_accessor :outbound_disabled
39
39
 
40
+ # Caller ID the forward-leg callee sees on tel: forwards. business = this WhatsApp number; platform = a Zernio number (used when the number was brought by the customer and its caller ID is not verified for PSTN origination).
41
+ attr_accessor :caller_id_mode
42
+
43
+ # True once the number completed caller-ID verification, making tel: forwards display the business number itself.
44
+ attr_accessor :caller_id_verified
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
40
68
  # Attribute mapping from ruby-style variable name to JSON key.
41
69
  def self.attribute_map
42
70
  {
@@ -48,7 +76,9 @@ module Zernio
48
76
  :'sip_auth_username' => :'sipAuthUsername',
49
77
  :'sip_auth_password_configured' => :'sipAuthPasswordConfigured',
50
78
  :'call_icon_countries' => :'callIconCountries',
51
- :'outbound_disabled' => :'outboundDisabled'
79
+ :'outbound_disabled' => :'outboundDisabled',
80
+ :'caller_id_mode' => :'callerIdMode',
81
+ :'caller_id_verified' => :'callerIdVerified'
52
82
  }
53
83
  end
54
84
 
@@ -73,7 +103,9 @@ module Zernio
73
103
  :'sip_auth_username' => :'String',
74
104
  :'sip_auth_password_configured' => :'Boolean',
75
105
  :'call_icon_countries' => :'Array<String>',
76
- :'outbound_disabled' => :'Boolean'
106
+ :'outbound_disabled' => :'Boolean',
107
+ :'caller_id_mode' => :'String',
108
+ :'caller_id_verified' => :'Boolean'
77
109
  }
78
110
  end
79
111
 
@@ -140,6 +172,14 @@ module Zernio
140
172
  if attributes.key?(:'outbound_disabled')
141
173
  self.outbound_disabled = attributes[:'outbound_disabled']
142
174
  end
175
+
176
+ if attributes.key?(:'caller_id_mode')
177
+ self.caller_id_mode = attributes[:'caller_id_mode']
178
+ end
179
+
180
+ if attributes.key?(:'caller_id_verified')
181
+ self.caller_id_verified = attributes[:'caller_id_verified']
182
+ end
143
183
  end
144
184
 
145
185
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -154,9 +194,21 @@ module Zernio
154
194
  # @return true if the model is valid
155
195
  def valid?
156
196
  warn '[DEPRECATED] the `valid?` method is obsolete'
197
+ caller_id_mode_validator = EnumAttributeValidator.new('String', ["business", "platform"])
198
+ return false unless caller_id_mode_validator.valid?(@caller_id_mode)
157
199
  true
158
200
  end
159
201
 
202
+ # Custom attribute writer method checking allowed values (enum).
203
+ # @param [Object] caller_id_mode Object to be assigned
204
+ def caller_id_mode=(caller_id_mode)
205
+ validator = EnumAttributeValidator.new('String', ["business", "platform"])
206
+ unless validator.valid?(caller_id_mode)
207
+ fail ArgumentError, "invalid value for \"caller_id_mode\", must be one of #{validator.allowable_values}."
208
+ end
209
+ @caller_id_mode = caller_id_mode
210
+ end
211
+
160
212
  # Checks equality by comparing each attribute.
161
213
  # @param [Object] Object to be compared
162
214
  def ==(o)
@@ -170,7 +222,9 @@ module Zernio
170
222
  sip_auth_username == o.sip_auth_username &&
171
223
  sip_auth_password_configured == o.sip_auth_password_configured &&
172
224
  call_icon_countries == o.call_icon_countries &&
173
- outbound_disabled == o.outbound_disabled
225
+ outbound_disabled == o.outbound_disabled &&
226
+ caller_id_mode == o.caller_id_mode &&
227
+ caller_id_verified == o.caller_id_verified
174
228
  end
175
229
 
176
230
  # @see the `==` method
@@ -182,7 +236,7 @@ module Zernio
182
236
  # Calculates hash code according to all attributes.
183
237
  # @return [Integer] Hash code
184
238
  def hash
185
- [phone_number, calling_enabled, call_deep_link, forward_to, recording_enabled, sip_auth_username, sip_auth_password_configured, call_icon_countries, outbound_disabled].hash
239
+ [phone_number, calling_enabled, call_deep_link, forward_to, recording_enabled, sip_auth_username, sip_auth_password_configured, call_icon_countries, outbound_disabled, caller_id_mode, caller_id_verified].hash
186
240
  end
187
241
 
188
242
  # Builds the object from hash
@@ -37,6 +37,34 @@ module Zernio
37
37
 
38
38
  attr_accessor :call_icon_countries
39
39
 
40
+ # Caller ID the forward-leg callee sees on tel: forwards. business = this WhatsApp number; platform = a Zernio number (customer-brought number without verified caller ID; verify via /v1/phone-numbers/{id}/whatsapp/caller-id-verification).
41
+ attr_accessor :caller_id_mode
42
+
43
+ # True once the number completed caller-ID verification.
44
+ attr_accessor :caller_id_verified
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
40
68
  # Attribute mapping from ruby-style variable name to JSON key.
41
69
  def self.attribute_map
42
70
  {
@@ -48,7 +76,9 @@ module Zernio
48
76
  :'recording_enabled' => :'recordingEnabled',
49
77
  :'sip_auth_username' => :'sipAuthUsername',
50
78
  :'sip_auth_password_configured' => :'sipAuthPasswordConfigured',
51
- :'call_icon_countries' => :'callIconCountries'
79
+ :'call_icon_countries' => :'callIconCountries',
80
+ :'caller_id_mode' => :'callerIdMode',
81
+ :'caller_id_verified' => :'callerIdVerified'
52
82
  }
53
83
  end
54
84
 
@@ -73,7 +103,9 @@ module Zernio
73
103
  :'recording_enabled' => :'Boolean',
74
104
  :'sip_auth_username' => :'String',
75
105
  :'sip_auth_password_configured' => :'Boolean',
76
- :'call_icon_countries' => :'Array<String>'
106
+ :'call_icon_countries' => :'Array<String>',
107
+ :'caller_id_mode' => :'String',
108
+ :'caller_id_verified' => :'Boolean'
77
109
  }
78
110
  end
79
111
 
@@ -83,7 +115,7 @@ module Zernio
83
115
  :'call_deep_link',
84
116
  :'forward_to',
85
117
  :'sip_auth_username',
86
- :'call_icon_countries'
118
+ :'call_icon_countries',
87
119
  ])
88
120
  end
89
121
 
@@ -140,6 +172,14 @@ module Zernio
140
172
  self.call_icon_countries = value
141
173
  end
142
174
  end
175
+
176
+ if attributes.key?(:'caller_id_mode')
177
+ self.caller_id_mode = attributes[:'caller_id_mode']
178
+ end
179
+
180
+ if attributes.key?(:'caller_id_verified')
181
+ self.caller_id_verified = attributes[:'caller_id_verified']
182
+ end
143
183
  end
144
184
 
145
185
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -154,9 +194,21 @@ module Zernio
154
194
  # @return true if the model is valid
155
195
  def valid?
156
196
  warn '[DEPRECATED] the `valid?` method is obsolete'
197
+ caller_id_mode_validator = EnumAttributeValidator.new('String', ["business", "platform"])
198
+ return false unless caller_id_mode_validator.valid?(@caller_id_mode)
157
199
  true
158
200
  end
159
201
 
202
+ # Custom attribute writer method checking allowed values (enum).
203
+ # @param [Object] caller_id_mode Object to be assigned
204
+ def caller_id_mode=(caller_id_mode)
205
+ validator = EnumAttributeValidator.new('String', ["business", "platform"])
206
+ unless validator.valid?(caller_id_mode)
207
+ fail ArgumentError, "invalid value for \"caller_id_mode\", must be one of #{validator.allowable_values}."
208
+ end
209
+ @caller_id_mode = caller_id_mode
210
+ end
211
+
160
212
  # Checks equality by comparing each attribute.
161
213
  # @param [Object] Object to be compared
162
214
  def ==(o)
@@ -170,7 +222,9 @@ module Zernio
170
222
  recording_enabled == o.recording_enabled &&
171
223
  sip_auth_username == o.sip_auth_username &&
172
224
  sip_auth_password_configured == o.sip_auth_password_configured &&
173
- call_icon_countries == o.call_icon_countries
225
+ call_icon_countries == o.call_icon_countries &&
226
+ caller_id_mode == o.caller_id_mode &&
227
+ caller_id_verified == o.caller_id_verified
174
228
  end
175
229
 
176
230
  # @see the `==` method
@@ -182,7 +236,7 @@ module Zernio
182
236
  # Calculates hash code according to all attributes.
183
237
  # @return [Integer] Hash code
184
238
  def hash
185
- [phone_number_doc_id, phone_number, calling_enabled, call_deep_link, forward_to, recording_enabled, sip_auth_username, sip_auth_password_configured, call_icon_countries].hash
239
+ [phone_number_doc_id, phone_number, calling_enabled, call_deep_link, forward_to, recording_enabled, sip_auth_username, sip_auth_password_configured, call_icon_countries, caller_id_mode, caller_id_verified].hash
186
240
  end
187
241
 
188
242
  # Builds the object from hash
@@ -0,0 +1,199 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class StartWhatsAppCallerIdVerification200Response < ApiModelBase
18
+ attr_accessor :verified
19
+
20
+ attr_accessor :code_sent
21
+
22
+ attr_accessor :method
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'verified' => :'verified',
50
+ :'code_sent' => :'codeSent',
51
+ :'method' => :'method'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'verified' => :'Boolean',
69
+ :'code_sent' => :'Boolean',
70
+ :'method' => :'String'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::StartWhatsAppCallerIdVerification200Response` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ acceptable_attribute_map = self.class.acceptable_attribute_map
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!acceptable_attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::StartWhatsAppCallerIdVerification200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'verified')
97
+ self.verified = attributes[:'verified']
98
+ end
99
+
100
+ if attributes.key?(:'code_sent')
101
+ self.code_sent = attributes[:'code_sent']
102
+ end
103
+
104
+ if attributes.key?(:'method')
105
+ self.method = attributes[:'method']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
113
+ invalid_properties = Array.new
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ method_validator = EnumAttributeValidator.new('String', ["sms", "call"])
122
+ return false unless method_validator.valid?(@method)
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] method Object to be assigned
128
+ def method=(method)
129
+ validator = EnumAttributeValidator.new('String', ["sms", "call"])
130
+ unless validator.valid?(method)
131
+ fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
132
+ end
133
+ @method = method
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ verified == o.verified &&
142
+ code_sent == o.code_sent &&
143
+ method == o.method
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [verified, code_sent, method].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ transformed_hash = {}
165
+ openapi_types.each_pair do |key, type|
166
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = nil
168
+ elsif type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[attribute_map[key]].is_a?(Array)
172
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
+ end
174
+ elsif !attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
+ end
177
+ end
178
+ new(transformed_hash)
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ end
198
+
199
+ end
@@ -0,0 +1,183 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class StartWhatsAppCallerIdVerificationRequest < ApiModelBase
18
+ attr_accessor :method
19
+
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype
22
+ attr_reader :allowable_values
23
+
24
+ def initialize(datatype, allowable_values)
25
+ @allowable_values = allowable_values.map do |value|
26
+ case datatype.to_s
27
+ when /Integer/i
28
+ value.to_i
29
+ when /Float/i
30
+ value.to_f
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+
37
+ def valid?(value)
38
+ !value || allowable_values.include?(value)
39
+ end
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'method' => :'method'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'method' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::StartWhatsAppCallerIdVerificationRequest` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::StartWhatsAppCallerIdVerificationRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'method')
89
+ self.method = attributes[:'method']
90
+ else
91
+ self.method = 'sms'
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
+ method_validator = EnumAttributeValidator.new('String', ["sms", "call"])
108
+ return false unless method_validator.valid?(@method)
109
+ true
110
+ end
111
+
112
+ # Custom attribute writer method checking allowed values (enum).
113
+ # @param [Object] method Object to be assigned
114
+ def method=(method)
115
+ validator = EnumAttributeValidator.new('String', ["sms", "call"])
116
+ unless validator.valid?(method)
117
+ fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
118
+ end
119
+ @method = method
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ method == o.method
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [method].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ if value.nil?
172
+ is_nullable = self.class.openapi_nullable.include?(attr)
173
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
174
+ end
175
+
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ end
182
+
183
+ end