freeclimb 5.3.0 → 5.4.0

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +18 -4
  5. data/docs/AvailableNumber.md +0 -4
  6. data/docs/BlobListResponse.md +32 -0
  7. data/docs/BlobResult.md +32 -0
  8. data/docs/CreateBlobRequest.md +22 -0
  9. data/docs/DefaultApi.md +449 -6
  10. data/docs/IncomingNumberResult.md +0 -4
  11. data/docs/ModifyBlobRequest.md +20 -0
  12. data/docs/PlatformError.md +24 -0
  13. data/docs/ReplaceBlobRequest.md +18 -0
  14. data/docs/Say.md +2 -0
  15. data/docs/TTSEngine.md +20 -0
  16. data/docs/TTSEngineName.md +18 -0
  17. data/lib/freeclimb/api/default_api.rb +715 -8
  18. data/lib/freeclimb/models/available_number.rb +1 -23
  19. data/lib/freeclimb/models/blob_list_response.rb +303 -0
  20. data/lib/freeclimb/models/blob_result.rb +332 -0
  21. data/lib/freeclimb/models/create_blob_request.rb +255 -0
  22. data/lib/freeclimb/models/incoming_number_result.rb +1 -23
  23. data/lib/freeclimb/models/modify_blob_request.rb +245 -0
  24. data/lib/freeclimb/models/platform_error.rb +244 -0
  25. data/lib/freeclimb/models/replace_blob_request.rb +221 -0
  26. data/lib/freeclimb/models/say.rb +10 -1
  27. data/lib/freeclimb/models/tts_engine.rb +250 -0
  28. data/lib/freeclimb/models/tts_engine_name.rb +36 -0
  29. data/lib/freeclimb/version.rb +1 -1
  30. data/lib/freeclimb.rb +8 -0
  31. data/openapi.json +894 -97
  32. data/spec/api/default_api_spec.rb +188 -32
  33. data/spec/models/account_result_spec.rb +3 -3
  34. data/spec/models/available_number_spec.rb +3 -98
  35. data/spec/models/blob_list_response_spec.rb +502 -0
  36. data/spec/models/blob_result_spec.rb +489 -0
  37. data/spec/models/call_result_spec.rb +3 -3
  38. data/spec/models/conference_result_spec.rb +3 -3
  39. data/spec/models/create_blob_request_spec.rb +273 -0
  40. data/spec/models/export_request_spec.rb +6 -6
  41. data/spec/models/export_result_spec.rb +6 -6
  42. data/spec/models/incoming_number_result_spec.rb +6 -102
  43. data/spec/models/log_result_spec.rb +3 -3
  44. data/spec/models/message_result_spec.rb +3 -3
  45. data/spec/models/modify_blob_request_spec.rb +226 -0
  46. data/spec/models/platform_error_spec.rb +318 -0
  47. data/spec/models/queue_result_spec.rb +3 -3
  48. data/spec/models/replace_blob_request_spec.rb +176 -0
  49. data/spec/models/say_spec.rb +50 -0
  50. data/spec/models/sms_ten_dlc_partner_campaign_spec.rb +3 -3
  51. data/spec/models/transcribe_utterance_spec.rb +3 -3
  52. data/spec/models/tts_engine_name_spec.rb +75 -0
  53. data/spec/models/tts_engine_spec.rb +183 -0
  54. data/spec/spec_helper.rb +1 -1
  55. metadata +26 -2
@@ -21,12 +21,6 @@ module Freeclimb
21
21
  # The phone number, in E.164 format (+ country code and phone number: +18003608245).
22
22
  attr_accessor :phone_number
23
23
 
24
- # Typically set to true for all numbers.
25
- attr_accessor :voice_enabled
26
-
27
- # Indicates whether the phone number can send and receive SMS messages.
28
- attr_accessor :sms_enabled
29
-
30
24
  # The state or province of this phone number.
31
25
  attr_accessor :region
32
26
 
@@ -39,8 +33,6 @@ module Freeclimb
39
33
  capabilities: :capabilities,
40
34
  campaign_id: :campaignId,
41
35
  phone_number: :phoneNumber,
42
- voice_enabled: :voiceEnabled,
43
- sms_enabled: :smsEnabled,
44
36
  region: :region,
45
37
  country: :country
46
38
  }
@@ -57,8 +49,6 @@ module Freeclimb
57
49
  capabilities: :Capabilities,
58
50
  campaign_id: :String,
59
51
  phone_number: :String,
60
- voice_enabled: :Boolean,
61
- sms_enabled: :Boolean,
62
52
  region: :String,
63
53
  country: :String
64
54
  }
@@ -69,8 +59,6 @@ module Freeclimb
69
59
  Set.new([
70
60
  :campaign_id,
71
61
  :phone_number,
72
- :voice_enabled,
73
- :sms_enabled,
74
62
  :region,
75
63
  :country
76
64
  ])
@@ -103,14 +91,6 @@ module Freeclimb
103
91
  self.phone_number = attributes[:phone_number]
104
92
  end
105
93
 
106
- if attributes.key?(:voice_enabled)
107
- self.voice_enabled = attributes[:voice_enabled]
108
- end
109
-
110
- if attributes.key?(:sms_enabled)
111
- self.sms_enabled = attributes[:sms_enabled]
112
- end
113
-
114
94
  if attributes.key?(:region)
115
95
  self.region = attributes[:region]
116
96
  end
@@ -144,8 +124,6 @@ module Freeclimb
144
124
  capabilities == other.capabilities &&
145
125
  campaign_id == other.campaign_id &&
146
126
  phone_number == other.phone_number &&
147
- voice_enabled == other.voice_enabled &&
148
- sms_enabled == other.sms_enabled &&
149
127
  region == other.region &&
150
128
  country == other.country
151
129
  end
@@ -159,7 +137,7 @@ module Freeclimb
159
137
  # Calculates hash code according to all attributes.
160
138
  # @return [Integer] Hash code
161
139
  def hash
162
- [capabilities, campaign_id, phone_number, voice_enabled, sms_enabled, region, country].hash
140
+ [capabilities, campaign_id, phone_number, region, country].hash
163
141
  end
164
142
 
165
143
  # Builds the object from hash
@@ -0,0 +1,303 @@
1
+ # #FreeClimb API
2
+ #
3
+ # FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0
6
+ # Contact: support@freeclimb.com
7
+ # Generated by: https://openapi-generator.tech
8
+ # OpenAPI Generator version: 7.9.0
9
+ #
10
+
11
+ require "date"
12
+ require "time"
13
+
14
+ module Freeclimb
15
+ class BlobListResponse
16
+ # Total amount of requested resource.
17
+ attr_accessor :total
18
+
19
+ # Resource index at start of current page
20
+ attr_accessor :start
21
+
22
+ # Resource index at end of current page
23
+ attr_accessor :_end
24
+
25
+ # Current page
26
+ attr_accessor :page
27
+
28
+ # Total number of pages
29
+ attr_accessor :num_pages
30
+
31
+ # Number of items per page
32
+ attr_accessor :page_size
33
+
34
+ # Uri to retrieve the next page of items
35
+ attr_accessor :next_page_uri
36
+
37
+ attr_accessor :blobs
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ total: :total,
43
+ start: :start,
44
+ _end: :end,
45
+ page: :page,
46
+ num_pages: :numPages,
47
+ page_size: :pageSize,
48
+ next_page_uri: :nextPageUri,
49
+ blobs: :blobs
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ total: :Integer,
62
+ start: :Integer,
63
+ _end: :Integer,
64
+ page: :Integer,
65
+ num_pages: :Integer,
66
+ page_size: :Integer,
67
+ next_page_uri: :String,
68
+ blobs: :"Array<BlobResult>"
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ :total,
76
+ :start,
77
+ :_end,
78
+ :page,
79
+ :num_pages,
80
+ :page_size,
81
+ :next_page_uri
82
+ ])
83
+ end
84
+
85
+ # List of class defined in allOf (OpenAPI v3)
86
+ def self.openapi_all_of
87
+ [
88
+ :PaginationModel
89
+ ]
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if !attributes.is_a?(Hash)
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::BlobListResponse` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if !self.class.attribute_map.key?(k.to_sym)
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::BlobListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:total)
108
+ self.total = attributes[:total]
109
+ end
110
+
111
+ if attributes.key?(:start)
112
+ self.start = attributes[:start]
113
+ end
114
+
115
+ if attributes.key?(:_end)
116
+ self._end = attributes[:_end]
117
+ end
118
+
119
+ if attributes.key?(:page)
120
+ self.page = attributes[:page]
121
+ end
122
+
123
+ if attributes.key?(:num_pages)
124
+ self.num_pages = attributes[:num_pages]
125
+ end
126
+
127
+ if attributes.key?(:page_size)
128
+ self.page_size = attributes[:page_size]
129
+ end
130
+
131
+ if attributes.key?(:next_page_uri)
132
+ self.next_page_uri = attributes[:next_page_uri]
133
+ end
134
+
135
+ if attributes.key?(:blobs)
136
+ if (value = attributes[:blobs]).is_a?(Array)
137
+ self.blobs = value
138
+ end
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ []
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ if @total.nil?
152
+ false
153
+ else
154
+ list_invalid_properties.length == 0
155
+ end
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(other)
161
+ return true if equal?(other)
162
+ self.class == other.class &&
163
+ total == other.total &&
164
+ start == other.start &&
165
+ _end == other._end &&
166
+ page == other.page &&
167
+ num_pages == other.num_pages &&
168
+ page_size == other.page_size &&
169
+ next_page_uri == other.next_page_uri &&
170
+ blobs == other.blobs
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(other)
176
+ self == other
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [total, start, _end, page, num_pages, page_size, next_page_uri, blobs].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.openapi_types.each_pair do |key, type|
198
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
199
+ send(:"#{key}=", nil)
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
204
+ send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
205
+ end
206
+ elsif !attributes[self.class.attribute_map[key]].nil?
207
+ send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
+ end
209
+ end
210
+
211
+ self
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def _deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = Freeclimb.const_get(type)
253
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+ end
303
+ end
@@ -0,0 +1,332 @@
1
+ # #FreeClimb API
2
+ #
3
+ # FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0
6
+ # Contact: support@freeclimb.com
7
+ # Generated by: https://openapi-generator.tech
8
+ # OpenAPI Generator version: 7.9.0
9
+ #
10
+
11
+ require "date"
12
+ require "time"
13
+
14
+ module Freeclimb
15
+ class BlobResult
16
+ # Identifier which can be used to reference this blob in future interations.
17
+ attr_accessor :blob_id
18
+
19
+ attr_accessor :account_id
20
+
21
+ # Custom identifier for this blob that is unique for the owning account. It will be set to the blobId by default if not provided in the creation request.
22
+ attr_accessor :_alias
23
+
24
+ attr_accessor :revision
25
+
26
+ # An RFC3339 timestamp with millisecond resolution. It represents the time this blob was created.
27
+ attr_accessor :date_created
28
+
29
+ # An RFC3339 timestamp with millisecond resolution. It represents the time this blob was last modified, which at creation will always equal dateCreated.
30
+ attr_accessor :date_updated
31
+
32
+ # An RFC3339 timestamp with millisecond resolution. It represents the time at which this blob will expire and self delete.
33
+ attr_accessor :expires_at
34
+
35
+ # Blob content
36
+ attr_accessor :blob
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ blob_id: :blobId,
42
+ account_id: :accountId,
43
+ _alias: :alias,
44
+ revision: :revision,
45
+ date_created: :dateCreated,
46
+ date_updated: :dateUpdated,
47
+ expires_at: :expiresAt,
48
+ blob: :blob
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ blob_id: :String,
61
+ account_id: :String,
62
+ _alias: :String,
63
+ revision: :Integer,
64
+ date_created: :Time,
65
+ date_updated: :Time,
66
+ expires_at: :Time,
67
+ blob: :Object
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if !attributes.is_a?(Hash)
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::BlobResult` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if !self.class.attribute_map.key?(k.to_sym)
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::BlobResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:blob_id)
92
+ self.blob_id = attributes[:blob_id]
93
+ end
94
+
95
+ if attributes.key?(:account_id)
96
+ self.account_id = attributes[:account_id]
97
+ end
98
+
99
+ if attributes.key?(:_alias)
100
+ self._alias = attributes[:_alias]
101
+ end
102
+
103
+ if attributes.key?(:revision)
104
+ self.revision = attributes[:revision]
105
+ end
106
+
107
+ if attributes.key?(:date_created)
108
+ self.date_created = attributes[:date_created]
109
+ end
110
+
111
+ if attributes.key?(:date_updated)
112
+ self.date_updated = attributes[:date_updated]
113
+ end
114
+
115
+ if attributes.key?(:expires_at)
116
+ self.expires_at = attributes[:expires_at]
117
+ end
118
+
119
+ if attributes.key?(:blob)
120
+ self.blob = attributes[:blob]
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = []
128
+ pattern = /BL[0-9a-fA-F]{40}/
129
+ if !@blob_id.nil? && @blob_id !~ pattern
130
+ invalid_properties.push("invalid value for \"blob_id\", must conform to the pattern #{pattern}.")
131
+ end
132
+
133
+ pattern = /AC[0-9a-fA-F]{40}/
134
+ if !@account_id.nil? && @account_id !~ pattern
135
+ invalid_properties.push("invalid value for \"account_id\", must conform to the pattern #{pattern}.")
136
+ end
137
+
138
+ if !@_alias.nil? && @_alias.to_s.length > 64
139
+ invalid_properties.push('invalid value for "_alias", the character length must be smaller than or equal to 64.')
140
+ end
141
+
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ if @blob_id.nil?
149
+ false
150
+ else
151
+ list_invalid_properties.length == 0
152
+ end
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] blob_id Value to be assigned
157
+ def blob_id=(blob_id)
158
+ pattern = /BL[0-9a-fA-F]{40}/
159
+ if !blob_id.nil? && blob_id !~ pattern
160
+ fail ArgumentError, "invalid value for \"blob_id\", must conform to the pattern #{pattern}."
161
+ end
162
+
163
+ @blob_id = blob_id
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] account_id Value to be assigned
168
+ def account_id=(account_id)
169
+ pattern = /AC[0-9a-fA-F]{40}/
170
+ if !account_id.nil? && account_id !~ pattern
171
+ fail ArgumentError, "invalid value for \"account_id\", must conform to the pattern #{pattern}."
172
+ end
173
+
174
+ @account_id = account_id
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] _alias Value to be assigned
179
+ def _alias=(_alias)
180
+ if !_alias.nil? && _alias.to_s.length > 64
181
+ fail ArgumentError, 'invalid value for "_alias", the character length must be smaller than or equal to 64.'
182
+ end
183
+
184
+ @_alias = _alias
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(other)
190
+ return true if equal?(other)
191
+ self.class == other.class &&
192
+ blob_id == other.blob_id &&
193
+ account_id == other.account_id &&
194
+ _alias == other._alias &&
195
+ revision == other.revision &&
196
+ date_created == other.date_created &&
197
+ date_updated == other.date_updated &&
198
+ expires_at == other.expires_at &&
199
+ blob == other.blob
200
+ end
201
+
202
+ # @see the `==` method
203
+ # @param [Object] Object to be compared
204
+ def eql?(other)
205
+ self == other
206
+ end
207
+
208
+ # Calculates hash code according to all attributes.
209
+ # @return [Integer] Hash code
210
+ def hash
211
+ [blob_id, account_id, _alias, revision, date_created, date_updated, expires_at, blob].hash
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def self.build_from_hash(attributes)
218
+ new.build_from_hash(attributes)
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ self.class.openapi_types.each_pair do |key, type|
227
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
228
+ send(:"#{key}=", nil)
229
+ elsif type =~ /\AArray<(.*)>/i
230
+ # check to ensure the input is an array given that the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :Time
250
+ Time.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ # models (e.g. Pet) or oneOf
281
+ klass = Freeclimb.const_get(type)
282
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = send(attr)
304
+ if value.nil?
305
+ is_nullable = self.class.openapi_nullable.include?(attr)
306
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
307
+ end
308
+
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+ end
332
+ end