xbim_comms 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +6 -148
- data/Gemfile +0 -9
- data/README.md +0 -210
- data/Rakefile +0 -10
- data/lib/xbim_comms/api/contacts_api.rb +0 -206
- data/lib/xbim_comms/api/conversations_api.rb +0 -2670
- data/lib/xbim_comms/api/files_api.rb +0 -107
- data/lib/xbim_comms/api/snapshots_api.rb +0 -100
- data/lib/xbim_comms/api_client.rb +0 -390
- data/lib/xbim_comms/api_error.rb +0 -57
- data/lib/xbim_comms/configuration.rb +0 -278
- data/lib/xbim_comms/models/aggregate.rb +0 -227
- data/lib/xbim_comms/models/aggregate_list_value.rb +0 -220
- data/lib/xbim_comms/models/analytical_result.rb +0 -270
- data/lib/xbim_comms/models/analytical_result_all_of.rb +0 -258
- data/lib/xbim_comms/models/animation.rb +0 -232
- data/lib/xbim_comms/models/animation_all_of.rb +0 -220
- data/lib/xbim_comms/models/bitmap.rb +0 -303
- data/lib/xbim_comms/models/blob.rb +0 -245
- data/lib/xbim_comms/models/boolean_value.rb +0 -218
- data/lib/xbim_comms/models/clipping_plane.rb +0 -231
- data/lib/xbim_comms/models/coloring.rb +0 -229
- data/lib/xbim_comms/models/column_request.rb +0 -279
- data/lib/xbim_comms/models/component.rb +0 -236
- data/lib/xbim_comms/models/components.rb +0 -240
- data/lib/xbim_comms/models/contact.rb +0 -227
- data/lib/xbim_comms/models/contact_list.rb +0 -238
- data/lib/xbim_comms/models/conversation.rb +0 -392
- data/lib/xbim_comms/models/conversation_create.rb +0 -273
- data/lib/xbim_comms/models/conversation_list.rb +0 -238
- data/lib/xbim_comms/models/conversation_tenant.rb +0 -254
- data/lib/xbim_comms/models/conversation_update.rb +0 -302
- data/lib/xbim_comms/models/entity_key.rb +0 -227
- data/lib/xbim_comms/models/exception_message.rb +0 -245
- data/lib/xbim_comms/models/file.rb +0 -266
- data/lib/xbim_comms/models/file_all_of.rb +0 -254
- data/lib/xbim_comms/models/int32_value.rb +0 -218
- data/lib/xbim_comms/models/key_frame.rb +0 -236
- data/lib/xbim_comms/models/line.rb +0 -231
- data/lib/xbim_comms/models/message.rb +0 -416
- data/lib/xbim_comms/models/message_content.rb +0 -220
- data/lib/xbim_comms/models/message_create.rb +0 -273
- data/lib/xbim_comms/models/message_list.rb +0 -238
- data/lib/xbim_comms/models/message_part.rb +0 -246
- data/lib/xbim_comms/models/message_update.rb +0 -297
- data/lib/xbim_comms/models/orthogonal_camera.rb +0 -269
- data/lib/xbim_comms/models/participant.rb +0 -232
- data/lib/xbim_comms/models/participant_with_role.rb +0 -293
- data/lib/xbim_comms/models/participant_with_role_create.rb +0 -266
- data/lib/xbim_comms/models/participant_with_role_list.rb +0 -238
- data/lib/xbim_comms/models/participant_with_role_update.rb +0 -261
- data/lib/xbim_comms/models/perspective_camera.rb +0 -269
- data/lib/xbim_comms/models/pie_chart.rb +0 -257
- data/lib/xbim_comms/models/pie_chart_all_of.rb +0 -245
- data/lib/xbim_comms/models/point.rb +0 -227
- data/lib/xbim_comms/models/preview_row.rb +0 -220
- data/lib/xbim_comms/models/schedule.rb +0 -270
- data/lib/xbim_comms/models/schedule_all_of.rb +0 -258
- data/lib/xbim_comms/models/schedule_column.rb +0 -384
- data/lib/xbim_comms/models/schedule_request.rb +0 -252
- data/lib/xbim_comms/models/schedule_request_all_of.rb +0 -240
- data/lib/xbim_comms/models/section_box.rb +0 -274
- data/lib/xbim_comms/models/sheet.rb +0 -268
- data/lib/xbim_comms/models/sheet_all_of.rb +0 -256
- data/lib/xbim_comms/models/sheet_part.rb +0 -254
- data/lib/xbim_comms/models/snapshot.rb +0 -270
- data/lib/xbim_comms/models/text.rb +0 -220
- data/lib/xbim_comms/models/view.rb +0 -239
- data/lib/xbim_comms/models/view_all_of.rb +0 -227
- data/lib/xbim_comms/models/view_setup_hints.rb +0 -236
- data/lib/xbim_comms/models/viewpoint.rb +0 -296
- data/lib/xbim_comms/models/visibility.rb +0 -238
- data/lib/xbim_comms/version.rb +0 -15
- data/lib/xbim_comms.rb +0 -104
- data/spec/api/contacts_api_spec.rb +0 -74
- data/spec/api/conversations_api_spec.rb +0 -521
- data/spec/api/files_api_spec.rb +0 -50
- data/spec/api/snapshots_api_spec.rb +0 -49
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/aggregate_list_value_spec.rb +0 -34
- data/spec/models/aggregate_spec.rb +0 -40
- data/spec/models/analytical_result_all_of_spec.rb +0 -58
- data/spec/models/analytical_result_spec.rb +0 -58
- data/spec/models/animation_all_of_spec.rb +0 -34
- data/spec/models/animation_spec.rb +0 -34
- data/spec/models/bitmap_spec.rb +0 -68
- data/spec/models/blob_spec.rb +0 -52
- data/spec/models/boolean_value_spec.rb +0 -34
- data/spec/models/clipping_plane_spec.rb +0 -40
- data/spec/models/coloring_spec.rb +0 -40
- data/spec/models/column_request_spec.rb +0 -56
- data/spec/models/component_spec.rb +0 -46
- data/spec/models/components_spec.rb +0 -46
- data/spec/models/contact_list_spec.rb +0 -46
- data/spec/models/contact_spec.rb +0 -40
- data/spec/models/conversation_create_spec.rb +0 -64
- data/spec/models/conversation_list_spec.rb +0 -46
- data/spec/models/conversation_spec.rb +0 -122
- data/spec/models/conversation_tenant_spec.rb +0 -58
- data/spec/models/conversation_update_spec.rb +0 -68
- data/spec/models/entity_key_spec.rb +0 -40
- data/spec/models/exception_message_spec.rb +0 -52
- data/spec/models/file_all_of_spec.rb +0 -58
- data/spec/models/file_spec.rb +0 -58
- data/spec/models/int32_value_spec.rb +0 -34
- data/spec/models/key_frame_spec.rb +0 -46
- data/spec/models/line_spec.rb +0 -40
- data/spec/models/message_content_spec.rb +0 -34
- data/spec/models/message_create_spec.rb +0 -64
- data/spec/models/message_list_spec.rb +0 -46
- data/spec/models/message_part_spec.rb +0 -46
- data/spec/models/message_spec.rb +0 -146
- data/spec/models/message_update_spec.rb +0 -68
- data/spec/models/orthogonal_camera_spec.rb +0 -64
- data/spec/models/participant_spec.rb +0 -40
- data/spec/models/participant_with_role_create_spec.rb +0 -44
- data/spec/models/participant_with_role_list_spec.rb +0 -46
- data/spec/models/participant_with_role_spec.rb +0 -62
- data/spec/models/participant_with_role_update_spec.rb +0 -44
- data/spec/models/perspective_camera_spec.rb +0 -64
- data/spec/models/pie_chart_all_of_spec.rb +0 -52
- data/spec/models/pie_chart_spec.rb +0 -52
- data/spec/models/point_spec.rb +0 -40
- data/spec/models/preview_row_spec.rb +0 -34
- data/spec/models/schedule_all_of_spec.rb +0 -58
- data/spec/models/schedule_column_spec.rb +0 -118
- data/spec/models/schedule_request_all_of_spec.rb +0 -46
- data/spec/models/schedule_request_spec.rb +0 -46
- data/spec/models/schedule_spec.rb +0 -58
- data/spec/models/section_box_spec.rb +0 -70
- data/spec/models/sheet_all_of_spec.rb +0 -58
- data/spec/models/sheet_part_spec.rb +0 -58
- data/spec/models/sheet_spec.rb +0 -58
- data/spec/models/snapshot_spec.rb +0 -50
- data/spec/models/text_spec.rb +0 -28
- data/spec/models/view_all_of_spec.rb +0 -40
- data/spec/models/view_setup_hints_spec.rb +0 -46
- data/spec/models/view_spec.rb +0 -40
- data/spec/models/viewpoint_spec.rb +0 -82
- data/spec/models/visibility_spec.rb +0 -46
- data/spec/spec_helper.rb +0 -111
- data/xbim_comms.gemspec +0 -38
@@ -1,278 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Flex Comms API 2.0
|
3
|
-
|
4
|
-
#Communication centralised around construction data
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 2.0
|
7
|
-
Contact: info@xbim.net
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.4.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
module XbimComms
|
14
|
-
class Configuration
|
15
|
-
# Defines url scheme
|
16
|
-
attr_accessor :scheme
|
17
|
-
|
18
|
-
# Defines url host
|
19
|
-
attr_accessor :host
|
20
|
-
|
21
|
-
# Defines url base path
|
22
|
-
attr_accessor :base_path
|
23
|
-
|
24
|
-
# Define server configuration index
|
25
|
-
attr_accessor :server_index
|
26
|
-
|
27
|
-
# Define server operation configuration index
|
28
|
-
attr_accessor :server_operation_index
|
29
|
-
|
30
|
-
# Default server variables
|
31
|
-
attr_accessor :server_variables
|
32
|
-
|
33
|
-
# Default server operation variables
|
34
|
-
attr_accessor :server_operation_variables
|
35
|
-
|
36
|
-
# Defines API keys used with API Key authentications.
|
37
|
-
#
|
38
|
-
# @return [Hash] key: parameter name, value: parameter value (API key)
|
39
|
-
#
|
40
|
-
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
41
|
-
# config.api_key['api_key'] = 'xxx'
|
42
|
-
attr_accessor :api_key
|
43
|
-
|
44
|
-
# Defines API key prefixes used with API Key authentications.
|
45
|
-
#
|
46
|
-
# @return [Hash] key: parameter name, value: API key prefix
|
47
|
-
#
|
48
|
-
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
49
|
-
# config.api_key_prefix['api_key'] = 'Token'
|
50
|
-
attr_accessor :api_key_prefix
|
51
|
-
|
52
|
-
# Defines the username used with HTTP basic authentication.
|
53
|
-
#
|
54
|
-
# @return [String]
|
55
|
-
attr_accessor :username
|
56
|
-
|
57
|
-
# Defines the password used with HTTP basic authentication.
|
58
|
-
#
|
59
|
-
# @return [String]
|
60
|
-
attr_accessor :password
|
61
|
-
|
62
|
-
# Defines the access token (Bearer) used with OAuth2.
|
63
|
-
attr_accessor :access_token
|
64
|
-
|
65
|
-
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
|
-
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
|
-
# Default to false.
|
68
|
-
#
|
69
|
-
# @return [true, false]
|
70
|
-
attr_accessor :debugging
|
71
|
-
|
72
|
-
# Defines the logger used for debugging.
|
73
|
-
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
74
|
-
#
|
75
|
-
# @return [#debug]
|
76
|
-
attr_accessor :logger
|
77
|
-
|
78
|
-
# Defines the temporary folder to store downloaded files
|
79
|
-
# (for API endpoints that have file response).
|
80
|
-
# Default to use `Tempfile`.
|
81
|
-
#
|
82
|
-
# @return [String]
|
83
|
-
attr_accessor :temp_folder_path
|
84
|
-
|
85
|
-
# The time limit for HTTP request in seconds.
|
86
|
-
# Default to 0 (never times out).
|
87
|
-
attr_accessor :timeout
|
88
|
-
|
89
|
-
# Set this to false to skip client side validation in the operation.
|
90
|
-
# Default to true.
|
91
|
-
# @return [true, false]
|
92
|
-
attr_accessor :client_side_validation
|
93
|
-
|
94
|
-
### TLS/SSL setting
|
95
|
-
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
96
|
-
# Default to true.
|
97
|
-
#
|
98
|
-
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
99
|
-
#
|
100
|
-
# @return [true, false]
|
101
|
-
attr_accessor :verify_ssl
|
102
|
-
|
103
|
-
### TLS/SSL setting
|
104
|
-
# Set this to false to skip verifying SSL host name
|
105
|
-
# Default to true.
|
106
|
-
#
|
107
|
-
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
108
|
-
#
|
109
|
-
# @return [true, false]
|
110
|
-
attr_accessor :verify_ssl_host
|
111
|
-
|
112
|
-
### TLS/SSL setting
|
113
|
-
# Set this to customize the certificate file to verify the peer.
|
114
|
-
#
|
115
|
-
# @return [String] the path to the certificate file
|
116
|
-
#
|
117
|
-
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
118
|
-
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
119
|
-
attr_accessor :ssl_ca_cert
|
120
|
-
|
121
|
-
### TLS/SSL setting
|
122
|
-
# Client certificate file (for client certificate)
|
123
|
-
attr_accessor :cert_file
|
124
|
-
|
125
|
-
### TLS/SSL setting
|
126
|
-
# Client private key file (for client certificate)
|
127
|
-
attr_accessor :key_file
|
128
|
-
|
129
|
-
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
130
|
-
# Default to nil.
|
131
|
-
#
|
132
|
-
# @see The params_encoding option of Ethon. Related source code:
|
133
|
-
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
134
|
-
attr_accessor :params_encoding
|
135
|
-
|
136
|
-
attr_accessor :inject_format
|
137
|
-
|
138
|
-
attr_accessor :force_ending_format
|
139
|
-
|
140
|
-
def initialize
|
141
|
-
@scheme = 'https'
|
142
|
-
@host = 'apis.xbim-dev.net'
|
143
|
-
@base_path = ''
|
144
|
-
@server_index = 0
|
145
|
-
@server_operation_index = {}
|
146
|
-
@server_variables = {}
|
147
|
-
@server_operation_variables = {}
|
148
|
-
@api_key = {}
|
149
|
-
@api_key_prefix = {}
|
150
|
-
@client_side_validation = true
|
151
|
-
@verify_ssl = true
|
152
|
-
@verify_ssl_host = true
|
153
|
-
@params_encoding = nil
|
154
|
-
@cert_file = nil
|
155
|
-
@key_file = nil
|
156
|
-
@timeout = 0
|
157
|
-
@debugging = false
|
158
|
-
@inject_format = false
|
159
|
-
@force_ending_format = false
|
160
|
-
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
161
|
-
|
162
|
-
yield(self) if block_given?
|
163
|
-
end
|
164
|
-
|
165
|
-
# The default Configuration object.
|
166
|
-
def self.default
|
167
|
-
@@default ||= Configuration.new
|
168
|
-
end
|
169
|
-
|
170
|
-
def configure
|
171
|
-
yield(self) if block_given?
|
172
|
-
end
|
173
|
-
|
174
|
-
def scheme=(scheme)
|
175
|
-
# remove :// from scheme
|
176
|
-
@scheme = scheme.sub(/:\/\//, '')
|
177
|
-
end
|
178
|
-
|
179
|
-
def host=(host)
|
180
|
-
# remove http(s):// and anything after a slash
|
181
|
-
@host = host.sub(/https?:\/\//, '').split('/').first
|
182
|
-
end
|
183
|
-
|
184
|
-
def base_path=(base_path)
|
185
|
-
# Add leading and trailing slashes to base_path
|
186
|
-
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
187
|
-
@base_path = '' if @base_path == '/'
|
188
|
-
end
|
189
|
-
|
190
|
-
# Returns base URL for specified operation based on server settings
|
191
|
-
def base_url(operation = nil)
|
192
|
-
index = server_operation_index.fetch(operation, server_index)
|
193
|
-
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
194
|
-
|
195
|
-
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
196
|
-
end
|
197
|
-
|
198
|
-
# Gets API key (with prefix if set).
|
199
|
-
# @param [String] param_name the parameter name of API key auth
|
200
|
-
def api_key_with_prefix(param_name, param_alias = nil)
|
201
|
-
key = @api_key[param_name]
|
202
|
-
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
203
|
-
if @api_key_prefix[param_name]
|
204
|
-
"#{@api_key_prefix[param_name]} #{key}"
|
205
|
-
else
|
206
|
-
key
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
# Gets Basic Auth token string
|
211
|
-
def basic_auth_token
|
212
|
-
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
213
|
-
end
|
214
|
-
|
215
|
-
# Returns Auth Settings hash for api client.
|
216
|
-
def auth_settings
|
217
|
-
{
|
218
|
-
'oauth2' =>
|
219
|
-
{
|
220
|
-
type: 'oauth2',
|
221
|
-
in: 'header',
|
222
|
-
key: 'Authorization',
|
223
|
-
value: "Bearer #{access_token}"
|
224
|
-
},
|
225
|
-
}
|
226
|
-
end
|
227
|
-
|
228
|
-
# Returns an array of Server setting
|
229
|
-
def server_settings
|
230
|
-
[
|
231
|
-
{
|
232
|
-
url: "https://apis.xbim-dev.net",
|
233
|
-
description: "No description provided",
|
234
|
-
}
|
235
|
-
]
|
236
|
-
end
|
237
|
-
|
238
|
-
def operation_server_settings
|
239
|
-
{
|
240
|
-
}
|
241
|
-
end
|
242
|
-
|
243
|
-
# Returns URL based on server settings
|
244
|
-
#
|
245
|
-
# @param index array index of the server settings
|
246
|
-
# @param variables hash of variable and the corresponding value
|
247
|
-
def server_url(index, variables = {}, servers = nil)
|
248
|
-
servers = server_settings if servers == nil
|
249
|
-
|
250
|
-
# check array index out of bound
|
251
|
-
if (index < 0 || index >= servers.size)
|
252
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
253
|
-
end
|
254
|
-
|
255
|
-
server = servers[index]
|
256
|
-
url = server[:url]
|
257
|
-
|
258
|
-
return url unless server.key? :variables
|
259
|
-
|
260
|
-
# go through variable and assign a value
|
261
|
-
server[:variables].each do |name, variable|
|
262
|
-
if variables.key?(name)
|
263
|
-
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
264
|
-
url.gsub! "{" + name.to_s + "}", variables[name]
|
265
|
-
else
|
266
|
-
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
267
|
-
end
|
268
|
-
else
|
269
|
-
# use default value
|
270
|
-
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
url
|
275
|
-
end
|
276
|
-
|
277
|
-
end
|
278
|
-
end
|
@@ -1,227 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Flex Comms API 2.0
|
3
|
-
|
4
|
-
#Communication centralised around construction data
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 2.0
|
7
|
-
Contact: info@xbim.net
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.4.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module XbimComms
|
17
|
-
class Aggregate
|
18
|
-
attr_accessor :name
|
19
|
-
|
20
|
-
attr_accessor :metric
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{
|
25
|
-
:'name' => :'name',
|
26
|
-
:'metric' => :'metric'
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Returns all the JSON keys this model knows about
|
31
|
-
def self.acceptable_attributes
|
32
|
-
attribute_map.values
|
33
|
-
end
|
34
|
-
|
35
|
-
# Attribute type mapping.
|
36
|
-
def self.openapi_types
|
37
|
-
{
|
38
|
-
:'name' => :'String',
|
39
|
-
:'metric' => :'Integer'
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# List of attributes with nullable: true
|
44
|
-
def self.openapi_nullable
|
45
|
-
Set.new([
|
46
|
-
])
|
47
|
-
end
|
48
|
-
|
49
|
-
# Initializes the object
|
50
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
-
def initialize(attributes = {})
|
52
|
-
if (!attributes.is_a?(Hash))
|
53
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `XbimComms::Aggregate` initialize method"
|
54
|
-
end
|
55
|
-
|
56
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `XbimComms::Aggregate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
-
end
|
61
|
-
h[k.to_sym] = v
|
62
|
-
}
|
63
|
-
|
64
|
-
if attributes.key?(:'name')
|
65
|
-
self.name = attributes[:'name']
|
66
|
-
end
|
67
|
-
|
68
|
-
if attributes.key?(:'metric')
|
69
|
-
self.metric = attributes[:'metric']
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
-
# @return Array for valid properties with the reasons
|
75
|
-
def list_invalid_properties
|
76
|
-
invalid_properties = Array.new
|
77
|
-
invalid_properties
|
78
|
-
end
|
79
|
-
|
80
|
-
# Check to see if the all the properties in the model are valid
|
81
|
-
# @return true if the model is valid
|
82
|
-
def valid?
|
83
|
-
true
|
84
|
-
end
|
85
|
-
|
86
|
-
# Checks equality by comparing each attribute.
|
87
|
-
# @param [Object] Object to be compared
|
88
|
-
def ==(o)
|
89
|
-
return true if self.equal?(o)
|
90
|
-
self.class == o.class &&
|
91
|
-
name == o.name &&
|
92
|
-
metric == o.metric
|
93
|
-
end
|
94
|
-
|
95
|
-
# @see the `==` method
|
96
|
-
# @param [Object] Object to be compared
|
97
|
-
def eql?(o)
|
98
|
-
self == o
|
99
|
-
end
|
100
|
-
|
101
|
-
# Calculates hash code according to all attributes.
|
102
|
-
# @return [Integer] Hash code
|
103
|
-
def hash
|
104
|
-
[name, metric].hash
|
105
|
-
end
|
106
|
-
|
107
|
-
# Builds the object from hash
|
108
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
-
# @return [Object] Returns the model itself
|
110
|
-
def self.build_from_hash(attributes)
|
111
|
-
new.build_from_hash(attributes)
|
112
|
-
end
|
113
|
-
|
114
|
-
# Builds the object from hash
|
115
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
-
# @return [Object] Returns the model itself
|
117
|
-
def build_from_hash(attributes)
|
118
|
-
return nil unless attributes.is_a?(Hash)
|
119
|
-
self.class.openapi_types.each_pair do |key, type|
|
120
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
121
|
-
self.send("#{key}=", nil)
|
122
|
-
elsif type =~ /\AArray<(.*)>/i
|
123
|
-
# check to ensure the input is an array given that the attribute
|
124
|
-
# is documented as an array but the input is not
|
125
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
-
end
|
128
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
self
|
134
|
-
end
|
135
|
-
|
136
|
-
# Deserializes the data based on type
|
137
|
-
# @param string type Data type
|
138
|
-
# @param string value Value to be deserialized
|
139
|
-
# @return [Object] Deserialized data
|
140
|
-
def _deserialize(type, value)
|
141
|
-
case type.to_sym
|
142
|
-
when :Time
|
143
|
-
Time.parse(value)
|
144
|
-
when :Date
|
145
|
-
Date.parse(value)
|
146
|
-
when :String
|
147
|
-
value.to_s
|
148
|
-
when :Integer
|
149
|
-
value.to_i
|
150
|
-
when :Float
|
151
|
-
value.to_f
|
152
|
-
when :Boolean
|
153
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
-
true
|
155
|
-
else
|
156
|
-
false
|
157
|
-
end
|
158
|
-
when :Object
|
159
|
-
# generic object (usually a Hash), return directly
|
160
|
-
value
|
161
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
-
inner_type = Regexp.last_match[:inner_type]
|
163
|
-
value.map { |v| _deserialize(inner_type, v) }
|
164
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
-
k_type = Regexp.last_match[:k_type]
|
166
|
-
v_type = Regexp.last_match[:v_type]
|
167
|
-
{}.tap do |hash|
|
168
|
-
value.each do |k, v|
|
169
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
else # model
|
173
|
-
# models (e.g. Pet) or oneOf
|
174
|
-
klass = XbimComms.const_get(type)
|
175
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
# Returns the string representation of the object
|
180
|
-
# @return [String] String presentation of the object
|
181
|
-
def to_s
|
182
|
-
to_hash.to_s
|
183
|
-
end
|
184
|
-
|
185
|
-
# to_body is an alias to to_hash (backward compatibility)
|
186
|
-
# @return [Hash] Returns the object in the form of hash
|
187
|
-
def to_body
|
188
|
-
to_hash
|
189
|
-
end
|
190
|
-
|
191
|
-
# Returns the object in the form of hash
|
192
|
-
# @return [Hash] Returns the object in the form of hash
|
193
|
-
def to_hash
|
194
|
-
hash = {}
|
195
|
-
self.class.attribute_map.each_pair do |attr, param|
|
196
|
-
value = self.send(attr)
|
197
|
-
if value.nil?
|
198
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
199
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
200
|
-
end
|
201
|
-
|
202
|
-
hash[param] = _to_hash(value)
|
203
|
-
end
|
204
|
-
hash
|
205
|
-
end
|
206
|
-
|
207
|
-
# Outputs non-array value in the form of hash
|
208
|
-
# For object, use to_hash. Otherwise, just return the value
|
209
|
-
# @param [Object] value Any valid value
|
210
|
-
# @return [Hash] Returns the value in the form of hash
|
211
|
-
def _to_hash(value)
|
212
|
-
if value.is_a?(Array)
|
213
|
-
value.compact.map { |v| _to_hash(v) }
|
214
|
-
elsif value.is_a?(Hash)
|
215
|
-
{}.tap do |hash|
|
216
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
-
end
|
218
|
-
elsif value.respond_to? :to_hash
|
219
|
-
value.to_hash
|
220
|
-
else
|
221
|
-
value
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|