primary_connect_client 0.8.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +61 -16
  4. data/docs/Address.md +32 -0
  5. data/docs/CodedValue.md +22 -0
  6. data/docs/DefaultApi.md +568 -0
  7. data/docs/Demographics.md +52 -0
  8. data/docs/Error.md +18 -0
  9. data/docs/Event.md +26 -0
  10. data/docs/Events.md +18 -0
  11. data/docs/Identifier.md +20 -0
  12. data/docs/Location.md +26 -0
  13. data/docs/Meta.md +34 -0
  14. data/docs/MetaDestinations.md +22 -0
  15. data/docs/MetaMessage.md +20 -0
  16. data/docs/MetaSource.md +20 -0
  17. data/docs/MetaTransmission.md +18 -0
  18. data/docs/Name.md +22 -0
  19. data/docs/Order.md +24 -0
  20. data/docs/OrderIds.md +18 -0
  21. data/docs/OrderOrder.md +58 -0
  22. data/docs/OrderOrderClinicalInfo.md +26 -0
  23. data/docs/OrderOrderDiagnoses.md +22 -0
  24. data/docs/OrderOrderOrderingFacility.md +22 -0
  25. data/docs/OrderOrderSpecimen.md +22 -0
  26. data/docs/OrderWithEventErrors.md +20 -0
  27. data/docs/Orders.md +18 -0
  28. data/docs/OrdersOrders.md +22 -0
  29. data/docs/Patient.md +24 -0
  30. data/docs/PatientContacts.md +28 -0
  31. data/docs/PatientDemographics.md +52 -0
  32. data/docs/PhoneNumber.md +20 -0
  33. data/docs/Provider.md +32 -0
  34. data/docs/Result.md +52 -0
  35. data/docs/ResultIds.md +18 -0
  36. data/docs/ResultReferenceRange.md +22 -0
  37. data/docs/ResultReport.md +22 -0
  38. data/docs/ResultSpecimen.md +22 -0
  39. data/docs/Results.md +20 -0
  40. data/docs/Specimen.md +22 -0
  41. data/docs/Visit.md +36 -0
  42. data/docs/VisitCompany.md +24 -0
  43. data/docs/VisitGuarantor.md +40 -0
  44. data/docs/VisitGuarantorEmployer.md +22 -0
  45. data/docs/VisitInsurances.md +40 -0
  46. data/docs/VisitInsured.md +30 -0
  47. data/docs/VisitPlan.md +22 -0
  48. data/git_push.sh +5 -6
  49. data/lib/primary_connect_client/api/default_api.rb +143 -67
  50. data/lib/primary_connect_client/api_client.rb +5 -6
  51. data/lib/primary_connect_client/api_error.rb +1 -1
  52. data/lib/primary_connect_client/configuration.rb +3 -2
  53. data/lib/primary_connect_client/models/address.rb +281 -0
  54. data/lib/primary_connect_client/models/coded_value.rb +238 -0
  55. data/lib/primary_connect_client/models/demographics.rb +466 -0
  56. data/lib/primary_connect_client/models/error.rb +218 -0
  57. data/lib/primary_connect_client/models/event.rb +254 -0
  58. data/lib/primary_connect_client/models/events.rb +221 -0
  59. data/lib/primary_connect_client/models/identifier.rb +228 -0
  60. data/lib/primary_connect_client/models/location.rb +255 -0
  61. data/lib/primary_connect_client/models/meta.rb +327 -0
  62. data/lib/primary_connect_client/models/meta_destinations.rb +242 -0
  63. data/lib/primary_connect_client/models/meta_message.rb +227 -0
  64. data/lib/primary_connect_client/models/meta_source.rb +227 -0
  65. data/lib/primary_connect_client/models/meta_transmission.rb +218 -0
  66. data/lib/primary_connect_client/models/name.rb +237 -0
  67. data/lib/primary_connect_client/models/order.rb +245 -0
  68. data/lib/primary_connect_client/models/order_ids.rb +221 -0
  69. data/lib/primary_connect_client/models/order_order.rb +496 -0
  70. data/lib/primary_connect_client/models/order_order_clinical_info.rb +260 -0
  71. data/lib/primary_connect_client/models/order_order_diagnoses.rb +272 -0
  72. data/lib/primary_connect_client/models/order_order_ordering_facility.rb +239 -0
  73. data/lib/primary_connect_client/models/order_order_specimen.rb +239 -0
  74. data/lib/primary_connect_client/models/order_with_event_errors.rb +229 -0
  75. data/lib/primary_connect_client/models/orders.rb +221 -0
  76. data/lib/primary_connect_client/models/orders_orders.rb +236 -0
  77. data/lib/primary_connect_client/models/patient.rb +253 -0
  78. data/lib/primary_connect_client/models/patient_contacts.rb +305 -0
  79. data/lib/primary_connect_client/models/patient_demographics.rb +466 -0
  80. data/lib/primary_connect_client/models/phone_number.rb +262 -0
  81. data/lib/primary_connect_client/models/provider.rb +288 -0
  82. data/lib/primary_connect_client/models/result.rb +443 -0
  83. data/lib/primary_connect_client/models/result_ids.rb +221 -0
  84. data/lib/primary_connect_client/models/result_reference_range.rb +240 -0
  85. data/lib/primary_connect_client/models/result_report.rb +240 -0
  86. data/lib/primary_connect_client/models/result_specimen.rb +239 -0
  87. data/lib/primary_connect_client/models/results.rb +230 -0
  88. data/lib/primary_connect_client/models/specimen.rb +239 -0
  89. data/lib/primary_connect_client/models/visit.rb +306 -0
  90. data/lib/primary_connect_client/models/visit_company.rb +248 -0
  91. data/lib/primary_connect_client/models/visit_guarantor.rb +358 -0
  92. data/lib/primary_connect_client/models/visit_guarantor_employer.rb +238 -0
  93. data/lib/primary_connect_client/models/visit_insurances.rb +386 -0
  94. data/lib/primary_connect_client/models/visit_insured.rb +322 -0
  95. data/lib/primary_connect_client/models/visit_plan.rb +238 -0
  96. data/lib/primary_connect_client/version.rb +12 -2
  97. data/lib/primary_connect_client.rb +45 -3
  98. data/primary_connect_client.gemspec +7 -5
  99. data/spec/api/default_api_spec.rb +44 -41
  100. data/spec/api_client_spec.rb +3 -3
  101. data/spec/configuration_spec.rb +1 -1
  102. data/spec/models/address_spec.rb +76 -0
  103. data/spec/models/coded_value_spec.rb +46 -0
  104. data/spec/models/demographics_spec.rb +168 -0
  105. data/spec/models/error_spec.rb +34 -0
  106. data/spec/models/event_spec.rb +58 -0
  107. data/spec/models/events_spec.rb +34 -0
  108. data/spec/models/identifier_spec.rb +40 -0
  109. data/spec/models/location_spec.rb +58 -0
  110. data/spec/models/meta_destinations_spec.rb +46 -0
  111. data/spec/models/meta_message_spec.rb +40 -0
  112. data/spec/models/meta_source_spec.rb +40 -0
  113. data/spec/models/meta_spec.rb +86 -0
  114. data/spec/models/meta_transmission_spec.rb +34 -0
  115. data/spec/models/name_spec.rb +46 -0
  116. data/spec/models/order_ids_spec.rb +34 -0
  117. data/spec/models/order_order_clinical_info_spec.rb +58 -0
  118. data/spec/models/order_order_diagnoses_spec.rb +50 -0
  119. data/spec/models/order_order_ordering_facility_spec.rb +46 -0
  120. data/spec/models/order_order_spec.rb +170 -0
  121. data/spec/models/order_order_specimen_spec.rb +46 -0
  122. data/spec/models/order_spec.rb +52 -0
  123. data/spec/models/order_with_event_errors_spec.rb +40 -0
  124. data/spec/models/orders_orders_spec.rb +46 -0
  125. data/spec/models/orders_spec.rb +34 -0
  126. data/spec/models/patient_contacts_spec.rb +68 -0
  127. data/spec/models/patient_demographics_spec.rb +168 -0
  128. data/spec/models/patient_spec.rb +52 -0
  129. data/spec/models/phone_number_spec.rb +44 -0
  130. data/spec/models/provider_spec.rb +76 -0
  131. data/spec/models/result_ids_spec.rb +34 -0
  132. data/spec/models/result_reference_range_spec.rb +46 -0
  133. data/spec/models/result_report_spec.rb +46 -0
  134. data/spec/models/result_spec.rb +148 -0
  135. data/spec/models/result_specimen_spec.rb +46 -0
  136. data/spec/models/results_spec.rb +40 -0
  137. data/spec/models/specimen_spec.rb +46 -0
  138. data/spec/models/visit_company_spec.rb +52 -0
  139. data/spec/models/visit_guarantor_employer_spec.rb +46 -0
  140. data/spec/models/visit_guarantor_spec.rb +104 -0
  141. data/spec/models/visit_insurances_spec.rb +112 -0
  142. data/spec/models/visit_insured_spec.rb +78 -0
  143. data/spec/models/visit_plan_spec.rb +46 -0
  144. data/spec/models/visit_spec.rb +88 -0
  145. data/spec/spec_helper.rb +1 -1
  146. metadata +177 -20
  147. data/Gemfile.lock +0 -74
@@ -0,0 +1,255 @@
1
+ =begin
2
+ #Primary Connect API V1
3
+
4
+ #Client Library to interface with Primary Connect
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PrimaryConnectClient
17
+ class Location
18
+ # E.g. Clinic, Department, Home, Nursing Unit, Provider's Office, Phone
19
+ attr_accessor :type
20
+
21
+ attr_accessor :facility
22
+
23
+ attr_accessor :department
24
+
25
+ attr_accessor :room
26
+
27
+ attr_accessor :bed
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'type' => :'type',
33
+ :'facility' => :'facility',
34
+ :'department' => :'department',
35
+ :'room' => :'room',
36
+ :'bed' => :'bed'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'type' => :'String',
49
+ :'facility' => :'String',
50
+ :'department' => :'String',
51
+ :'room' => :'String',
52
+ :'bed' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Location` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::Location`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'type')
78
+ self.type = attributes[:'type']
79
+ end
80
+
81
+ if attributes.key?(:'facility')
82
+ self.facility = attributes[:'facility']
83
+ end
84
+
85
+ if attributes.key?(:'department')
86
+ self.department = attributes[:'department']
87
+ end
88
+
89
+ if attributes.key?(:'room')
90
+ self.room = attributes[:'room']
91
+ end
92
+
93
+ if attributes.key?(:'bed')
94
+ self.bed = attributes[:'bed']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ type == o.type &&
117
+ facility == o.facility &&
118
+ department == o.department &&
119
+ room == o.room &&
120
+ bed == o.bed
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [type, facility, department, room, bed].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.openapi_types.each_pair do |key, type|
148
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
+ self.send("#{key}=", nil)
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ end
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :Time
171
+ Time.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :Boolean
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ # models (e.g. Pet) or oneOf
202
+ klass = PrimaryConnectClient.const_get(type)
203
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+
253
+ end
254
+
255
+ end
@@ -0,0 +1,327 @@
1
+ =begin
2
+ #Primary Connect API V1
3
+
4
+ #Client Library to interface with Primary Connect
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PrimaryConnectClient
17
+ class Meta
18
+ attr_accessor :event_type
19
+
20
+ attr_accessor :event_date_and_time
21
+
22
+ attr_accessor :test
23
+
24
+ attr_accessor :source
25
+
26
+ attr_accessor :destinations
27
+
28
+ attr_accessor :message
29
+
30
+ attr_accessor :transmission
31
+
32
+ attr_accessor :facility_code
33
+
34
+ # Arbitrary key/value pairs to store with the Order
35
+ attr_accessor :echo
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'event_type' => :'eventType',
63
+ :'event_date_and_time' => :'eventDateAndTime',
64
+ :'test' => :'test',
65
+ :'source' => :'source',
66
+ :'destinations' => :'destinations',
67
+ :'message' => :'message',
68
+ :'transmission' => :'transmission',
69
+ :'facility_code' => :'facilityCode',
70
+ :'echo' => :'echo'
71
+ }
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'event_type' => :'String',
83
+ :'event_date_and_time' => :'Time',
84
+ :'test' => :'Boolean',
85
+ :'source' => :'MetaSource',
86
+ :'destinations' => :'Array<MetaDestinations>',
87
+ :'message' => :'MetaMessage',
88
+ :'transmission' => :'MetaTransmission',
89
+ :'facility_code' => :'String',
90
+ :'echo' => :'Object'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Meta` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::Meta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'event_type')
116
+ self.event_type = attributes[:'event_type']
117
+ end
118
+
119
+ if attributes.key?(:'event_date_and_time')
120
+ self.event_date_and_time = attributes[:'event_date_and_time']
121
+ end
122
+
123
+ if attributes.key?(:'test')
124
+ self.test = attributes[:'test']
125
+ end
126
+
127
+ if attributes.key?(:'source')
128
+ self.source = attributes[:'source']
129
+ end
130
+
131
+ if attributes.key?(:'destinations')
132
+ if (value = attributes[:'destinations']).is_a?(Array)
133
+ self.destinations = value
134
+ end
135
+ end
136
+
137
+ if attributes.key?(:'message')
138
+ self.message = attributes[:'message']
139
+ end
140
+
141
+ if attributes.key?(:'transmission')
142
+ self.transmission = attributes[:'transmission']
143
+ end
144
+
145
+ if attributes.key?(:'facility_code')
146
+ self.facility_code = attributes[:'facility_code']
147
+ end
148
+
149
+ if attributes.key?(:'echo')
150
+ self.echo = attributes[:'echo']
151
+ end
152
+ end
153
+
154
+ # Show invalid properties with the reasons. Usually used together with valid?
155
+ # @return Array for valid properties with the reasons
156
+ def list_invalid_properties
157
+ invalid_properties = Array.new
158
+ invalid_properties
159
+ end
160
+
161
+ # Check to see if the all the properties in the model are valid
162
+ # @return true if the model is valid
163
+ def valid?
164
+ event_type_validator = EnumAttributeValidator.new('String', ["EVENT_TYPE_UNKNOWN", "EVENT_TYPE_NEW_UNSOLICITED", "EVENT_TYPE_UPDATE", "EVENT_TYPE_CANCEL", "EVENT_TYPE_QUERY", "EVENT_TYPE_NEW"])
165
+ return false unless event_type_validator.valid?(@event_type)
166
+ true
167
+ end
168
+
169
+ # Custom attribute writer method checking allowed values (enum).
170
+ # @param [Object] event_type Object to be assigned
171
+ def event_type=(event_type)
172
+ validator = EnumAttributeValidator.new('String', ["EVENT_TYPE_UNKNOWN", "EVENT_TYPE_NEW_UNSOLICITED", "EVENT_TYPE_UPDATE", "EVENT_TYPE_CANCEL", "EVENT_TYPE_QUERY", "EVENT_TYPE_NEW"])
173
+ unless validator.valid?(event_type)
174
+ fail ArgumentError, "invalid value for \"event_type\", must be one of #{validator.allowable_values}."
175
+ end
176
+ @event_type = event_type
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ event_type == o.event_type &&
185
+ event_date_and_time == o.event_date_and_time &&
186
+ test == o.test &&
187
+ source == o.source &&
188
+ destinations == o.destinations &&
189
+ message == o.message &&
190
+ transmission == o.transmission &&
191
+ facility_code == o.facility_code &&
192
+ echo == o.echo
193
+ end
194
+
195
+ # @see the `==` method
196
+ # @param [Object] Object to be compared
197
+ def eql?(o)
198
+ self == o
199
+ end
200
+
201
+ # Calculates hash code according to all attributes.
202
+ # @return [Integer] Hash code
203
+ def hash
204
+ [event_type, event_date_and_time, test, source, destinations, message, transmission, facility_code, echo].hash
205
+ end
206
+
207
+ # Builds the object from hash
208
+ # @param [Hash] attributes Model attributes in the form of hash
209
+ # @return [Object] Returns the model itself
210
+ def self.build_from_hash(attributes)
211
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+ self.class.openapi_types.each_pair do |key, type|
220
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
221
+ self.send("#{key}=", nil)
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :Time
243
+ Time.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ # models (e.g. Pet) or oneOf
274
+ klass = PrimaryConnectClient.const_get(type)
275
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
+ end
277
+ end
278
+
279
+ # Returns the string representation of the object
280
+ # @return [String] String presentation of the object
281
+ def to_s
282
+ to_hash.to_s
283
+ end
284
+
285
+ # to_body is an alias to to_hash (backward compatibility)
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_body
288
+ to_hash
289
+ end
290
+
291
+ # Returns the object in the form of hash
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_hash
294
+ hash = {}
295
+ self.class.attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ if value.nil?
298
+ is_nullable = self.class.openapi_nullable.include?(attr)
299
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
+ end
301
+
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map { |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end