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,234 @@
|
|
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 Label
|
14
|
+
attr_accessor :id
|
15
|
+
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
:'id' => :'id',
|
22
|
+
:'name' => :'name'
|
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
|
+
:'id' => :'Integer',
|
35
|
+
:'name' => :'String'
|
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 `Carbon::Label` 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 `Carbon::Label`. 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?(:'id')
|
61
|
+
self.id = attributes[:'id']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'name')
|
65
|
+
self.name = attributes[:'name']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
if @id.nil?
|
74
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @name.nil?
|
78
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return false if @id.nil?
|
88
|
+
return false if @name.nil?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
id == o.id &&
|
98
|
+
name == o.name
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[id, name].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
attributes = attributes.transform_keys(&:to_sym)
|
126
|
+
self.class.openapi_types.each_pair do |key, type|
|
127
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
128
|
+
self.send("#{key}=", nil)
|
129
|
+
elsif type =~ /\AArray<(.*)>/i
|
130
|
+
# check to ensure the input is an array given that the attribute
|
131
|
+
# is documented as an array but the input is not
|
132
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
133
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
134
|
+
end
|
135
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
136
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
self
|
141
|
+
end
|
142
|
+
|
143
|
+
# Deserializes the data based on type
|
144
|
+
# @param string type Data type
|
145
|
+
# @param string value Value to be deserialized
|
146
|
+
# @return [Object] Deserialized data
|
147
|
+
def _deserialize(type, value)
|
148
|
+
case type.to_sym
|
149
|
+
when :Time
|
150
|
+
Time.parse(value)
|
151
|
+
when :Date
|
152
|
+
Date.parse(value)
|
153
|
+
when :String
|
154
|
+
value.to_s
|
155
|
+
when :Integer
|
156
|
+
value.to_i
|
157
|
+
when :Float
|
158
|
+
value.to_f
|
159
|
+
when :Boolean
|
160
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
161
|
+
true
|
162
|
+
else
|
163
|
+
false
|
164
|
+
end
|
165
|
+
when :Object
|
166
|
+
# generic object (usually a Hash), return directly
|
167
|
+
value
|
168
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
169
|
+
inner_type = Regexp.last_match[:inner_type]
|
170
|
+
value.map { |v| _deserialize(inner_type, v) }
|
171
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
172
|
+
k_type = Regexp.last_match[:k_type]
|
173
|
+
v_type = Regexp.last_match[:v_type]
|
174
|
+
{}.tap do |hash|
|
175
|
+
value.each do |k, v|
|
176
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
else # model
|
180
|
+
# models (e.g. Pet) or oneOf
|
181
|
+
klass = Carbon.const_get(type)
|
182
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the string representation of the object
|
187
|
+
# @return [String] String presentation of the object
|
188
|
+
def to_s
|
189
|
+
to_hash.to_s
|
190
|
+
end
|
191
|
+
|
192
|
+
# to_body is an alias to to_hash (backward compatibility)
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_body
|
195
|
+
to_hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the object in the form of hash
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_hash
|
201
|
+
hash = {}
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
203
|
+
value = self.send(attr)
|
204
|
+
if value.nil?
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
207
|
+
end
|
208
|
+
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Outputs non-array value in the form of hash
|
215
|
+
# For object, use to_hash. Otherwise, just return the value
|
216
|
+
# @param [Object] value Any valid value
|
217
|
+
# @return [Hash] Returns the value in the form of hash
|
218
|
+
def _to_hash(value)
|
219
|
+
if value.is_a?(Array)
|
220
|
+
value.compact.map { |v| _to_hash(v) }
|
221
|
+
elsif value.is_a?(Hash)
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
224
|
+
end
|
225
|
+
elsif value.respond_to? :to_hash
|
226
|
+
value.to_hash
|
227
|
+
else
|
228
|
+
value
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
@@ -0,0 +1,358 @@
|
|
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 PRComment
|
14
|
+
attr_accessor :id
|
15
|
+
|
16
|
+
attr_accessor :pull_request_review_id
|
17
|
+
|
18
|
+
attr_accessor :url
|
19
|
+
|
20
|
+
attr_accessor :diff_hunk
|
21
|
+
|
22
|
+
attr_accessor :path
|
23
|
+
|
24
|
+
attr_accessor :user
|
25
|
+
|
26
|
+
attr_accessor :body
|
27
|
+
|
28
|
+
attr_accessor :created_at
|
29
|
+
|
30
|
+
attr_accessor :updated_at
|
31
|
+
|
32
|
+
attr_accessor :start_line
|
33
|
+
|
34
|
+
attr_accessor :line
|
35
|
+
|
36
|
+
attr_accessor :remote_data
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
+
def self.attribute_map
|
40
|
+
{
|
41
|
+
:'id' => :'id',
|
42
|
+
:'pull_request_review_id' => :'pull_request_review_id',
|
43
|
+
:'url' => :'url',
|
44
|
+
:'diff_hunk' => :'diff_hunk',
|
45
|
+
:'path' => :'path',
|
46
|
+
:'user' => :'user',
|
47
|
+
:'body' => :'body',
|
48
|
+
:'created_at' => :'created_at',
|
49
|
+
:'updated_at' => :'updated_at',
|
50
|
+
:'start_line' => :'start_line',
|
51
|
+
:'line' => :'line',
|
52
|
+
:'remote_data' => :'remote_data'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns all the JSON keys this model knows about
|
57
|
+
def self.acceptable_attributes
|
58
|
+
attribute_map.values
|
59
|
+
end
|
60
|
+
|
61
|
+
# Attribute type mapping.
|
62
|
+
def self.openapi_types
|
63
|
+
{
|
64
|
+
:'id' => :'Integer',
|
65
|
+
:'pull_request_review_id' => :'Integer',
|
66
|
+
:'url' => :'String',
|
67
|
+
:'diff_hunk' => :'String',
|
68
|
+
:'path' => :'String',
|
69
|
+
:'user' => :'User',
|
70
|
+
:'body' => :'String',
|
71
|
+
:'created_at' => :'String',
|
72
|
+
:'updated_at' => :'String',
|
73
|
+
:'start_line' => :'Integer',
|
74
|
+
:'line' => :'Integer',
|
75
|
+
:'remote_data' => :'Object'
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# List of attributes with nullable: true
|
80
|
+
def self.openapi_nullable
|
81
|
+
Set.new([
|
82
|
+
:'pull_request_review_id',
|
83
|
+
:'start_line',
|
84
|
+
:'line',
|
85
|
+
:'remote_data'
|
86
|
+
])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
if (!attributes.is_a?(Hash))
|
93
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Carbon::PRComment` initialize method"
|
94
|
+
end
|
95
|
+
|
96
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
98
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Carbon::PRComment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
100
|
+
end
|
101
|
+
h[k.to_sym] = v
|
102
|
+
}
|
103
|
+
|
104
|
+
if attributes.key?(:'id')
|
105
|
+
self.id = attributes[:'id']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'pull_request_review_id')
|
109
|
+
self.pull_request_review_id = attributes[:'pull_request_review_id']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'url')
|
113
|
+
self.url = attributes[:'url']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'diff_hunk')
|
117
|
+
self.diff_hunk = attributes[:'diff_hunk']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'path')
|
121
|
+
self.path = attributes[:'path']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'user')
|
125
|
+
self.user = attributes[:'user']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'body')
|
129
|
+
self.body = attributes[:'body']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'created_at')
|
133
|
+
self.created_at = attributes[:'created_at']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'updated_at')
|
137
|
+
self.updated_at = attributes[:'updated_at']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'start_line')
|
141
|
+
self.start_line = attributes[:'start_line']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'line')
|
145
|
+
self.line = attributes[:'line']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'remote_data')
|
149
|
+
self.remote_data = attributes[:'remote_data']
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
154
|
+
# @return Array for valid properties with the reasons
|
155
|
+
def list_invalid_properties
|
156
|
+
invalid_properties = Array.new
|
157
|
+
if @id.nil?
|
158
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
159
|
+
end
|
160
|
+
|
161
|
+
if @url.nil?
|
162
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
163
|
+
end
|
164
|
+
|
165
|
+
if @diff_hunk.nil?
|
166
|
+
invalid_properties.push('invalid value for "diff_hunk", diff_hunk cannot be nil.')
|
167
|
+
end
|
168
|
+
|
169
|
+
if @path.nil?
|
170
|
+
invalid_properties.push('invalid value for "path", path cannot be nil.')
|
171
|
+
end
|
172
|
+
|
173
|
+
if @user.nil?
|
174
|
+
invalid_properties.push('invalid value for "user", user cannot be nil.')
|
175
|
+
end
|
176
|
+
|
177
|
+
if @body.nil?
|
178
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
179
|
+
end
|
180
|
+
|
181
|
+
if @created_at.nil?
|
182
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
183
|
+
end
|
184
|
+
|
185
|
+
if @updated_at.nil?
|
186
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
187
|
+
end
|
188
|
+
|
189
|
+
invalid_properties
|
190
|
+
end
|
191
|
+
|
192
|
+
# Check to see if the all the properties in the model are valid
|
193
|
+
# @return true if the model is valid
|
194
|
+
def valid?
|
195
|
+
return false if @id.nil?
|
196
|
+
return false if @url.nil?
|
197
|
+
return false if @diff_hunk.nil?
|
198
|
+
return false if @path.nil?
|
199
|
+
return false if @user.nil?
|
200
|
+
return false if @body.nil?
|
201
|
+
return false if @created_at.nil?
|
202
|
+
return false if @updated_at.nil?
|
203
|
+
true
|
204
|
+
end
|
205
|
+
|
206
|
+
# Checks equality by comparing each attribute.
|
207
|
+
# @param [Object] Object to be compared
|
208
|
+
def ==(o)
|
209
|
+
return true if self.equal?(o)
|
210
|
+
self.class == o.class &&
|
211
|
+
id == o.id &&
|
212
|
+
pull_request_review_id == o.pull_request_review_id &&
|
213
|
+
url == o.url &&
|
214
|
+
diff_hunk == o.diff_hunk &&
|
215
|
+
path == o.path &&
|
216
|
+
user == o.user &&
|
217
|
+
body == o.body &&
|
218
|
+
created_at == o.created_at &&
|
219
|
+
updated_at == o.updated_at &&
|
220
|
+
start_line == o.start_line &&
|
221
|
+
line == o.line &&
|
222
|
+
remote_data == o.remote_data
|
223
|
+
end
|
224
|
+
|
225
|
+
# @see the `==` method
|
226
|
+
# @param [Object] Object to be compared
|
227
|
+
def eql?(o)
|
228
|
+
self == o
|
229
|
+
end
|
230
|
+
|
231
|
+
# Calculates hash code according to all attributes.
|
232
|
+
# @return [Integer] Hash code
|
233
|
+
def hash
|
234
|
+
[id, pull_request_review_id, url, diff_hunk, path, user, body, created_at, updated_at, start_line, line, remote_data].hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Builds the object from hash
|
238
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
239
|
+
# @return [Object] Returns the model itself
|
240
|
+
def self.build_from_hash(attributes)
|
241
|
+
new.build_from_hash(attributes)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Builds the object from hash
|
245
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
246
|
+
# @return [Object] Returns the model itself
|
247
|
+
def build_from_hash(attributes)
|
248
|
+
return nil unless attributes.is_a?(Hash)
|
249
|
+
attributes = attributes.transform_keys(&:to_sym)
|
250
|
+
self.class.openapi_types.each_pair do |key, type|
|
251
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
252
|
+
self.send("#{key}=", nil)
|
253
|
+
elsif type =~ /\AArray<(.*)>/i
|
254
|
+
# check to ensure the input is an array given that the attribute
|
255
|
+
# is documented as an array but the input is not
|
256
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
257
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
258
|
+
end
|
259
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
260
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
self
|
265
|
+
end
|
266
|
+
|
267
|
+
# Deserializes the data based on type
|
268
|
+
# @param string type Data type
|
269
|
+
# @param string value Value to be deserialized
|
270
|
+
# @return [Object] Deserialized data
|
271
|
+
def _deserialize(type, value)
|
272
|
+
case type.to_sym
|
273
|
+
when :Time
|
274
|
+
Time.parse(value)
|
275
|
+
when :Date
|
276
|
+
Date.parse(value)
|
277
|
+
when :String
|
278
|
+
value.to_s
|
279
|
+
when :Integer
|
280
|
+
value.to_i
|
281
|
+
when :Float
|
282
|
+
value.to_f
|
283
|
+
when :Boolean
|
284
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
285
|
+
true
|
286
|
+
else
|
287
|
+
false
|
288
|
+
end
|
289
|
+
when :Object
|
290
|
+
# generic object (usually a Hash), return directly
|
291
|
+
value
|
292
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
293
|
+
inner_type = Regexp.last_match[:inner_type]
|
294
|
+
value.map { |v| _deserialize(inner_type, v) }
|
295
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
296
|
+
k_type = Regexp.last_match[:k_type]
|
297
|
+
v_type = Regexp.last_match[:v_type]
|
298
|
+
{}.tap do |hash|
|
299
|
+
value.each do |k, v|
|
300
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
else # model
|
304
|
+
# models (e.g. Pet) or oneOf
|
305
|
+
klass = Carbon.const_get(type)
|
306
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
# Returns the string representation of the object
|
311
|
+
# @return [String] String presentation of the object
|
312
|
+
def to_s
|
313
|
+
to_hash.to_s
|
314
|
+
end
|
315
|
+
|
316
|
+
# to_body is an alias to to_hash (backward compatibility)
|
317
|
+
# @return [Hash] Returns the object in the form of hash
|
318
|
+
def to_body
|
319
|
+
to_hash
|
320
|
+
end
|
321
|
+
|
322
|
+
# Returns the object in the form of hash
|
323
|
+
# @return [Hash] Returns the object in the form of hash
|
324
|
+
def to_hash
|
325
|
+
hash = {}
|
326
|
+
self.class.attribute_map.each_pair do |attr, param|
|
327
|
+
value = self.send(attr)
|
328
|
+
if value.nil?
|
329
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
330
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
331
|
+
end
|
332
|
+
|
333
|
+
hash[param] = _to_hash(value)
|
334
|
+
end
|
335
|
+
hash
|
336
|
+
end
|
337
|
+
|
338
|
+
# Outputs non-array value in the form of hash
|
339
|
+
# For object, use to_hash. Otherwise, just return the value
|
340
|
+
# @param [Object] value Any valid value
|
341
|
+
# @return [Hash] Returns the value in the form of hash
|
342
|
+
def _to_hash(value)
|
343
|
+
if value.is_a?(Array)
|
344
|
+
value.compact.map { |v| _to_hash(v) }
|
345
|
+
elsif value.is_a?(Hash)
|
346
|
+
{}.tap do |hash|
|
347
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
348
|
+
end
|
349
|
+
elsif value.respond_to? :to_hash
|
350
|
+
value.to_hash
|
351
|
+
else
|
352
|
+
value
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
end
|
357
|
+
|
358
|
+
end
|