freeclimb 5.2.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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -2
  3. data/Gemfile.lock +3 -3
  4. data/README.md +31 -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/CallResult.md +2 -2
  9. data/docs/CreateBlobRequest.md +22 -0
  10. data/docs/CreateConference.md +4 -2
  11. data/docs/DefaultApi.md +835 -25
  12. data/docs/ExportList.md +32 -0
  13. data/docs/ExportOutputType.md +16 -0
  14. data/docs/ExportRequest.md +24 -0
  15. data/docs/ExportRequestOutput.md +18 -0
  16. data/docs/ExportResourceType.md +17 -0
  17. data/docs/ExportResult.md +40 -0
  18. data/docs/ExportResultOutput.md +18 -0
  19. data/docs/ExportStatus.md +21 -0
  20. data/docs/IncomingNumberResult.md +0 -4
  21. data/docs/ModifyBlobRequest.md +20 -0
  22. data/docs/PlatformError.md +24 -0
  23. data/docs/ReplaceBlobRequest.md +18 -0
  24. data/docs/Say.md +2 -0
  25. data/docs/TTSEngine.md +20 -0
  26. data/docs/TTSEngineName.md +18 -0
  27. data/lib/freeclimb/api/default_api.rb +1032 -12
  28. data/lib/freeclimb/models/available_number.rb +1 -23
  29. data/lib/freeclimb/models/blob_list_response.rb +303 -0
  30. data/lib/freeclimb/models/blob_result.rb +332 -0
  31. data/lib/freeclimb/models/call_result.rb +8 -8
  32. data/lib/freeclimb/models/create_blob_request.rb +255 -0
  33. data/lib/freeclimb/models/create_conference.rb +15 -5
  34. data/lib/freeclimb/models/export_list.rb +304 -0
  35. data/lib/freeclimb/models/export_output_type.rb +34 -0
  36. data/lib/freeclimb/models/export_request.rb +276 -0
  37. data/lib/freeclimb/models/export_request_output.rb +243 -0
  38. data/lib/freeclimb/models/export_resource_type.rb +35 -0
  39. data/lib/freeclimb/models/export_result.rb +405 -0
  40. data/lib/freeclimb/models/export_result_output.rb +243 -0
  41. data/lib/freeclimb/models/export_status.rb +39 -0
  42. data/lib/freeclimb/models/incoming_number_result.rb +1 -23
  43. data/lib/freeclimb/models/modify_blob_request.rb +245 -0
  44. data/lib/freeclimb/models/platform_error.rb +244 -0
  45. data/lib/freeclimb/models/replace_blob_request.rb +221 -0
  46. data/lib/freeclimb/models/say.rb +10 -1
  47. data/lib/freeclimb/models/tts_engine.rb +250 -0
  48. data/lib/freeclimb/models/tts_engine_name.rb +36 -0
  49. data/lib/freeclimb/version.rb +1 -1
  50. data/lib/freeclimb.rb +16 -0
  51. data/openapi.json +1245 -80
  52. data/spec/api/default_api_spec.rb +328 -33
  53. data/spec/models/account_result_spec.rb +3 -3
  54. data/spec/models/available_number_spec.rb +3 -98
  55. data/spec/models/blob_list_response_spec.rb +502 -0
  56. data/spec/models/blob_result_spec.rb +489 -0
  57. data/spec/models/call_result_spec.rb +39 -39
  58. data/spec/models/conference_result_spec.rb +3 -3
  59. data/spec/models/create_blob_request_spec.rb +273 -0
  60. data/spec/models/create_conference_spec.rb +83 -35
  61. data/spec/models/export_list_spec.rb +502 -0
  62. data/spec/models/export_output_type_spec.rb +43 -0
  63. data/spec/models/export_request_output_spec.rb +162 -0
  64. data/spec/models/export_request_spec.rb +320 -0
  65. data/spec/models/export_resource_type_spec.rb +59 -0
  66. data/spec/models/export_result_output_spec.rb +162 -0
  67. data/spec/models/export_result_spec.rb +718 -0
  68. data/spec/models/export_status_spec.rb +123 -0
  69. data/spec/models/incoming_number_result_spec.rb +6 -102
  70. data/spec/models/log_result_spec.rb +3 -3
  71. data/spec/models/message_result_spec.rb +3 -3
  72. data/spec/models/modify_blob_request_spec.rb +226 -0
  73. data/spec/models/platform_error_spec.rb +318 -0
  74. data/spec/models/queue_result_spec.rb +3 -3
  75. data/spec/models/replace_blob_request_spec.rb +176 -0
  76. data/spec/models/say_spec.rb +50 -0
  77. data/spec/models/sms_ten_dlc_partner_campaign_spec.rb +3 -3
  78. data/spec/models/transcribe_utterance_spec.rb +3 -3
  79. data/spec/models/tts_engine_name_spec.rb +75 -0
  80. data/spec/models/tts_engine_spec.rb +183 -0
  81. data/spec/spec_helper.rb +1 -1
  82. data/yarn.lock +29 -29
  83. metadata +50 -2
@@ -43,7 +43,7 @@ module Freeclimb
43
43
  # If the Call was inbound, this is the ID of the IncomingPhoneNumber that received the Call (DNIS). If the Call was outbound, this is the ID of the phone number from which the Call was placed (ANI).
44
44
  attr_accessor :phone_number_id
45
45
 
46
- attr_accessor :call_status
46
+ attr_accessor :status
47
47
 
48
48
  # Start time of the Call (GMT) in RFC 1123 format (e.g., Mon, 15 Jun 2009 20:45:30 GMT). Empty if the Call has not yet been dialed.
49
49
  attr_accessor :start_time
@@ -105,7 +105,7 @@ module Freeclimb
105
105
  from: :from,
106
106
  to: :to,
107
107
  phone_number_id: :phoneNumberId,
108
- call_status: :callStatus,
108
+ status: :status,
109
109
  start_time: :startTime,
110
110
  connect_time: :connectTime,
111
111
  end_time: :endTime,
@@ -136,7 +136,7 @@ module Freeclimb
136
136
  from: :String,
137
137
  to: :String,
138
138
  phone_number_id: :String,
139
- call_status: :CallStatus,
139
+ status: :CallStatus,
140
140
  start_time: :String,
141
141
  connect_time: :String,
142
142
  end_time: :String,
@@ -158,7 +158,7 @@ module Freeclimb
158
158
  :from,
159
159
  :to,
160
160
  :phone_number_id,
161
- :call_status,
161
+ :status,
162
162
  :start_time,
163
163
  :connect_time,
164
164
  :end_time,
@@ -233,8 +233,8 @@ module Freeclimb
233
233
  self.phone_number_id = attributes[:phone_number_id]
234
234
  end
235
235
 
236
- if attributes.key?(:call_status)
237
- self.call_status = attributes[:call_status]
236
+ if attributes.key?(:status)
237
+ self.status = attributes[:status]
238
238
  end
239
239
 
240
240
  if attributes.key?(:start_time)
@@ -305,7 +305,7 @@ module Freeclimb
305
305
  from == other.from &&
306
306
  to == other.to &&
307
307
  phone_number_id == other.phone_number_id &&
308
- call_status == other.call_status &&
308
+ status == other.status &&
309
309
  start_time == other.start_time &&
310
310
  connect_time == other.connect_time &&
311
311
  end_time == other.end_time &&
@@ -326,7 +326,7 @@ module Freeclimb
326
326
  # Calculates hash code according to all attributes.
327
327
  # @return [Integer] Hash code
328
328
  def hash
329
- [uri, date_created, date_updated, revision, call_id, parent_call_id, account_id, from, to, phone_number_id, call_status, start_time, connect_time, end_time, duration, connect_duration, direction, answered_by, subresource_uris, application_id].hash
329
+ [uri, date_created, date_updated, revision, call_id, parent_call_id, account_id, from, to, phone_number_id, status, start_time, connect_time, end_time, duration, connect_duration, direction, answered_by, subresource_uris, application_id].hash
330
330
  end
331
331
 
332
332
  # Builds the object from hash
@@ -0,0 +1,255 @@
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 CreateBlobRequest
16
+ # Custom identifier for this blob that is unique for the owning account. It will be set to the blobId by default if not provided.
17
+ attr_accessor :_alias
18
+
19
+ # An RFC3339 timestamp with millisecond resolution. This timestamp defines the time at which this blob will delete itself. It must not be more than 48 hours in the future and will default to 9 hours in the future if not provided.
20
+ attr_accessor :expires_at
21
+
22
+ attr_accessor :blob
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ _alias: :alias,
28
+ expires_at: :expiresAt,
29
+ blob: :blob
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ _alias: :String,
42
+ expires_at: :String,
43
+ blob: :Object
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if !attributes.is_a?(Hash)
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::CreateBlobRequest` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if !self.class.attribute_map.key?(k.to_sym)
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::CreateBlobRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:_alias)
68
+ self._alias = attributes[:_alias]
69
+ end
70
+
71
+ if attributes.key?(:expires_at)
72
+ self.expires_at = attributes[:expires_at]
73
+ end
74
+
75
+ if attributes.key?(:blob)
76
+ self.blob = attributes[:blob]
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = []
84
+ if !@_alias.nil? && @_alias.to_s.length > 64
85
+ invalid_properties.push('invalid value for "_alias", the character length must be smaller than or equal to 64.')
86
+ end
87
+
88
+ if @blob.nil?
89
+ invalid_properties.push('invalid value for "blob", blob cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ if @_alias.nil?
99
+ false
100
+ else
101
+ list_invalid_properties.length == 0
102
+ end
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] _alias Value to be assigned
107
+ def _alias=(_alias)
108
+ if !_alias.nil? && _alias.to_s.length > 64
109
+ fail ArgumentError, 'invalid value for "_alias", the character length must be smaller than or equal to 64.'
110
+ end
111
+
112
+ @_alias = _alias
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(other)
118
+ return true if equal?(other)
119
+ self.class == other.class &&
120
+ _alias == other._alias &&
121
+ expires_at == other.expires_at &&
122
+ blob == other.blob
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(other)
128
+ self == other
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [_alias, expires_at, blob].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ new.build_from_hash(attributes)
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ self.class.openapi_types.each_pair do |key, type|
150
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
151
+ send(:"#{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[self.class.attribute_map[key]].is_a?(Array)
156
+ send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = Freeclimb.const_get(type)
205
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+ end
255
+ end
@@ -31,6 +31,9 @@ module Freeclimb
31
31
  # If specified, this URL provides the custom hold music for the Conference when it is in the populated state. This attribute is always fetched using HTTP GET and is fetched just once – when the Conference is created. The URL must be an audio file that is reachable and readable by FreeClimb.
32
32
  attr_accessor :wait_url
33
33
 
34
+ # ID of the Call that created this leg (child call).
35
+ attr_accessor :parent_call_id
36
+
34
37
  class EnumAttributeValidator
35
38
  attr_reader :datatype
36
39
  attr_reader :allowable_values
@@ -61,7 +64,8 @@ module Freeclimb
61
64
  play_beep: :playBeep,
62
65
  record: :record,
63
66
  status_callback_url: :statusCallbackUrl,
64
- wait_url: :waitUrl
67
+ wait_url: :waitUrl,
68
+ parent_call_id: :parentCallId
65
69
  }
66
70
  end
67
71
 
@@ -74,11 +78,12 @@ module Freeclimb
74
78
  def self.openapi_types
75
79
  {
76
80
  action_url: :String,
77
- _alias: :Boolean,
81
+ _alias: :String,
78
82
  play_beep: :PlayBeep,
79
83
  record: :Boolean,
80
84
  status_callback_url: :String,
81
- wait_url: :String
85
+ wait_url: :String,
86
+ parent_call_id: :String
82
87
  }
83
88
  end
84
89
 
@@ -137,6 +142,10 @@ module Freeclimb
137
142
  if attributes.key?(:wait_url)
138
143
  self.wait_url = attributes[:wait_url]
139
144
  end
145
+
146
+ if attributes.key?(:parent_call_id)
147
+ self.parent_call_id = attributes[:parent_call_id]
148
+ end
140
149
  self.command = "CreateConference"
141
150
  end
142
151
 
@@ -171,7 +180,8 @@ module Freeclimb
171
180
  play_beep == other.play_beep &&
172
181
  record == other.record &&
173
182
  status_callback_url == other.status_callback_url &&
174
- wait_url == other.wait_url && super
183
+ wait_url == other.wait_url &&
184
+ parent_call_id == other.parent_call_id && super
175
185
  end
176
186
 
177
187
  # @see the `==` method
@@ -183,7 +193,7 @@ module Freeclimb
183
193
  # Calculates hash code according to all attributes.
184
194
  # @return [Integer] Hash code
185
195
  def hash
186
- [action_url, _alias, play_beep, record, status_callback_url, wait_url].hash
196
+ [action_url, _alias, play_beep, record, status_callback_url, wait_url, parent_call_id].hash
187
197
  end
188
198
 
189
199
  # Builds the object from hash
@@ -0,0 +1,304 @@
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 ExportList
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 :exports
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
+ exports: :exports
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
+ exports: :"Array<ExportResult>"
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
+ :exports
83
+ ])
84
+ end
85
+
86
+ # List of class defined in allOf (OpenAPI v3)
87
+ def self.openapi_all_of
88
+ [
89
+ :PaginationModel
90
+ ]
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if !attributes.is_a?(Hash)
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Freeclimb::ExportList` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if !self.class.attribute_map.key?(k.to_sym)
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Freeclimb::ExportList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:total)
109
+ self.total = attributes[:total]
110
+ end
111
+
112
+ if attributes.key?(:start)
113
+ self.start = attributes[:start]
114
+ end
115
+
116
+ if attributes.key?(:_end)
117
+ self._end = attributes[:_end]
118
+ end
119
+
120
+ if attributes.key?(:page)
121
+ self.page = attributes[:page]
122
+ end
123
+
124
+ if attributes.key?(:num_pages)
125
+ self.num_pages = attributes[:num_pages]
126
+ end
127
+
128
+ if attributes.key?(:page_size)
129
+ self.page_size = attributes[:page_size]
130
+ end
131
+
132
+ if attributes.key?(:next_page_uri)
133
+ self.next_page_uri = attributes[:next_page_uri]
134
+ end
135
+
136
+ if attributes.key?(:exports)
137
+ if (value = attributes[:exports]).is_a?(Array)
138
+ self.exports = value
139
+ end
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ []
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ if @total.nil?
153
+ false
154
+ else
155
+ list_invalid_properties.length == 0
156
+ end
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(other)
162
+ return true if equal?(other)
163
+ self.class == other.class &&
164
+ total == other.total &&
165
+ start == other.start &&
166
+ _end == other._end &&
167
+ page == other.page &&
168
+ num_pages == other.num_pages &&
169
+ page_size == other.page_size &&
170
+ next_page_uri == other.next_page_uri &&
171
+ exports == other.exports
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(other)
177
+ self == other
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [total, start, _end, page, num_pages, page_size, next_page_uri, exports].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def self.build_from_hash(attributes)
190
+ new.build_from_hash(attributes)
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ self.class.openapi_types.each_pair do |key, type|
199
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
200
+ send(:"#{key}=", nil)
201
+ elsif type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
205
+ send(:"#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
206
+ end
207
+ elsif !attributes[self.class.attribute_map[key]].nil?
208
+ send(:"#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ end
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :Time
222
+ Time.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :Boolean
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ # models (e.g. Pet) or oneOf
253
+ klass = Freeclimb.const_get(type)
254
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = send(attr)
276
+ if value.nil?
277
+ is_nullable = self.class.openapi_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value)
291
+ if value.is_a?(Array)
292
+ value.compact.map { |v| _to_hash(v) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash
299
+ else
300
+ value
301
+ end
302
+ end
303
+ end
304
+ end