bullet_train_test 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +123 -0
- data/Rakefile +10 -0
- data/bullet_train_test.gemspec +38 -0
- data/docs/ApiV1GoalSerializer.md +18 -0
- data/docs/ApiV1GoalSerializerData.md +24 -0
- data/docs/ApiV1GoalSerializerDataAttributes.md +26 -0
- data/docs/ApiV1GoalSerializerDataRelationships.md +18 -0
- data/docs/ApiV1ProjectSerializer.md +18 -0
- data/docs/ApiV1ProjectSerializerData.md +24 -0
- data/docs/ApiV1ProjectSerializerDataAttributes.md +32 -0
- data/docs/ApiV1ProjectsTagSerializer.md +18 -0
- data/docs/ApiV1ProjectsTagSerializerData.md +24 -0
- data/docs/ApiV1ProjectsTagSerializerDataAttributes.md +26 -0
- data/docs/ApiV1ProjectsTagSerializerDataRelationships.md +18 -0
- data/docs/ApiV1ProjectsTagSerializerDataRelationshipsTeam.md +18 -0
- data/docs/ApiV1ProjectsTagSerializerDataRelationshipsTeamData.md +20 -0
- data/docs/ApiV1TeamSerializer.md +18 -0
- data/docs/ApiV1TeamSerializerData.md +24 -0
- data/docs/ApiV1TeamSerializerDataAttributes.md +28 -0
- data/docs/ApiV1TeamSerializerDataRelationships.md +18 -0
- data/docs/ApiV1TeamSerializerDataRelationshipsScaffoldingAbsolutelyAbstractCreativeConcepts.md +18 -0
- data/docs/GoalsApi.md +205 -0
- data/docs/MeApi.md +66 -0
- data/docs/ProjectsApi.md +472 -0
- data/docs/TeamsApi.md +628 -0
- data/git_push.sh +57 -0
- data/lib/bullet_train_test/api/goals_api.rb +210 -0
- data/lib/bullet_train_test/api/me_api.rb +73 -0
- data/lib/bullet_train_test/api/projects_api.rb +466 -0
- data/lib/bullet_train_test/api/teams_api.rb +611 -0
- data/lib/bullet_train_test/api_client.rb +389 -0
- data/lib/bullet_train_test/api_error.rb +57 -0
- data/lib/bullet_train_test/configuration.rb +271 -0
- data/lib/bullet_train_test/models/api_v1_goal_serializer.rb +219 -0
- data/lib/bullet_train_test/models/api_v1_goal_serializer_data.rb +245 -0
- data/lib/bullet_train_test/models/api_v1_goal_serializer_data_attributes.rb +254 -0
- data/lib/bullet_train_test/models/api_v1_goal_serializer_data_relationships.rb +218 -0
- data/lib/bullet_train_test/models/api_v1_project_serializer.rb +219 -0
- data/lib/bullet_train_test/models/api_v1_project_serializer_data.rb +245 -0
- data/lib/bullet_train_test/models/api_v1_project_serializer_data_attributes.rb +281 -0
- data/lib/bullet_train_test/models/api_v1_projects_tag_serializer.rb +219 -0
- data/lib/bullet_train_test/models/api_v1_projects_tag_serializer_data.rb +245 -0
- data/lib/bullet_train_test/models/api_v1_projects_tag_serializer_data_attributes.rb +254 -0
- data/lib/bullet_train_test/models/api_v1_projects_tag_serializer_data_relationships.rb +218 -0
- data/lib/bullet_train_test/models/api_v1_projects_tag_serializer_data_relationships_team.rb +218 -0
- data/lib/bullet_train_test/models/api_v1_projects_tag_serializer_data_relationships_team_data.rb +227 -0
- data/lib/bullet_train_test/models/api_v1_team_serializer.rb +219 -0
- data/lib/bullet_train_test/models/api_v1_team_serializer_data.rb +245 -0
- data/lib/bullet_train_test/models/api_v1_team_serializer_data_attributes.rb +263 -0
- data/lib/bullet_train_test/models/api_v1_team_serializer_data_relationships.rb +218 -0
- data/lib/bullet_train_test/models/api_v1_team_serializer_data_relationships_scaffolding_absolutely_abstract_creative_concepts.rb +220 -0
- data/lib/bullet_train_test/version.rb +15 -0
- data/lib/bullet_train_test.rb +61 -0
- data/spec/api/goals_api_spec.rb +69 -0
- data/spec/api/me_api_spec.rb +44 -0
- data/spec/api/projects_api_spec.rb +115 -0
- data/spec/api/teams_api_spec.rb +144 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/api_v1_goal_serializer_data_attributes_spec.rb +58 -0
- data/spec/models/api_v1_goal_serializer_data_relationships_spec.rb +34 -0
- data/spec/models/api_v1_goal_serializer_data_spec.rb +52 -0
- data/spec/models/api_v1_goal_serializer_spec.rb +34 -0
- data/spec/models/api_v1_project_serializer_data_attributes_spec.rb +76 -0
- data/spec/models/api_v1_project_serializer_data_spec.rb +52 -0
- data/spec/models/api_v1_project_serializer_spec.rb +34 -0
- data/spec/models/api_v1_projects_tag_serializer_data_attributes_spec.rb +58 -0
- data/spec/models/api_v1_projects_tag_serializer_data_relationships_spec.rb +34 -0
- data/spec/models/api_v1_projects_tag_serializer_data_relationships_team_data_spec.rb +40 -0
- data/spec/models/api_v1_projects_tag_serializer_data_relationships_team_spec.rb +34 -0
- data/spec/models/api_v1_projects_tag_serializer_data_spec.rb +52 -0
- data/spec/models/api_v1_projects_tag_serializer_spec.rb +34 -0
- data/spec/models/api_v1_team_serializer_data_attributes_spec.rb +64 -0
- data/spec/models/api_v1_team_serializer_data_relationships_scaffolding_absolutely_abstract_creative_concepts_spec.rb +34 -0
- data/spec/models/api_v1_team_serializer_data_relationships_spec.rb +34 -0
- data/spec/models/api_v1_team_serializer_data_spec.rb +52 -0
- data/spec/models/api_v1_team_serializer_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- metadata +187 -0
@@ -0,0 +1,219 @@
|
|
1
|
+
=begin
|
2
|
+
#Bullet Train Test
|
3
|
+
|
4
|
+
#You can update this description in `config/locales/en/application.en.yml`.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module BulletTrainTest
|
17
|
+
# Api_V1_ProjectSerializer model
|
18
|
+
class ApiV1ProjectSerializer
|
19
|
+
attr_accessor :data
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'data' => :'data'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.openapi_types
|
35
|
+
{
|
36
|
+
:'data' => :'ApiV1ProjectSerializerData'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
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 `BulletTrainTest::ApiV1ProjectSerializer` 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 `BulletTrainTest::ApiV1ProjectSerializer`. 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?(:'data')
|
62
|
+
self.data = attributes[:'data']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properties with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
data == o.data
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[data].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
elsif type =~ /\AArray<(.*)>/i
|
115
|
+
# check to ensure the input is an array given that the attribute
|
116
|
+
# is documented as an array but the input is not
|
117
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
119
|
+
end
|
120
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
# Deserializes the data based on type
|
129
|
+
# @param string type Data type
|
130
|
+
# @param string value Value to be deserialized
|
131
|
+
# @return [Object] Deserialized data
|
132
|
+
def _deserialize(type, value)
|
133
|
+
case type.to_sym
|
134
|
+
when :Time
|
135
|
+
Time.parse(value)
|
136
|
+
when :Date
|
137
|
+
Date.parse(value)
|
138
|
+
when :String
|
139
|
+
value.to_s
|
140
|
+
when :Integer
|
141
|
+
value.to_i
|
142
|
+
when :Float
|
143
|
+
value.to_f
|
144
|
+
when :Boolean
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
146
|
+
true
|
147
|
+
else
|
148
|
+
false
|
149
|
+
end
|
150
|
+
when :Object
|
151
|
+
# generic object (usually a Hash), return directly
|
152
|
+
value
|
153
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
154
|
+
inner_type = Regexp.last_match[:inner_type]
|
155
|
+
value.map { |v| _deserialize(inner_type, v) }
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
157
|
+
k_type = Regexp.last_match[:k_type]
|
158
|
+
v_type = Regexp.last_match[:v_type]
|
159
|
+
{}.tap do |hash|
|
160
|
+
value.each do |k, v|
|
161
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
else # model
|
165
|
+
# models (e.g. Pet) or oneOf
|
166
|
+
klass = BulletTrainTest.const_get(type)
|
167
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
@@ -0,0 +1,245 @@
|
|
1
|
+
=begin
|
2
|
+
#Bullet Train Test
|
3
|
+
|
4
|
+
#You can update this description in `config/locales/en/application.en.yml`.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module BulletTrainTest
|
17
|
+
class ApiV1ProjectSerializerData
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
attr_accessor :attributes
|
23
|
+
|
24
|
+
attr_accessor :relationships
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'id' => :'id',
|
30
|
+
:'type' => :'type',
|
31
|
+
:'attributes' => :'attributes',
|
32
|
+
:'relationships' => :'relationships'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'id' => :'Integer',
|
45
|
+
:'type' => :'String',
|
46
|
+
:'attributes' => :'ApiV1ProjectSerializerDataAttributes',
|
47
|
+
:'relationships' => :'ApiV1ProjectsTagSerializerDataRelationships'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
if (!attributes.is_a?(Hash))
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BulletTrainTest::ApiV1ProjectSerializerData` initialize method"
|
62
|
+
end
|
63
|
+
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
66
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BulletTrainTest::ApiV1ProjectSerializerData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
68
|
+
end
|
69
|
+
h[k.to_sym] = v
|
70
|
+
}
|
71
|
+
|
72
|
+
if attributes.key?(:'id')
|
73
|
+
self.id = attributes[:'id']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'type')
|
77
|
+
self.type = attributes[:'type']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'attributes')
|
81
|
+
self.attributes = attributes[:'attributes']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'relationships')
|
85
|
+
self.relationships = attributes[:'relationships']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
90
|
+
# @return Array for valid properties with the reasons
|
91
|
+
def list_invalid_properties
|
92
|
+
invalid_properties = Array.new
|
93
|
+
invalid_properties
|
94
|
+
end
|
95
|
+
|
96
|
+
# Check to see if the all the properties in the model are valid
|
97
|
+
# @return true if the model is valid
|
98
|
+
def valid?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
id == o.id &&
|
108
|
+
type == o.type &&
|
109
|
+
attributes == o.attributes &&
|
110
|
+
relationships == o.relationships
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Integer] Hash code
|
121
|
+
def hash
|
122
|
+
[id, type, attributes, relationships].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
new.build_from_hash(attributes)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def build_from_hash(attributes)
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
137
|
+
self.class.openapi_types.each_pair do |key, type|
|
138
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
139
|
+
self.send("#{key}=", nil)
|
140
|
+
elsif type =~ /\AArray<(.*)>/i
|
141
|
+
# check to ensure the input is an array given that the attribute
|
142
|
+
# is documented as an array but the input is not
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
145
|
+
end
|
146
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
147
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
self
|
152
|
+
end
|
153
|
+
|
154
|
+
# Deserializes the data based on type
|
155
|
+
# @param string type Data type
|
156
|
+
# @param string value Value to be deserialized
|
157
|
+
# @return [Object] Deserialized data
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :Time
|
161
|
+
Time.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :Boolean
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when :Object
|
177
|
+
# generic object (usually a Hash), return directly
|
178
|
+
value
|
179
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
180
|
+
inner_type = Regexp.last_match[:inner_type]
|
181
|
+
value.map { |v| _deserialize(inner_type, v) }
|
182
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
183
|
+
k_type = Regexp.last_match[:k_type]
|
184
|
+
v_type = Regexp.last_match[:v_type]
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each do |k, v|
|
187
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
else # model
|
191
|
+
# models (e.g. Pet) or oneOf
|
192
|
+
klass = BulletTrainTest.const_get(type)
|
193
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# to_body is an alias to to_hash (backward compatibility)
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_body
|
206
|
+
to_hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the object in the form of hash
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_hash
|
212
|
+
hash = {}
|
213
|
+
self.class.attribute_map.each_pair do |attr, param|
|
214
|
+
value = self.send(attr)
|
215
|
+
if value.nil?
|
216
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
217
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
218
|
+
end
|
219
|
+
|
220
|
+
hash[param] = _to_hash(value)
|
221
|
+
end
|
222
|
+
hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Outputs non-array value in the form of hash
|
226
|
+
# For object, use to_hash. Otherwise, just return the value
|
227
|
+
# @param [Object] value Any valid value
|
228
|
+
# @return [Hash] Returns the value in the form of hash
|
229
|
+
def _to_hash(value)
|
230
|
+
if value.is_a?(Array)
|
231
|
+
value.compact.map { |v| _to_hash(v) }
|
232
|
+
elsif value.is_a?(Hash)
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
235
|
+
end
|
236
|
+
elsif value.respond_to? :to_hash
|
237
|
+
value.to_hash
|
238
|
+
else
|
239
|
+
value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|