carbon_ruby_sdk 0.2.38 → 0.2.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +310 -2
- data/lib/carbon_ruby_sdk/api/github_api.rb +825 -0
- data/lib/carbon_ruby_sdk/models/comments_input.rb +330 -0
- data/lib/carbon_ruby_sdk/models/comments_order_by.rb +36 -0
- data/lib/carbon_ruby_sdk/models/comments_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/commit.rb +282 -0
- data/lib/carbon_ruby_sdk/models/commit_user.rb +234 -0
- data/lib/carbon_ruby_sdk/models/commit_user_nullable.rb +234 -0
- data/lib/carbon_ruby_sdk/models/commits_input.rb +307 -0
- data/lib/carbon_ruby_sdk/models/commits_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/file_status.rb +41 -0
- data/lib/carbon_ruby_sdk/models/files_input.rb +307 -0
- data/lib/carbon_ruby_sdk/models/files_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/head_or_base.rb +248 -0
- data/lib/carbon_ruby_sdk/models/issue.rb +434 -0
- data/lib/carbon_ruby_sdk/models/issue_pr.rb +230 -0
- data/lib/carbon_ruby_sdk/models/issue_pr_nullable.rb +230 -0
- data/lib/carbon_ruby_sdk/models/issues_filter.rb +217 -0
- data/lib/carbon_ruby_sdk/models/issues_input.rb +325 -0
- data/lib/carbon_ruby_sdk/models/issues_order_by.rb +37 -0
- data/lib/carbon_ruby_sdk/models/issues_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/label.rb +234 -0
- data/lib/carbon_ruby_sdk/models/pr_comment.rb +358 -0
- data/lib/carbon_ruby_sdk/models/pr_commit.rb +264 -0
- data/lib/carbon_ruby_sdk/models/pr_file.rb +342 -0
- data/lib/carbon_ruby_sdk/models/pr_order_by.rb +37 -0
- data/lib/carbon_ruby_sdk/models/pr_state.rb +36 -0
- data/lib/carbon_ruby_sdk/models/pr_state_input.rb +37 -0
- data/lib/carbon_ruby_sdk/models/pull_request.rb +438 -0
- data/lib/carbon_ruby_sdk/models/pull_request_extended.rb +536 -0
- data/lib/carbon_ruby_sdk/models/pull_request_filters.rb +239 -0
- data/lib/carbon_ruby_sdk/models/pull_request_response.rb +232 -0
- data/lib/carbon_ruby_sdk/models/pull_requests_input.rb +325 -0
- data/lib/carbon_ruby_sdk/models/team.rb +234 -0
- data/lib/carbon_ruby_sdk/models/tree.rb +234 -0
- data/lib/carbon_ruby_sdk/models/user.rb +234 -0
- data/lib/carbon_ruby_sdk/models/user_nullable.rb +234 -0
- data/lib/carbon_ruby_sdk/version.rb +1 -1
- data/lib/carbon_ruby_sdk.rb +38 -0
- data/spec/api/github_api_spec.rb +112 -0
- data/spec/models/comments_input_spec.rb +76 -0
- data/spec/models/comments_order_by_spec.rb +22 -0
- data/spec/models/comments_response_spec.rb +34 -0
- data/spec/models/commit_spec.rb +58 -0
- data/spec/models/commit_user_nullable_spec.rb +34 -0
- data/spec/models/commit_user_spec.rb +34 -0
- data/spec/models/commits_input_spec.rb +64 -0
- data/spec/models/commits_response_spec.rb +34 -0
- data/spec/models/file_status_spec.rb +22 -0
- data/spec/models/files_input_spec.rb +64 -0
- data/spec/models/files_response_spec.rb +34 -0
- data/spec/models/head_or_base_spec.rb +40 -0
- data/spec/models/issue_pr_nullable_spec.rb +34 -0
- data/spec/models/issue_pr_spec.rb +34 -0
- data/spec/models/issue_spec.rb +124 -0
- data/spec/models/issues_filter_spec.rb +28 -0
- data/spec/models/issues_input_spec.rb +76 -0
- data/spec/models/issues_order_by_spec.rb +22 -0
- data/spec/models/issues_response_spec.rb +34 -0
- data/spec/models/label_spec.rb +34 -0
- data/spec/models/pr_comment_spec.rb +94 -0
- data/spec/models/pr_commit_spec.rb +52 -0
- data/spec/models/pr_file_spec.rb +82 -0
- data/spec/models/pr_order_by_spec.rb +22 -0
- data/spec/models/pr_state_input_spec.rb +22 -0
- data/spec/models/pr_state_spec.rb +22 -0
- data/spec/models/pull_request_extended_spec.rb +166 -0
- data/spec/models/pull_request_filters_spec.rb +40 -0
- data/spec/models/pull_request_response_spec.rb +34 -0
- data/spec/models/pull_request_spec.rb +124 -0
- data/spec/models/pull_requests_input_spec.rb +76 -0
- data/spec/models/team_spec.rb +34 -0
- data/spec/models/tree_spec.rb +34 -0
- data/spec/models/user_nullable_spec.rb +34 -0
- data/spec/models/user_spec.rb +34 -0
- metadata +301 -193
@@ -0,0 +1,434 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'time'
|
11
|
+
|
12
|
+
module Carbon
|
13
|
+
class Issue
|
14
|
+
attr_accessor :title
|
15
|
+
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
attr_accessor :url
|
19
|
+
|
20
|
+
attr_accessor :html_url
|
21
|
+
|
22
|
+
attr_accessor :number
|
23
|
+
|
24
|
+
attr_accessor :user
|
25
|
+
|
26
|
+
attr_accessor :labels
|
27
|
+
|
28
|
+
attr_accessor :state
|
29
|
+
|
30
|
+
attr_accessor :locked
|
31
|
+
|
32
|
+
attr_accessor :num_comments
|
33
|
+
|
34
|
+
attr_accessor :created_at
|
35
|
+
|
36
|
+
attr_accessor :updated_at
|
37
|
+
|
38
|
+
attr_accessor :closed_at
|
39
|
+
|
40
|
+
attr_accessor :draft
|
41
|
+
|
42
|
+
attr_accessor :pull_request
|
43
|
+
|
44
|
+
attr_accessor :body
|
45
|
+
|
46
|
+
attr_accessor :closed_by
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'title' => :'title',
|
52
|
+
:'id' => :'id',
|
53
|
+
:'url' => :'url',
|
54
|
+
:'html_url' => :'html_url',
|
55
|
+
:'number' => :'number',
|
56
|
+
:'user' => :'user',
|
57
|
+
:'labels' => :'labels',
|
58
|
+
:'state' => :'state',
|
59
|
+
:'locked' => :'locked',
|
60
|
+
:'num_comments' => :'num_comments',
|
61
|
+
:'created_at' => :'created_at',
|
62
|
+
:'updated_at' => :'updated_at',
|
63
|
+
:'closed_at' => :'closed_at',
|
64
|
+
:'draft' => :'draft',
|
65
|
+
:'pull_request' => :'pull_request',
|
66
|
+
:'body' => :'body',
|
67
|
+
:'closed_by' => :'closed_by'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns all the JSON keys this model knows about
|
72
|
+
def self.acceptable_attributes
|
73
|
+
attribute_map.values
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute type mapping.
|
77
|
+
def self.openapi_types
|
78
|
+
{
|
79
|
+
:'title' => :'String',
|
80
|
+
:'id' => :'Integer',
|
81
|
+
:'url' => :'String',
|
82
|
+
:'html_url' => :'String',
|
83
|
+
:'number' => :'Integer',
|
84
|
+
:'user' => :'User',
|
85
|
+
:'labels' => :'Array<Label>',
|
86
|
+
:'state' => :'PRState',
|
87
|
+
:'locked' => :'Boolean',
|
88
|
+
:'num_comments' => :'Integer',
|
89
|
+
:'created_at' => :'String',
|
90
|
+
:'updated_at' => :'String',
|
91
|
+
:'closed_at' => :'String',
|
92
|
+
:'draft' => :'Boolean',
|
93
|
+
:'pull_request' => :'IssuePRNullable',
|
94
|
+
:'body' => :'String',
|
95
|
+
:'closed_by' => :'UserNullable'
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
# List of attributes with nullable: true
|
100
|
+
def self.openapi_nullable
|
101
|
+
Set.new([
|
102
|
+
:'closed_at',
|
103
|
+
:'pull_request',
|
104
|
+
:'closed_by'
|
105
|
+
])
|
106
|
+
end
|
107
|
+
|
108
|
+
# Initializes the object
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
+
def initialize(attributes = {})
|
111
|
+
if (!attributes.is_a?(Hash))
|
112
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::Issue` initialize method"
|
113
|
+
end
|
114
|
+
|
115
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
116
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
117
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
118
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::Issue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
119
|
+
end
|
120
|
+
h[k.to_sym] = v
|
121
|
+
}
|
122
|
+
|
123
|
+
if attributes.key?(:'title')
|
124
|
+
self.title = attributes[:'title']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'id')
|
128
|
+
self.id = attributes[:'id']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'url')
|
132
|
+
self.url = attributes[:'url']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'html_url')
|
136
|
+
self.html_url = attributes[:'html_url']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'number')
|
140
|
+
self.number = attributes[:'number']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'user')
|
144
|
+
self.user = attributes[:'user']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'labels')
|
148
|
+
if (value = attributes[:'labels']).is_a?(Array)
|
149
|
+
self.labels = value
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'state')
|
154
|
+
self.state = attributes[:'state']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'locked')
|
158
|
+
self.locked = attributes[:'locked']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.key?(:'num_comments')
|
162
|
+
self.num_comments = attributes[:'num_comments']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.key?(:'created_at')
|
166
|
+
self.created_at = attributes[:'created_at']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.key?(:'updated_at')
|
170
|
+
self.updated_at = attributes[:'updated_at']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.key?(:'closed_at')
|
174
|
+
self.closed_at = attributes[:'closed_at']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.key?(:'draft')
|
178
|
+
self.draft = attributes[:'draft']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.key?(:'pull_request')
|
182
|
+
self.pull_request = attributes[:'pull_request']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.key?(:'body')
|
186
|
+
self.body = attributes[:'body']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.key?(:'closed_by')
|
190
|
+
self.closed_by = attributes[:'closed_by']
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
195
|
+
# @return Array for valid properties with the reasons
|
196
|
+
def list_invalid_properties
|
197
|
+
invalid_properties = Array.new
|
198
|
+
if @title.nil?
|
199
|
+
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
200
|
+
end
|
201
|
+
|
202
|
+
if @id.nil?
|
203
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
204
|
+
end
|
205
|
+
|
206
|
+
if @url.nil?
|
207
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
208
|
+
end
|
209
|
+
|
210
|
+
if @html_url.nil?
|
211
|
+
invalid_properties.push('invalid value for "html_url", html_url cannot be nil.')
|
212
|
+
end
|
213
|
+
|
214
|
+
if @number.nil?
|
215
|
+
invalid_properties.push('invalid value for "number", number cannot be nil.')
|
216
|
+
end
|
217
|
+
|
218
|
+
if @user.nil?
|
219
|
+
invalid_properties.push('invalid value for "user", user cannot be nil.')
|
220
|
+
end
|
221
|
+
|
222
|
+
if @labels.nil?
|
223
|
+
invalid_properties.push('invalid value for "labels", labels cannot be nil.')
|
224
|
+
end
|
225
|
+
|
226
|
+
if @state.nil?
|
227
|
+
invalid_properties.push('invalid value for "state", state cannot be nil.')
|
228
|
+
end
|
229
|
+
|
230
|
+
if @locked.nil?
|
231
|
+
invalid_properties.push('invalid value for "locked", locked cannot be nil.')
|
232
|
+
end
|
233
|
+
|
234
|
+
if @num_comments.nil?
|
235
|
+
invalid_properties.push('invalid value for "num_comments", num_comments cannot be nil.')
|
236
|
+
end
|
237
|
+
|
238
|
+
if @created_at.nil?
|
239
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
240
|
+
end
|
241
|
+
|
242
|
+
if @updated_at.nil?
|
243
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
244
|
+
end
|
245
|
+
|
246
|
+
if @draft.nil?
|
247
|
+
invalid_properties.push('invalid value for "draft", draft cannot be nil.')
|
248
|
+
end
|
249
|
+
|
250
|
+
if @body.nil?
|
251
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
252
|
+
end
|
253
|
+
|
254
|
+
invalid_properties
|
255
|
+
end
|
256
|
+
|
257
|
+
# Check to see if the all the properties in the model are valid
|
258
|
+
# @return true if the model is valid
|
259
|
+
def valid?
|
260
|
+
return false if @title.nil?
|
261
|
+
return false if @id.nil?
|
262
|
+
return false if @url.nil?
|
263
|
+
return false if @html_url.nil?
|
264
|
+
return false if @number.nil?
|
265
|
+
return false if @user.nil?
|
266
|
+
return false if @labels.nil?
|
267
|
+
return false if @state.nil?
|
268
|
+
return false if @locked.nil?
|
269
|
+
return false if @num_comments.nil?
|
270
|
+
return false if @created_at.nil?
|
271
|
+
return false if @updated_at.nil?
|
272
|
+
return false if @draft.nil?
|
273
|
+
return false if @body.nil?
|
274
|
+
true
|
275
|
+
end
|
276
|
+
|
277
|
+
# Checks equality by comparing each attribute.
|
278
|
+
# @param [Object] Object to be compared
|
279
|
+
def ==(o)
|
280
|
+
return true if self.equal?(o)
|
281
|
+
self.class == o.class &&
|
282
|
+
title == o.title &&
|
283
|
+
id == o.id &&
|
284
|
+
url == o.url &&
|
285
|
+
html_url == o.html_url &&
|
286
|
+
number == o.number &&
|
287
|
+
user == o.user &&
|
288
|
+
labels == o.labels &&
|
289
|
+
state == o.state &&
|
290
|
+
locked == o.locked &&
|
291
|
+
num_comments == o.num_comments &&
|
292
|
+
created_at == o.created_at &&
|
293
|
+
updated_at == o.updated_at &&
|
294
|
+
closed_at == o.closed_at &&
|
295
|
+
draft == o.draft &&
|
296
|
+
pull_request == o.pull_request &&
|
297
|
+
body == o.body &&
|
298
|
+
closed_by == o.closed_by
|
299
|
+
end
|
300
|
+
|
301
|
+
# @see the `==` method
|
302
|
+
# @param [Object] Object to be compared
|
303
|
+
def eql?(o)
|
304
|
+
self == o
|
305
|
+
end
|
306
|
+
|
307
|
+
# Calculates hash code according to all attributes.
|
308
|
+
# @return [Integer] Hash code
|
309
|
+
def hash
|
310
|
+
[title, id, url, html_url, number, user, labels, state, locked, num_comments, created_at, updated_at, closed_at, draft, pull_request, body, closed_by].hash
|
311
|
+
end
|
312
|
+
|
313
|
+
# Builds the object from hash
|
314
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
315
|
+
# @return [Object] Returns the model itself
|
316
|
+
def self.build_from_hash(attributes)
|
317
|
+
new.build_from_hash(attributes)
|
318
|
+
end
|
319
|
+
|
320
|
+
# Builds the object from hash
|
321
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
322
|
+
# @return [Object] Returns the model itself
|
323
|
+
def build_from_hash(attributes)
|
324
|
+
return nil unless attributes.is_a?(Hash)
|
325
|
+
attributes = attributes.transform_keys(&:to_sym)
|
326
|
+
self.class.openapi_types.each_pair do |key, type|
|
327
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
328
|
+
self.send("#{key}=", nil)
|
329
|
+
elsif type =~ /\AArray<(.*)>/i
|
330
|
+
# check to ensure the input is an array given that the attribute
|
331
|
+
# is documented as an array but the input is not
|
332
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
333
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
334
|
+
end
|
335
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
336
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
self
|
341
|
+
end
|
342
|
+
|
343
|
+
# Deserializes the data based on type
|
344
|
+
# @param string type Data type
|
345
|
+
# @param string value Value to be deserialized
|
346
|
+
# @return [Object] Deserialized data
|
347
|
+
def _deserialize(type, value)
|
348
|
+
case type.to_sym
|
349
|
+
when :Time
|
350
|
+
Time.parse(value)
|
351
|
+
when :Date
|
352
|
+
Date.parse(value)
|
353
|
+
when :String
|
354
|
+
value.to_s
|
355
|
+
when :Integer
|
356
|
+
value.to_i
|
357
|
+
when :Float
|
358
|
+
value.to_f
|
359
|
+
when :Boolean
|
360
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
361
|
+
true
|
362
|
+
else
|
363
|
+
false
|
364
|
+
end
|
365
|
+
when :Object
|
366
|
+
# generic object (usually a Hash), return directly
|
367
|
+
value
|
368
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
369
|
+
inner_type = Regexp.last_match[:inner_type]
|
370
|
+
value.map { |v| _deserialize(inner_type, v) }
|
371
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
372
|
+
k_type = Regexp.last_match[:k_type]
|
373
|
+
v_type = Regexp.last_match[:v_type]
|
374
|
+
{}.tap do |hash|
|
375
|
+
value.each do |k, v|
|
376
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
else # model
|
380
|
+
# models (e.g. Pet) or oneOf
|
381
|
+
klass = Carbon.const_get(type)
|
382
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
# Returns the string representation of the object
|
387
|
+
# @return [String] String presentation of the object
|
388
|
+
def to_s
|
389
|
+
to_hash.to_s
|
390
|
+
end
|
391
|
+
|
392
|
+
# to_body is an alias to to_hash (backward compatibility)
|
393
|
+
# @return [Hash] Returns the object in the form of hash
|
394
|
+
def to_body
|
395
|
+
to_hash
|
396
|
+
end
|
397
|
+
|
398
|
+
# Returns the object in the form of hash
|
399
|
+
# @return [Hash] Returns the object in the form of hash
|
400
|
+
def to_hash
|
401
|
+
hash = {}
|
402
|
+
self.class.attribute_map.each_pair do |attr, param|
|
403
|
+
value = self.send(attr)
|
404
|
+
if value.nil?
|
405
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
406
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
407
|
+
end
|
408
|
+
|
409
|
+
hash[param] = _to_hash(value)
|
410
|
+
end
|
411
|
+
hash
|
412
|
+
end
|
413
|
+
|
414
|
+
# Outputs non-array value in the form of hash
|
415
|
+
# For object, use to_hash. Otherwise, just return the value
|
416
|
+
# @param [Object] value Any valid value
|
417
|
+
# @return [Hash] Returns the value in the form of hash
|
418
|
+
def _to_hash(value)
|
419
|
+
if value.is_a?(Array)
|
420
|
+
value.compact.map { |v| _to_hash(v) }
|
421
|
+
elsif value.is_a?(Hash)
|
422
|
+
{}.tap do |hash|
|
423
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
424
|
+
end
|
425
|
+
elsif value.respond_to? :to_hash
|
426
|
+
value.to_hash
|
427
|
+
else
|
428
|
+
value
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
end
|
433
|
+
|
434
|
+
end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
=begin
|
2
|
+
#Carbon
|
3
|
+
|
4
|
+
#Connect external data to LLMs, no matter the source.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'time'
|
11
|
+
|
12
|
+
module Carbon
|
13
|
+
class IssuePR
|
14
|
+
attr_accessor :url
|
15
|
+
|
16
|
+
attr_accessor :merged_at
|
17
|
+
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
:'url' => :'url',
|
22
|
+
:'merged_at' => :'merged_at'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns all the JSON keys this model knows about
|
27
|
+
def self.acceptable_attributes
|
28
|
+
attribute_map.values
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.openapi_types
|
33
|
+
{
|
34
|
+
:'url' => :'String',
|
35
|
+
:'merged_at' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
:'merged_at'
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::IssuePR` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::IssuePR`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'url')
|
62
|
+
self.url = attributes[:'url']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'merged_at')
|
66
|
+
self.merged_at = attributes[:'merged_at']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @url.nil?
|
75
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
return false if @url.nil?
|
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
|
+
url == o.url &&
|
94
|
+
merged_at == o.merged_at
|
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
|
+
[url, merged_at].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
|
+
attributes = attributes.transform_keys(&:to_sym)
|
122
|
+
self.class.openapi_types.each_pair do |key, type|
|
123
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
124
|
+
self.send("#{key}=", nil)
|
125
|
+
elsif type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :Time
|
146
|
+
Time.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
# models (e.g. Pet) or oneOf
|
177
|
+
klass = Carbon.const_get(type)
|
178
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|