merge_ticketing_client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -6
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountIntegration.md +1 -1
  5. data/docs/Attachment.md +5 -3
  6. data/docs/AttachmentRequest.md +7 -3
  7. data/docs/Collection.md +34 -0
  8. data/docs/CollectionTypeEnum.md +15 -0
  9. data/docs/CollectionsApi.md +193 -0
  10. data/docs/Comment.md +6 -4
  11. data/docs/CommentRequest.md +8 -4
  12. data/docs/ConditionSchema.md +30 -0
  13. data/docs/ConditionTypeEnum.md +15 -0
  14. data/docs/Contact.md +3 -1
  15. data/docs/DataPassthroughRequest.md +1 -1
  16. data/docs/EndUserDetailsRequest.md +2 -2
  17. data/docs/Issue.md +9 -7
  18. data/docs/LinkToken.md +1 -1
  19. data/docs/LinkedAccountCondition.md +28 -0
  20. data/docs/LinkedAccountConditionRequest.md +22 -0
  21. data/docs/LinkedAccountSelectiveSyncConfiguration.md +18 -0
  22. data/docs/LinkedAccountSelectiveSyncConfigurationListRequest.md +18 -0
  23. data/docs/LinkedAccountSelectiveSyncConfigurationRequest.md +18 -0
  24. data/docs/OperatorSchema.md +20 -0
  25. data/docs/PaginatedCollectionList.md +22 -0
  26. data/docs/PaginatedConditionSchemaList.md +22 -0
  27. data/docs/PatchedTicketRequest.md +15 -7
  28. data/docs/Project.md +3 -1
  29. data/docs/ProjectsApi.md +10 -8
  30. data/docs/SelectiveSyncApi.md +233 -0
  31. data/docs/SelectiveSyncConfigurationsUsageEnum.md +15 -0
  32. data/docs/SyncStatus.md +5 -3
  33. data/docs/Tag.md +3 -1
  34. data/docs/Team.md +3 -1
  35. data/docs/Ticket.md +13 -7
  36. data/docs/TicketRequest.md +15 -7
  37. data/docs/TicketsApi.md +53 -13
  38. data/docs/User.md +3 -1
  39. data/docs/UsersApi.md +2 -0
  40. data/lib/merge_ticketing_client/api/collections_api.rb +234 -0
  41. data/lib/merge_ticketing_client/api/linked_accounts_api.rb +1 -1
  42. data/lib/merge_ticketing_client/api/projects_api.rb +14 -11
  43. data/lib/merge_ticketing_client/api/selective_sync_api.rb +225 -0
  44. data/lib/merge_ticketing_client/api/tickets_api.rb +94 -19
  45. data/lib/merge_ticketing_client/api/users_api.rb +3 -0
  46. data/lib/merge_ticketing_client/models/account.rb +16 -4
  47. data/lib/merge_ticketing_client/models/account_details_and_actions_status_enum.rb +1 -1
  48. data/lib/merge_ticketing_client/models/account_integration.rb +1 -1
  49. data/lib/merge_ticketing_client/models/attachment.rb +18 -4
  50. data/lib/merge_ticketing_client/models/attachment_request.rb +31 -5
  51. data/lib/merge_ticketing_client/models/categories_enum.rb +1 -1
  52. data/lib/merge_ticketing_client/models/category_enum.rb +1 -1
  53. data/lib/merge_ticketing_client/models/collection.rb +308 -0
  54. data/lib/merge_ticketing_client/models/collection_type_enum.rb +45 -0
  55. data/lib/merge_ticketing_client/models/comment.rb +19 -4
  56. data/lib/merge_ticketing_client/models/comment_request.rb +32 -5
  57. data/lib/merge_ticketing_client/models/condition_schema.rb +297 -0
  58. data/lib/merge_ticketing_client/models/condition_type_enum.rb +50 -0
  59. data/lib/merge_ticketing_client/models/contact.rb +16 -4
  60. data/lib/merge_ticketing_client/models/data_passthrough_request.rb +1 -0
  61. data/lib/merge_ticketing_client/models/encoding_enum.rb +1 -1
  62. data/lib/merge_ticketing_client/models/end_user_details_request.rb +2 -2
  63. data/lib/merge_ticketing_client/models/issue.rb +15 -4
  64. data/lib/merge_ticketing_client/models/link_token.rb +0 -5
  65. data/lib/merge_ticketing_client/models/linked_account_condition.rb +282 -0
  66. data/lib/merge_ticketing_client/models/linked_account_condition_request.rb +269 -0
  67. data/lib/merge_ticketing_client/models/linked_account_selective_sync_configuration.rb +221 -0
  68. data/lib/merge_ticketing_client/models/linked_account_selective_sync_configuration_list_request.rb +226 -0
  69. data/lib/merge_ticketing_client/models/linked_account_selective_sync_configuration_request.rb +226 -0
  70. data/lib/merge_ticketing_client/models/method_enum.rb +1 -1
  71. data/lib/merge_ticketing_client/models/operator_schema.rb +229 -0
  72. data/lib/merge_ticketing_client/models/paginated_collection_list.rb +240 -0
  73. data/lib/merge_ticketing_client/models/paginated_condition_schema_list.rb +240 -0
  74. data/lib/merge_ticketing_client/models/patched_ticket_request.rb +57 -7
  75. data/lib/merge_ticketing_client/models/priority_enum.rb +1 -1
  76. data/lib/merge_ticketing_client/models/project.rb +16 -4
  77. data/lib/merge_ticketing_client/models/request_format_enum.rb +1 -1
  78. data/lib/merge_ticketing_client/models/response_type_enum.rb +1 -1
  79. data/lib/merge_ticketing_client/models/selective_sync_configurations_usage_enum.rb +45 -0
  80. data/lib/merge_ticketing_client/models/sync_status.rb +13 -4
  81. data/lib/merge_ticketing_client/models/sync_status_status_enum.rb +1 -1
  82. data/lib/merge_ticketing_client/models/tag.rb +16 -4
  83. data/lib/merge_ticketing_client/models/team.rb +16 -4
  84. data/lib/merge_ticketing_client/models/ticket.rb +45 -7
  85. data/lib/merge_ticketing_client/models/ticket_request.rb +57 -7
  86. data/lib/merge_ticketing_client/models/ticket_status_enum.rb +1 -1
  87. data/lib/merge_ticketing_client/models/user.rb +16 -4
  88. data/lib/merge_ticketing_client/version.rb +1 -1
  89. data/lib/merge_ticketing_client.rb +15 -0
  90. data/spec/api/collections_api_spec.rb +76 -0
  91. data/spec/api/projects_api_spec.rb +3 -2
  92. data/spec/api/selective_sync_api_spec.rb +72 -0
  93. data/spec/api/tickets_api_spec.rb +24 -4
  94. data/spec/api/users_api_spec.rb +1 -0
  95. data/spec/models/account_spec.rb +6 -0
  96. data/spec/models/attachment_request_spec.rb +12 -0
  97. data/spec/models/attachment_spec.rb +6 -0
  98. data/spec/models/collection_spec.rb +82 -0
  99. data/spec/models/collection_type_enum_spec.rb +28 -0
  100. data/spec/models/comment_request_spec.rb +12 -0
  101. data/spec/models/comment_spec.rb +6 -0
  102. data/spec/models/condition_schema_spec.rb +70 -0
  103. data/spec/models/condition_type_enum_spec.rb +28 -0
  104. data/spec/models/contact_spec.rb +6 -0
  105. data/spec/models/issue_spec.rb +6 -0
  106. data/spec/models/linked_account_condition_request_spec.rb +46 -0
  107. data/spec/models/linked_account_condition_spec.rb +64 -0
  108. data/spec/models/linked_account_selective_sync_configuration_list_request_spec.rb +34 -0
  109. data/spec/models/linked_account_selective_sync_configuration_request_spec.rb +34 -0
  110. data/spec/models/linked_account_selective_sync_configuration_spec.rb +34 -0
  111. data/spec/models/operator_schema_spec.rb +40 -0
  112. data/spec/models/paginated_collection_list_spec.rb +46 -0
  113. data/spec/models/paginated_condition_schema_list_spec.rb +46 -0
  114. data/spec/models/patched_ticket_request_spec.rb +24 -0
  115. data/spec/models/project_spec.rb +6 -0
  116. data/spec/models/selective_sync_configurations_usage_enum_spec.rb +28 -0
  117. data/spec/models/sync_status_spec.rb +6 -0
  118. data/spec/models/tag_spec.rb +6 -0
  119. data/spec/models/team_spec.rb +6 -0
  120. data/spec/models/ticket_request_spec.rb +24 -0
  121. data/spec/models/ticket_spec.rb +18 -0
  122. data/spec/models/user_spec.rb +6 -0
  123. metadata +132 -72
@@ -0,0 +1,229 @@
1
+ =begin
2
+ #Merge Ticketing API
3
+
4
+ #The unified API for building rich integrations with multiple Ticketing platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeTicketingClient
17
+ class OperatorSchema
18
+ # The operator for which an operator schema is defined.
19
+ attr_accessor :operator
20
+
21
+ # Whether the operator can be repeated multiple times.
22
+ attr_accessor :is_unique
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'operator' => :'operator',
28
+ :'is_unique' => :'is_unique'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'operator' => :'String',
41
+ :'is_unique' => :'Boolean'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeTicketingClient::OperatorSchema` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeTicketingClient::OperatorSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'operator')
67
+ self.operator = attributes[:'operator']
68
+ end
69
+
70
+ if attributes.key?(:'is_unique')
71
+ self.is_unique = attributes[:'is_unique']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ operator == o.operator &&
94
+ is_unique == o.is_unique
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [operator, is_unique].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.openapi_types.each_pair do |key, type|
122
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
123
+ self.send("#{key}=", nil)
124
+ elsif type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :Time
145
+ Time.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ # models (e.g. Pet) or oneOf
176
+ klass = MergeTicketingClient.const_get(type)
177
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Merge Ticketing API
3
+
4
+ #The unified API for building rich integrations with multiple Ticketing platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeTicketingClient
17
+ class PaginatedCollectionList
18
+ attr_accessor :_next
19
+
20
+ attr_accessor :previous
21
+
22
+ attr_accessor :results
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'_next' => :'next',
28
+ :'previous' => :'previous',
29
+ :'results' => :'results'
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
+ :'_next' => :'String',
42
+ :'previous' => :'String',
43
+ :'results' => :'Array<Collection>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'_next',
51
+ :'previous',
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeTicketingClient::PaginatedCollectionList` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeTicketingClient::PaginatedCollectionList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'_next')
71
+ self._next = attributes[:'_next']
72
+ end
73
+
74
+ if attributes.key?(:'previous')
75
+ self.previous = attributes[:'previous']
76
+ end
77
+
78
+ if attributes.key?(:'results')
79
+ if (value = attributes[:'results']).is_a?(Array)
80
+ self.results = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ _next == o._next &&
104
+ previous == o.previous &&
105
+ results == o.results
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [_next, previous, results].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = MergeTicketingClient.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Merge Ticketing API
3
+
4
+ #The unified API for building rich integrations with multiple Ticketing platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeTicketingClient
17
+ class PaginatedConditionSchemaList
18
+ attr_accessor :_next
19
+
20
+ attr_accessor :previous
21
+
22
+ attr_accessor :results
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'_next' => :'next',
28
+ :'previous' => :'previous',
29
+ :'results' => :'results'
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
+ :'_next' => :'String',
42
+ :'previous' => :'String',
43
+ :'results' => :'Array<ConditionSchema>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'_next',
51
+ :'previous',
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeTicketingClient::PaginatedConditionSchemaList` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeTicketingClient::PaginatedConditionSchemaList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'_next')
71
+ self._next = attributes[:'_next']
72
+ end
73
+
74
+ if attributes.key?(:'previous')
75
+ self.previous = attributes[:'previous']
76
+ end
77
+
78
+ if attributes.key?(:'results')
79
+ if (value = attributes[:'results']).is_a?(Array)
80
+ self.results = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ _next == o._next &&
104
+ previous == o.previous &&
105
+ results == o.results
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [_next, previous, results].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = MergeTicketingClient.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end