hydrogen-electron-api 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +86 -0
  4. data/Rakefile +8 -0
  5. data/electron_api.gemspec +46 -0
  6. data/git_push.sh +55 -0
  7. data/lib/electron_api/api/ach_api.rb +75 -0
  8. data/lib/electron_api/api/card_api.rb +639 -0
  9. data/lib/electron_api/api_client.rb +391 -0
  10. data/lib/electron_api/api_error.rb +38 -0
  11. data/lib/electron_api/auth_configuration.rb +181 -0
  12. data/lib/electron_api/configuration.rb +209 -0
  13. data/lib/electron_api/environment.rb +36 -0
  14. data/lib/electron_api/models/ach_card_request_co.rb +180 -0
  15. data/lib/electron_api/models/ach_card_response_vo.rb +216 -0
  16. data/lib/electron_api/models/base_response_vo.rb +198 -0
  17. data/lib/electron_api/models/card_base_request_co.rb +200 -0
  18. data/lib/electron_api/models/card_client_request_co.rb +191 -0
  19. data/lib/electron_api/models/card_load_request_co.rb +189 -0
  20. data/lib/electron_api/models/card_load_unload_response_vo.rb +234 -0
  21. data/lib/electron_api/models/card_replace_response_vo.rb +234 -0
  22. data/lib/electron_api/models/card_reserve_account_response_vo.rb +234 -0
  23. data/lib/electron_api/models/card_spending_control_request_co.rb +180 -0
  24. data/lib/electron_api/models/card_spending_control_response_vo.rb +216 -0
  25. data/lib/electron_api/models/card_unload_request_co.rb +189 -0
  26. data/lib/electron_api/models/create_card_client_response_vo.rb +216 -0
  27. data/lib/electron_api/models/spending_control_vendor_request_data_vo.rb +254 -0
  28. data/lib/electron_api/models/update_card_client_response_vo.rb +216 -0
  29. data/lib/electron_api/version.rb +15 -0
  30. data/lib/electron_api.rb +57 -0
  31. data/spec/api/ach_api_spec.rb +46 -0
  32. data/spec/api/card_api_spec.rb +166 -0
  33. data/spec/api_client_spec.rb +243 -0
  34. data/spec/configuration_spec.rb +42 -0
  35. data/spec/models/ach_card_request_co_spec.rb +41 -0
  36. data/spec/models/ach_card_response_vo_spec.rb +65 -0
  37. data/spec/models/base_response_vo_spec.rb +53 -0
  38. data/spec/models/card_base_request_co_spec.rb +53 -0
  39. data/spec/models/card_client_request_co_spec.rb +47 -0
  40. data/spec/models/card_load_request_co_spec.rb +47 -0
  41. data/spec/models/card_load_unload_response_vo_spec.rb +77 -0
  42. data/spec/models/card_replace_response_vo_spec.rb +77 -0
  43. data/spec/models/card_reserve_account_response_vo_spec.rb +77 -0
  44. data/spec/models/card_spending_control_request_co_spec.rb +41 -0
  45. data/spec/models/card_spending_control_response_vo_spec.rb +65 -0
  46. data/spec/models/card_unload_request_co_spec.rb +47 -0
  47. data/spec/models/create_card_client_response_vo_spec.rb +65 -0
  48. data/spec/models/spending_control_vendor_request_data_vo_spec.rb +89 -0
  49. data/spec/models/update_card_client_response_vo_spec.rb +65 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +312 -0
@@ -0,0 +1,189 @@
1
+ =begin
2
+ #Hydrogen Electron API
3
+
4
+ #The Hydrogen Electron API
5
+
6
+ OpenAPI spec version: 1.3.1
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ElectronApi
16
+ class CardUnloadRequestCO
17
+ attr_accessor :nucleus_funding_id
18
+
19
+ attr_accessor :reason
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'nucleus_funding_id' => :'nucleus_funding_id',
25
+ :'reason' => :'reason'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'nucleus_funding_id' => :'String',
33
+ :'reason' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'nucleus_funding_id')
46
+ self.nucleus_funding_id = attributes[:'nucleus_funding_id']
47
+ end
48
+
49
+ if attributes.has_key?(:'reason')
50
+ self.reason = attributes[:'reason']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ nucleus_funding_id == o.nucleus_funding_id &&
73
+ reason == o.reason
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [nucleus_funding_id, reason].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /\AArray<(.*)>/i
94
+ # check to ensure the input is an array given that the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
98
+ end
99
+ elsif !attributes[self.class.attribute_map[key]].nil?
100
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
101
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
102
+ end
103
+
104
+ self
105
+ end
106
+
107
+ # Deserializes the data based on type
108
+ # @param string type Data type
109
+ # @param string value Value to be deserialized
110
+ # @return [Object] Deserialized data
111
+ def _deserialize(type, value)
112
+ case type.to_sym
113
+ when :DateTime
114
+ value
115
+ when :Date
116
+ value
117
+ when :String
118
+ value.to_s
119
+ when :Integer
120
+ value.to_i
121
+ when :Float
122
+ value.to_f
123
+ when :BOOLEAN
124
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
125
+ true
126
+ else
127
+ false
128
+ end
129
+ when :Object
130
+ # generic object (usually a Hash), return directly
131
+ value
132
+ when /\AArray<(?<inner_type>.+)>\z/
133
+ inner_type = Regexp.last_match[:inner_type]
134
+ value.map { |v| _deserialize(inner_type, v) }
135
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
136
+ k_type = Regexp.last_match[:k_type]
137
+ v_type = Regexp.last_match[:v_type]
138
+ {}.tap do |hash|
139
+ value.each do |k, v|
140
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
141
+ end
142
+ end
143
+ else # model
144
+ temp_model = ElectronApi.const_get(type).new
145
+ temp_model.build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ hash[param] = _to_hash(value)
168
+ end
169
+ hash
170
+ end# Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ end
189
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #Hydrogen Electron API
3
+
4
+ #The Hydrogen Electron API
5
+
6
+ OpenAPI spec version: 1.3.1
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ElectronApi
16
+ class CreateCardClientResponseVO
17
+ attr_accessor :message
18
+
19
+ attr_accessor :nucleus_client_id
20
+
21
+ attr_accessor :status
22
+
23
+ attr_accessor :vendor_name
24
+
25
+ attr_accessor :vendor_response
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'message' => :'message',
31
+ :'nucleus_client_id' => :'nucleus_client_id',
32
+ :'status' => :'status',
33
+ :'vendor_name' => :'vendor_name',
34
+ :'vendor_response' => :'vendor_response'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'message' => :'String',
42
+ :'nucleus_client_id' => :'String',
43
+ :'status' => :'String',
44
+ :'vendor_name' => :'String',
45
+ :'vendor_response' => :'Object'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'message')
58
+ self.message = attributes[:'message']
59
+ end
60
+
61
+ if attributes.has_key?(:'nucleus_client_id')
62
+ self.nucleus_client_id = attributes[:'nucleus_client_id']
63
+ end
64
+
65
+ if attributes.has_key?(:'status')
66
+ self.status = attributes[:'status']
67
+ end
68
+
69
+ if attributes.has_key?(:'vendor_name')
70
+ self.vendor_name = attributes[:'vendor_name']
71
+ end
72
+
73
+ if attributes.has_key?(:'vendor_response')
74
+ self.vendor_response = attributes[:'vendor_response']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ message == o.message &&
97
+ nucleus_client_id == o.nucleus_client_id &&
98
+ status == o.status &&
99
+ vendor_name == o.vendor_name &&
100
+ vendor_response == o.vendor_response
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Fixnum] Hash code
111
+ def hash
112
+ [message, nucleus_client_id, status, vendor_name, vendor_response].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ self.class.swagger_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ value
142
+ when :Date
143
+ value
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :BOOLEAN
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ temp_model = ElectronApi.const_get(type).new
172
+ temp_model.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end# Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+ end
@@ -0,0 +1,254 @@
1
+ =begin
2
+ #Hydrogen Electron API
3
+
4
+ #The Hydrogen Electron API
5
+
6
+ OpenAPI spec version: 1.3.1
7
+ Contact: info@hydrogenplatform.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ElectronApi
16
+ class SpendingControlVendorRequestDataVO
17
+ attr_accessor :client_id
18
+
19
+ attr_accessor :control_scope
20
+
21
+ attr_accessor :control_type
22
+
23
+ attr_accessor :control_values
24
+
25
+ attr_accessor :currency_code
26
+
27
+ attr_accessor :description
28
+
29
+ attr_accessor :frequency_unit
30
+
31
+ attr_accessor :is_active
32
+
33
+ attr_accessor :limit_value
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'client_id' => :'client_id',
39
+ :'control_scope' => :'control_scope',
40
+ :'control_type' => :'control_type',
41
+ :'control_values' => :'control_values',
42
+ :'currency_code' => :'currency_code',
43
+ :'description' => :'description',
44
+ :'frequency_unit' => :'frequency_unit',
45
+ :'is_active' => :'is_active',
46
+ :'limit_value' => :'limit_value'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'client_id' => :'String',
54
+ :'control_scope' => :'String',
55
+ :'control_type' => :'String',
56
+ :'control_values' => :'Array<String>',
57
+ :'currency_code' => :'String',
58
+ :'description' => :'String',
59
+ :'frequency_unit' => :'String',
60
+ :'is_active' => :'BOOLEAN',
61
+ :'limit_value' => :'Float'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ if attributes.has_key?(:'client_id')
74
+ self.client_id = attributes[:'client_id']
75
+ end
76
+
77
+ if attributes.has_key?(:'control_scope')
78
+ self.control_scope = attributes[:'control_scope']
79
+ end
80
+
81
+ if attributes.has_key?(:'control_type')
82
+ self.control_type = attributes[:'control_type']
83
+ end
84
+
85
+ if attributes.has_key?(:'control_values')
86
+ if (value = attributes[:'control_values']).is_a?(Array)
87
+ self.control_values = value
88
+ end
89
+ end
90
+
91
+ if attributes.has_key?(:'currency_code')
92
+ self.currency_code = attributes[:'currency_code']
93
+ end
94
+
95
+ if attributes.has_key?(:'description')
96
+ self.description = attributes[:'description']
97
+ end
98
+
99
+ if attributes.has_key?(:'frequency_unit')
100
+ self.frequency_unit = attributes[:'frequency_unit']
101
+ end
102
+
103
+ if attributes.has_key?(:'is_active')
104
+ self.is_active = attributes[:'is_active']
105
+ end
106
+
107
+ if attributes.has_key?(:'limit_value')
108
+ self.limit_value = attributes[:'limit_value']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ client_id == o.client_id &&
131
+ control_scope == o.control_scope &&
132
+ control_type == o.control_type &&
133
+ control_values == o.control_values &&
134
+ currency_code == o.currency_code &&
135
+ description == o.description &&
136
+ frequency_unit == o.frequency_unit &&
137
+ is_active == o.is_active &&
138
+ limit_value == o.limit_value
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Fixnum] Hash code
149
+ def hash
150
+ [client_id, control_scope, control_type, control_values, currency_code, description, frequency_unit, is_active, limit_value].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ self.class.swagger_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ value
180
+ when :Date
181
+ value
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :BOOLEAN
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ temp_model = ElectronApi.const_get(type).new
210
+ temp_model.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end# Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+
253
+ end
254
+ end