merge_ticketing_client 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -5
- data/docs/PatchedTicketEndpointRequest.md +18 -0
- data/docs/PatchedTicketRequest.md +48 -0
- data/docs/PriorityEnum.md +15 -0
- data/docs/RemoteResponse.md +3 -1
- data/docs/ResponseTypeEnum.md +15 -0
- data/docs/SyncStatus.md +2 -2
- data/docs/Ticket.md +7 -1
- data/docs/TicketRequest.md +7 -1
- data/docs/TicketsApi.md +154 -0
- data/docs/User.md +2 -0
- data/lib/merge_ticketing_client/api/tickets_api.rb +148 -0
- data/lib/merge_ticketing_client/models/data_passthrough_request.rb +1 -1
- data/lib/merge_ticketing_client/models/issue.rb +1 -1
- data/lib/merge_ticketing_client/models/meta_response.rb +1 -1
- data/lib/merge_ticketing_client/models/patched_ticket_endpoint_request.rb +223 -0
- data/lib/merge_ticketing_client/models/patched_ticket_request.rb +397 -0
- data/lib/merge_ticketing_client/models/priority_enum.rb +47 -0
- data/lib/merge_ticketing_client/models/remote_response.rb +14 -11
- data/lib/merge_ticketing_client/models/response_type_enum.rb +45 -0
- data/lib/merge_ticketing_client/models/sync_status.rb +0 -10
- data/lib/merge_ticketing_client/models/ticket.rb +52 -4
- data/lib/merge_ticketing_client/models/ticket_request.rb +53 -5
- data/lib/merge_ticketing_client/models/ticket_status_enum.rb +3 -1
- data/lib/merge_ticketing_client/models/user.rb +12 -1
- data/lib/merge_ticketing_client/version.rb +1 -1
- data/lib/merge_ticketing_client.rb +4 -0
- data/spec/api/tickets_api_spec.rb +26 -0
- data/spec/models/patched_ticket_endpoint_request_spec.rb +34 -0
- data/spec/models/patched_ticket_request_spec.rb +124 -0
- data/spec/models/priority_enum_spec.rb +28 -0
- data/spec/models/remote_response_spec.rb +6 -0
- data/spec/models/response_type_enum_spec.rb +28 -0
- data/spec/models/ticket_request_spec.rb +18 -0
- data/spec/models/ticket_spec.rb +18 -0
- data/spec/models/user_spec.rb +6 -0
- metadata +82 -66
@@ -0,0 +1,223 @@
|
|
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 PatchedTicketEndpointRequest
|
18
|
+
attr_accessor :model
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'model' => :'model'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'model' => :'PatchedTicketRequest'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeTicketingClient::PatchedTicketEndpointRequest` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeTicketingClient::PatchedTicketEndpointRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'model')
|
61
|
+
self.model = attributes[:'model']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
if @model.nil?
|
70
|
+
invalid_properties.push('invalid value for "model", model cannot be nil.')
|
71
|
+
end
|
72
|
+
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return false if @model.nil?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
model == o.model
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[model].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
+
self.send("#{key}=", nil)
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
119
|
+
# check to ensure the input is an array given that the attribute
|
120
|
+
# is documented as an array but the input is not
|
121
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
+
end
|
124
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
self
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deserializes the data based on type
|
133
|
+
# @param string type Data type
|
134
|
+
# @param string value Value to be deserialized
|
135
|
+
# @return [Object] Deserialized data
|
136
|
+
def _deserialize(type, value)
|
137
|
+
case type.to_sym
|
138
|
+
when :Time
|
139
|
+
Time.parse(value)
|
140
|
+
when :Date
|
141
|
+
Date.parse(value)
|
142
|
+
when :String
|
143
|
+
value
|
144
|
+
when :Integer
|
145
|
+
value.to_i
|
146
|
+
when :Float
|
147
|
+
value.to_f
|
148
|
+
when :Boolean
|
149
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
+
true
|
151
|
+
else
|
152
|
+
false
|
153
|
+
end
|
154
|
+
when :Object
|
155
|
+
# generic object (usually a Hash), return directly
|
156
|
+
value
|
157
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
+
inner_type = Regexp.last_match[:inner_type]
|
159
|
+
value.map { |v| _deserialize(inner_type, v) }
|
160
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
+
k_type = Regexp.last_match[:k_type]
|
162
|
+
v_type = Regexp.last_match[:v_type]
|
163
|
+
{}.tap do |hash|
|
164
|
+
value.each do |k, v|
|
165
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
else # model
|
169
|
+
# models (e.g. Pet) or oneOf
|
170
|
+
klass = MergeTicketingClient.const_get(type)
|
171
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the string representation of the object
|
176
|
+
# @return [String] String presentation of the object
|
177
|
+
def to_s
|
178
|
+
to_hash.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the object in the form of hash
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_hash
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
if value.nil?
|
194
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
+
end
|
197
|
+
|
198
|
+
hash[param] = _to_hash(value)
|
199
|
+
end
|
200
|
+
hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Outputs non-array value in the form of hash
|
204
|
+
# For object, use to_hash. Otherwise, just return the value
|
205
|
+
# @param [Object] value Any valid value
|
206
|
+
# @return [Hash] Returns the value in the form of hash
|
207
|
+
def _to_hash(value)
|
208
|
+
if value.is_a?(Array)
|
209
|
+
value.compact.map { |v| _to_hash(v) }
|
210
|
+
elsif value.is_a?(Hash)
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
+
end
|
214
|
+
elsif value.respond_to? :to_hash
|
215
|
+
value.to_hash
|
216
|
+
else
|
217
|
+
value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
@@ -0,0 +1,397 @@
|
|
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
|
+
# # The Ticket Object ### Description The `Ticket` object is used to represent a ticket or a task within a system. ### Usage Example TODO
|
18
|
+
class PatchedTicketRequest
|
19
|
+
# The ticket's name.
|
20
|
+
attr_accessor :name
|
21
|
+
|
22
|
+
attr_accessor :assignees
|
23
|
+
|
24
|
+
# The ticket's due date.
|
25
|
+
attr_accessor :due_date
|
26
|
+
|
27
|
+
# The current status of the ticket.
|
28
|
+
attr_accessor :status
|
29
|
+
|
30
|
+
# The ticket's description.
|
31
|
+
attr_accessor :description
|
32
|
+
|
33
|
+
attr_accessor :project
|
34
|
+
|
35
|
+
# The ticket's type.
|
36
|
+
attr_accessor :ticket_type
|
37
|
+
|
38
|
+
attr_accessor :account
|
39
|
+
|
40
|
+
attr_accessor :contact
|
41
|
+
|
42
|
+
attr_accessor :parent_ticket
|
43
|
+
|
44
|
+
attr_accessor :tags
|
45
|
+
|
46
|
+
# When the third party's ticket was created.
|
47
|
+
attr_accessor :remote_created_at
|
48
|
+
|
49
|
+
# When the third party's ticket was updated.
|
50
|
+
attr_accessor :remote_updated_at
|
51
|
+
|
52
|
+
# When the ticket was completed.
|
53
|
+
attr_accessor :completed_at
|
54
|
+
|
55
|
+
# The 3rd party url of the Ticket.
|
56
|
+
attr_accessor :ticket_url
|
57
|
+
|
58
|
+
# The priority or urgency of the Ticket. Possible values include: URGENT, HIGH, NORMAL, LOW - in cases where there is no clear mapping - the original value passed through.
|
59
|
+
attr_accessor :priority
|
60
|
+
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
62
|
+
def self.attribute_map
|
63
|
+
{
|
64
|
+
:'name' => :'name',
|
65
|
+
:'assignees' => :'assignees',
|
66
|
+
:'due_date' => :'due_date',
|
67
|
+
:'status' => :'status',
|
68
|
+
:'description' => :'description',
|
69
|
+
:'project' => :'project',
|
70
|
+
:'ticket_type' => :'ticket_type',
|
71
|
+
:'account' => :'account',
|
72
|
+
:'contact' => :'contact',
|
73
|
+
:'parent_ticket' => :'parent_ticket',
|
74
|
+
:'tags' => :'tags',
|
75
|
+
:'remote_created_at' => :'remote_created_at',
|
76
|
+
:'remote_updated_at' => :'remote_updated_at',
|
77
|
+
:'completed_at' => :'completed_at',
|
78
|
+
:'ticket_url' => :'ticket_url',
|
79
|
+
:'priority' => :'priority'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns all the JSON keys this model knows about
|
84
|
+
def self.acceptable_attributes
|
85
|
+
attribute_map.values
|
86
|
+
end
|
87
|
+
|
88
|
+
# Attribute type mapping.
|
89
|
+
def self.openapi_types
|
90
|
+
{
|
91
|
+
:'name' => :'String',
|
92
|
+
:'assignees' => :'Array<String>',
|
93
|
+
:'due_date' => :'Time',
|
94
|
+
:'status' => :'TicketStatusEnum',
|
95
|
+
:'description' => :'String',
|
96
|
+
:'project' => :'String',
|
97
|
+
:'ticket_type' => :'String',
|
98
|
+
:'account' => :'String',
|
99
|
+
:'contact' => :'String',
|
100
|
+
:'parent_ticket' => :'String',
|
101
|
+
:'tags' => :'Array<String>',
|
102
|
+
:'remote_created_at' => :'Time',
|
103
|
+
:'remote_updated_at' => :'Time',
|
104
|
+
:'completed_at' => :'Time',
|
105
|
+
:'ticket_url' => :'String',
|
106
|
+
:'priority' => :'PriorityEnum'
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
# List of attributes with nullable: true
|
111
|
+
def self.openapi_nullable
|
112
|
+
Set.new([
|
113
|
+
:'name',
|
114
|
+
:'due_date',
|
115
|
+
:'status',
|
116
|
+
:'description',
|
117
|
+
:'project',
|
118
|
+
:'ticket_type',
|
119
|
+
:'account',
|
120
|
+
:'contact',
|
121
|
+
:'parent_ticket',
|
122
|
+
:'remote_created_at',
|
123
|
+
:'remote_updated_at',
|
124
|
+
:'completed_at',
|
125
|
+
:'ticket_url',
|
126
|
+
:'priority'
|
127
|
+
])
|
128
|
+
end
|
129
|
+
|
130
|
+
# Initializes the object
|
131
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
132
|
+
def initialize(attributes = {})
|
133
|
+
if (!attributes.is_a?(Hash))
|
134
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeTicketingClient::PatchedTicketRequest` initialize method"
|
135
|
+
end
|
136
|
+
|
137
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
138
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
139
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
140
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeTicketingClient::PatchedTicketRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
141
|
+
end
|
142
|
+
h[k.to_sym] = v
|
143
|
+
}
|
144
|
+
|
145
|
+
if attributes.key?(:'name')
|
146
|
+
self.name = attributes[:'name']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'assignees')
|
150
|
+
if (value = attributes[:'assignees']).is_a?(Array)
|
151
|
+
self.assignees = value
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'due_date')
|
156
|
+
self.due_date = attributes[:'due_date']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'status')
|
160
|
+
self.status = attributes[:'status']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'description')
|
164
|
+
self.description = attributes[:'description']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.key?(:'project')
|
168
|
+
self.project = attributes[:'project']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'ticket_type')
|
172
|
+
self.ticket_type = attributes[:'ticket_type']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'account')
|
176
|
+
self.account = attributes[:'account']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'contact')
|
180
|
+
self.contact = attributes[:'contact']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'parent_ticket')
|
184
|
+
self.parent_ticket = attributes[:'parent_ticket']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'tags')
|
188
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
189
|
+
self.tags = value
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.key?(:'remote_created_at')
|
194
|
+
self.remote_created_at = attributes[:'remote_created_at']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.key?(:'remote_updated_at')
|
198
|
+
self.remote_updated_at = attributes[:'remote_updated_at']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.key?(:'completed_at')
|
202
|
+
self.completed_at = attributes[:'completed_at']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.key?(:'ticket_url')
|
206
|
+
self.ticket_url = attributes[:'ticket_url']
|
207
|
+
end
|
208
|
+
|
209
|
+
if attributes.key?(:'priority')
|
210
|
+
self.priority = attributes[:'priority']
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
215
|
+
# @return Array for valid properties with the reasons
|
216
|
+
def list_invalid_properties
|
217
|
+
invalid_properties = Array.new
|
218
|
+
if !@ticket_url.nil? && @ticket_url.to_s.length > 2000
|
219
|
+
invalid_properties.push('invalid value for "ticket_url", the character length must be smaller than or equal to 2000.')
|
220
|
+
end
|
221
|
+
|
222
|
+
invalid_properties
|
223
|
+
end
|
224
|
+
|
225
|
+
# Check to see if the all the properties in the model are valid
|
226
|
+
# @return true if the model is valid
|
227
|
+
def valid?
|
228
|
+
return false if !@ticket_url.nil? && @ticket_url.to_s.length > 2000
|
229
|
+
true
|
230
|
+
end
|
231
|
+
|
232
|
+
# Custom attribute writer method with validation
|
233
|
+
# @param [Object] ticket_url Value to be assigned
|
234
|
+
def ticket_url=(ticket_url)
|
235
|
+
if !ticket_url.nil? && ticket_url.to_s.length > 2000
|
236
|
+
fail ArgumentError, 'invalid value for "ticket_url", the character length must be smaller than or equal to 2000.'
|
237
|
+
end
|
238
|
+
|
239
|
+
@ticket_url = ticket_url
|
240
|
+
end
|
241
|
+
|
242
|
+
# Checks equality by comparing each attribute.
|
243
|
+
# @param [Object] Object to be compared
|
244
|
+
def ==(o)
|
245
|
+
return true if self.equal?(o)
|
246
|
+
self.class == o.class &&
|
247
|
+
name == o.name &&
|
248
|
+
assignees == o.assignees &&
|
249
|
+
due_date == o.due_date &&
|
250
|
+
status == o.status &&
|
251
|
+
description == o.description &&
|
252
|
+
project == o.project &&
|
253
|
+
ticket_type == o.ticket_type &&
|
254
|
+
account == o.account &&
|
255
|
+
contact == o.contact &&
|
256
|
+
parent_ticket == o.parent_ticket &&
|
257
|
+
tags == o.tags &&
|
258
|
+
remote_created_at == o.remote_created_at &&
|
259
|
+
remote_updated_at == o.remote_updated_at &&
|
260
|
+
completed_at == o.completed_at &&
|
261
|
+
ticket_url == o.ticket_url &&
|
262
|
+
priority == o.priority
|
263
|
+
end
|
264
|
+
|
265
|
+
# @see the `==` method
|
266
|
+
# @param [Object] Object to be compared
|
267
|
+
def eql?(o)
|
268
|
+
self == o
|
269
|
+
end
|
270
|
+
|
271
|
+
# Calculates hash code according to all attributes.
|
272
|
+
# @return [Integer] Hash code
|
273
|
+
def hash
|
274
|
+
[name, assignees, due_date, status, description, project, ticket_type, account, contact, parent_ticket, tags, remote_created_at, remote_updated_at, completed_at, ticket_url, priority].hash
|
275
|
+
end
|
276
|
+
|
277
|
+
# Builds the object from hash
|
278
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
279
|
+
# @return [Object] Returns the model itself
|
280
|
+
def self.build_from_hash(attributes)
|
281
|
+
new.build_from_hash(attributes)
|
282
|
+
end
|
283
|
+
|
284
|
+
# Builds the object from hash
|
285
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
286
|
+
# @return [Object] Returns the model itself
|
287
|
+
def build_from_hash(attributes)
|
288
|
+
return nil unless attributes.is_a?(Hash)
|
289
|
+
self.class.openapi_types.each_pair do |key, type|
|
290
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
291
|
+
self.send("#{key}=", nil)
|
292
|
+
elsif type =~ /\AArray<(.*)>/i
|
293
|
+
# check to ensure the input is an array given that the attribute
|
294
|
+
# is documented as an array but the input is not
|
295
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
296
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
297
|
+
end
|
298
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
299
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
self
|
304
|
+
end
|
305
|
+
|
306
|
+
# Deserializes the data based on type
|
307
|
+
# @param string type Data type
|
308
|
+
# @param string value Value to be deserialized
|
309
|
+
# @return [Object] Deserialized data
|
310
|
+
def _deserialize(type, value)
|
311
|
+
case type.to_sym
|
312
|
+
when :Time
|
313
|
+
Time.parse(value)
|
314
|
+
when :Date
|
315
|
+
Date.parse(value)
|
316
|
+
when :String
|
317
|
+
value
|
318
|
+
when :Integer
|
319
|
+
value.to_i
|
320
|
+
when :Float
|
321
|
+
value.to_f
|
322
|
+
when :Boolean
|
323
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
324
|
+
true
|
325
|
+
else
|
326
|
+
false
|
327
|
+
end
|
328
|
+
when :Object
|
329
|
+
# generic object (usually a Hash), return directly
|
330
|
+
value
|
331
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
332
|
+
inner_type = Regexp.last_match[:inner_type]
|
333
|
+
value.map { |v| _deserialize(inner_type, v) }
|
334
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
335
|
+
k_type = Regexp.last_match[:k_type]
|
336
|
+
v_type = Regexp.last_match[:v_type]
|
337
|
+
{}.tap do |hash|
|
338
|
+
value.each do |k, v|
|
339
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
else # model
|
343
|
+
# models (e.g. Pet) or oneOf
|
344
|
+
klass = MergeTicketingClient.const_get(type)
|
345
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
# Returns the string representation of the object
|
350
|
+
# @return [String] String presentation of the object
|
351
|
+
def to_s
|
352
|
+
to_hash.to_s
|
353
|
+
end
|
354
|
+
|
355
|
+
# to_body is an alias to to_hash (backward compatibility)
|
356
|
+
# @return [Hash] Returns the object in the form of hash
|
357
|
+
def to_body
|
358
|
+
to_hash
|
359
|
+
end
|
360
|
+
|
361
|
+
# Returns the object in the form of hash
|
362
|
+
# @return [Hash] Returns the object in the form of hash
|
363
|
+
def to_hash
|
364
|
+
hash = {}
|
365
|
+
self.class.attribute_map.each_pair do |attr, param|
|
366
|
+
value = self.send(attr)
|
367
|
+
if value.nil?
|
368
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
369
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
370
|
+
end
|
371
|
+
|
372
|
+
hash[param] = _to_hash(value)
|
373
|
+
end
|
374
|
+
hash
|
375
|
+
end
|
376
|
+
|
377
|
+
# Outputs non-array value in the form of hash
|
378
|
+
# For object, use to_hash. Otherwise, just return the value
|
379
|
+
# @param [Object] value Any valid value
|
380
|
+
# @return [Hash] Returns the value in the form of hash
|
381
|
+
def _to_hash(value)
|
382
|
+
if value.is_a?(Array)
|
383
|
+
value.compact.map { |v| _to_hash(v) }
|
384
|
+
elsif value.is_a?(Hash)
|
385
|
+
{}.tap do |hash|
|
386
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
387
|
+
end
|
388
|
+
elsif value.respond_to? :to_hash
|
389
|
+
value.to_hash
|
390
|
+
else
|
391
|
+
value
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
end
|
396
|
+
|
397
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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 PriorityEnum
|
18
|
+
URGENT = "URGENT".freeze
|
19
|
+
HIGH = "HIGH".freeze
|
20
|
+
NORMAL = "NORMAL".freeze
|
21
|
+
LOW = "LOW".freeze
|
22
|
+
|
23
|
+
MERGE_NONSTANDARD_VALUE = "MERGE_NONSTANDARD_VALUE".freeze
|
24
|
+
|
25
|
+
attr_accessor :value
|
26
|
+
attr_accessor :raw_value
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def build_from_hash(value)
|
32
|
+
@raw_value = value
|
33
|
+
if ["URGENT", "HIGH", "NORMAL", "LOW", ].include? value
|
34
|
+
@value = value
|
35
|
+
else
|
36
|
+
@value = MERGE_NONSTANDARD_VALUE
|
37
|
+
end
|
38
|
+
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.build_from_hash(value)
|
43
|
+
IssueStatusEnum.new.build_from_hash(value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|