cybersource_rest_client 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client.rb +18 -44
  3. data/lib/cybersource_rest_client/api/asymmetric_key_management_api.rb +9 -9
  4. data/lib/cybersource_rest_client/api/symmetric_key_management_api.rb +9 -9
  5. data/lib/cybersource_rest_client/api/tokenization_api.rb +89 -0
  6. data/lib/cybersource_rest_client/models/{tokenize_result.rb → flex_v1_tokens_post200_response.rb} +1 -1
  7. data/lib/cybersource_rest_client/models/{card_info.rb → flexv1tokens_card_info.rb} +1 -1
  8. data/lib/cybersource_rest_client/models/{inline_response_200_3.rb → kms_v2_keys_asym_deletes_post200_response.rb} +2 -2
  9. data/lib/cybersource_rest_client/models/{inline_response_200_3_key_information.rb → kms_v2_keys_asym_deletes_post200_response_key_information.rb} +2 -2
  10. data/lib/cybersource_rest_client/models/{inline_response_200_2.rb → kms_v2_keys_asym_get200_response.rb} +2 -2
  11. data/lib/cybersource_rest_client/models/{inline_response_200_2_key_information.rb → kms_v2_keys_asym_get200_response_key_information.rb} +2 -2
  12. data/lib/cybersource_rest_client/models/{inline_response_201_1.rb → kms_v2_keys_asym_post201_response.rb} +3 -3
  13. data/lib/cybersource_rest_client/models/{inline_response_201_1_certificate_information.rb → kms_v2_keys_asym_post201_response_certificate_information.rb} +1 -1
  14. data/lib/cybersource_rest_client/models/{inline_response_201_1_key_information.rb → kms_v2_keys_asym_post201_response_key_information.rb} +2 -2
  15. data/lib/cybersource_rest_client/models/{inline_response_200_1.rb → kms_v2_keys_sym_deletes_post200_response.rb} +2 -2
  16. data/lib/cybersource_rest_client/models/{inline_response_200_1_key_information.rb → kms_v2_keys_sym_deletes_post200_response_key_information.rb} +2 -2
  17. data/lib/cybersource_rest_client/models/{inline_response_200.rb → kms_v2_keys_sym_get200_response.rb} +2 -2
  18. data/lib/cybersource_rest_client/models/{inline_response_200_key_information.rb → kms_v2_keys_sym_get200_response_key_information.rb} +2 -2
  19. data/lib/cybersource_rest_client/models/{inline_response_201.rb → kms_v2_keys_sym_post201_response.rb} +2 -2
  20. data/lib/cybersource_rest_client/models/{inline_response_201_error_information.rb → kms_v2_keys_sym_post201_response_error_information.rb} +1 -1
  21. data/lib/cybersource_rest_client/models/{inline_response_201_key_information.rb → kms_v2_keys_sym_post201_response_key_information.rb} +2 -2
  22. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +6 -6
  23. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response_processor_information.rb +6 -6
  24. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +1 -1
  25. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +1 -1
  26. data/lib/cybersource_rest_client/models/{tokenize_parameters.rb → tokenize_request.rb} +2 -2
  27. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +1 -1
  28. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +1 -1
  29. metadata +20 -46
  30. data/lib/cybersource_rest_client/models/customer.rb +0 -292
  31. data/lib/cybersource_rest_client/models/der_public_key.rb +0 -205
  32. data/lib/cybersource_rest_client/models/error.rb +0 -192
  33. data/lib/cybersource_rest_client/models/error_bean.rb +0 -247
  34. data/lib/cybersource_rest_client/models/error_field_bean.rb +0 -205
  35. data/lib/cybersource_rest_client/models/error_links.rb +0 -205
  36. data/lib/cybersource_rest_client/models/error_response.rb +0 -192
  37. data/lib/cybersource_rest_client/models/file_bean.rb +0 -202
  38. data/lib/cybersource_rest_client/models/file_detail.rb +0 -244
  39. data/lib/cybersource_rest_client/models/file_details_response.rb +0 -194
  40. data/lib/cybersource_rest_client/models/instrument_identifier.rb +0 -286
  41. data/lib/cybersource_rest_client/models/json_web_key.rb +0 -225
  42. data/lib/cybersource_rest_client/models/key_parameters.rb +0 -199
  43. data/lib/cybersource_rest_client/models/key_result.rb +0 -202
  44. data/lib/cybersource_rest_client/models/link.rb +0 -204
  45. data/lib/cybersource_rest_client/models/links.rb +0 -205
  46. data/lib/cybersource_rest_client/models/payment_instrument.rb +0 -318
  47. data/lib/cybersource_rest_client/models/payment_instrument_paginated.rb +0 -232
  48. data/lib/cybersource_rest_client/models/response_status.rb +0 -225
  49. data/lib/cybersource_rest_client/models/response_status_details.rb +0 -194
  50. data/lib/cybersource_rest_client/models/self_link_bean.rb +0 -192
  51. data/lib/cybersource_rest_client/models/shipping_address.rb +0 -235
  52. data/lib/cybersource_rest_client/models/shipping_address_paginated.rb +0 -233
  53. data/lib/cybersource_rest_client/models/tms_error.rb +0 -205
  54. data/lib/cybersource_rest_client/models/tms_error_details.rb +0 -194
  55. data/lib/cybersource_rest_client/models/tms_error_response.rb +0 -185
  56. data/lib/cybersource_rest_client/models/tokenize_parameters_card_info.rb +0 -224
@@ -1,233 +0,0 @@
1
- =begin
2
- #CyberSource Merged Spec
3
-
4
- #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- # A paginated container of Shipping Addresses.
17
- class ShippingAddressPaginated
18
- attr_accessor :_links
19
-
20
- # The offset parameter supplied in the request.
21
- attr_accessor :offset
22
-
23
- # The limit parameter supplied in the request.
24
- attr_accessor :limit
25
-
26
- # The number of Shipping Addresses returned in the array.
27
- attr_accessor :count
28
-
29
- # The total number of Shipping Addresses associated with the Customer.
30
- attr_accessor :total
31
-
32
- attr_accessor :_embedded
33
-
34
- # Attribute mapping from ruby-style variable name to JSON key.
35
- def self.attribute_map
36
- {
37
- :'_links' => :'_links',
38
- :'offset' => :'offset',
39
- :'limit' => :'limit',
40
- :'count' => :'count',
41
- :'total' => :'total',
42
- :'_embedded' => :'_embedded'
43
- }
44
- end
45
-
46
- # Attribute type mapping.
47
- def self.swagger_types
48
- {
49
- :'_links' => :'ShippingAddressListForCustomerLinks',
50
- :'offset' => :'Integer',
51
- :'limit' => :'Integer',
52
- :'count' => :'Integer',
53
- :'total' => :'Integer',
54
- :'_embedded' => :'ShippingAddressListForCustomerEmbedded'
55
- }
56
- end
57
-
58
- # Initializes the object
59
- # @param [Hash] attributes Model attributes in the form of hash
60
- def initialize(attributes = {})
61
- return unless attributes.is_a?(Hash)
62
-
63
- # convert string to symbol for hash key
64
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
65
-
66
- if attributes.has_key?(:'_links')
67
- self._links = attributes[:'_links']
68
- end
69
-
70
- if attributes.has_key?(:'offset')
71
- self.offset = attributes[:'offset']
72
- end
73
-
74
- if attributes.has_key?(:'limit')
75
- self.limit = attributes[:'limit']
76
- end
77
-
78
- if attributes.has_key?(:'count')
79
- self.count = attributes[:'count']
80
- end
81
-
82
- if attributes.has_key?(:'total')
83
- self.total = attributes[:'total']
84
- end
85
-
86
- if attributes.has_key?(:'_embedded')
87
- self._embedded = attributes[:'_embedded']
88
- end
89
- end
90
-
91
- # Show invalid properties with the reasons. Usually used together with valid?
92
- # @return Array for valid properties with the reasons
93
- def list_invalid_properties
94
- invalid_properties = Array.new
95
- invalid_properties
96
- end
97
-
98
- # Check to see if the all the properties in the model are valid
99
- # @return true if the model is valid
100
- def valid?
101
- true
102
- end
103
-
104
- # Checks equality by comparing each attribute.
105
- # @param [Object] Object to be compared
106
- def ==(o)
107
- return true if self.equal?(o)
108
- self.class == o.class &&
109
- _links == o._links &&
110
- offset == o.offset &&
111
- limit == o.limit &&
112
- count == o.count &&
113
- total == o.total &&
114
- _embedded == o._embedded
115
- end
116
-
117
- # @see the `==` method
118
- # @param [Object] Object to be compared
119
- def eql?(o)
120
- self == o
121
- end
122
-
123
- # Calculates hash code according to all attributes.
124
- # @return [Fixnum] Hash code
125
- def hash
126
- [_links, offset, limit, count, total, _embedded].hash
127
- end
128
-
129
- # Builds the object from hash
130
- # @param [Hash] attributes Model attributes in the form of hash
131
- # @return [Object] Returns the model itself
132
- def build_from_hash(attributes)
133
- return nil unless attributes.is_a?(Hash)
134
- self.class.swagger_types.each_pair do |key, type|
135
- if type =~ /\AArray<(.*)>/i
136
- # check to ensure the input is an array given that the the attribute
137
- # is documented as an array but the input is not
138
- if attributes[self.class.attribute_map[key]].is_a?(Array)
139
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
- end
141
- elsif !attributes[self.class.attribute_map[key]].nil?
142
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
- end # or else data not found in attributes(hash), not an issue as the data can be optional
144
- end
145
-
146
- self
147
- end
148
-
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def _deserialize(type, value)
154
- case type.to_sym
155
- when :DateTime
156
- DateTime.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :BOOLEAN
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
- when :Object
172
- # generic object (usually a Hash), return directly
173
- value
174
- when /\AArray<(?<inner_type>.+)>\z/
175
- inner_type = Regexp.last_match[:inner_type]
176
- value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
- k_type = Regexp.last_match[:k_type]
179
- v_type = Regexp.last_match[:v_type]
180
- {}.tap do |hash|
181
- value.each do |k, v|
182
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
- end
184
- end
185
- else # model
186
- temp_model = CyberSource.const_get(type).new
187
- temp_model.build_from_hash(value)
188
- end
189
- end
190
-
191
- # Returns the string representation of the object
192
- # @return [String] String presentation of the object
193
- def to_s
194
- to_hash.to_s
195
- end
196
-
197
- # to_body is an alias to to_hash (backward compatibility)
198
- # @return [Hash] Returns the object in the form of hash
199
- def to_body
200
- to_hash
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- next if value.nil?
210
- hash[param] = _to_hash(value)
211
- end
212
- hash
213
- end
214
-
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map { |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
225
- end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
- end
231
- end
232
- end
233
- end
@@ -1,205 +0,0 @@
1
- =begin
2
- #CyberSource Merged Spec
3
-
4
- #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- class TMSError
17
- # The type of error.
18
- attr_accessor :type
19
-
20
- # The detailed message related to the type stated above.
21
- attr_accessor :message
22
-
23
- attr_accessor :details
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'type' => :'type',
29
- :'message' => :'message',
30
- :'details' => :'details'
31
- }
32
- end
33
-
34
- # Attribute type mapping.
35
- def self.swagger_types
36
- {
37
- :'type' => :'String',
38
- :'message' => :'String',
39
- :'details' => :'Array<InlineResponse400Details>'
40
- }
41
- end
42
-
43
- # Initializes the object
44
- # @param [Hash] attributes Model attributes in the form of hash
45
- def initialize(attributes = {})
46
- return unless attributes.is_a?(Hash)
47
-
48
- # convert string to symbol for hash key
49
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
50
-
51
- if attributes.has_key?(:'type')
52
- self.type = attributes[:'type']
53
- end
54
-
55
- if attributes.has_key?(:'message')
56
- self.message = attributes[:'message']
57
- end
58
-
59
- if attributes.has_key?(:'details')
60
- if (value = attributes[:'details']).is_a?(Array)
61
- self.details = value
62
- end
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
- type == o.type &&
85
- message == o.message &&
86
- details == o.details
87
- end
88
-
89
- # @see the `==` method
90
- # @param [Object] Object to be compared
91
- def eql?(o)
92
- self == o
93
- end
94
-
95
- # Calculates hash code according to all attributes.
96
- # @return [Fixnum] Hash code
97
- def hash
98
- [type, message, details].hash
99
- end
100
-
101
- # Builds the object from hash
102
- # @param [Hash] attributes Model attributes in the form of hash
103
- # @return [Object] Returns the model itself
104
- def build_from_hash(attributes)
105
- return nil unless attributes.is_a?(Hash)
106
- self.class.swagger_types.each_pair do |key, type|
107
- if type =~ /\AArray<(.*)>/i
108
- # check to ensure the input is an array given that the the attribute
109
- # is documented as an array but the input is not
110
- if attributes[self.class.attribute_map[key]].is_a?(Array)
111
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
- end
113
- elsif !attributes[self.class.attribute_map[key]].nil?
114
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
- end # or else data not found in attributes(hash), not an issue as the data can be optional
116
- end
117
-
118
- self
119
- end
120
-
121
- # Deserializes the data based on type
122
- # @param string type Data type
123
- # @param string value Value to be deserialized
124
- # @return [Object] Deserialized data
125
- def _deserialize(type, value)
126
- case type.to_sym
127
- when :DateTime
128
- DateTime.parse(value)
129
- when :Date
130
- Date.parse(value)
131
- when :String
132
- value.to_s
133
- when :Integer
134
- value.to_i
135
- when :Float
136
- value.to_f
137
- when :BOOLEAN
138
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
- true
140
- else
141
- false
142
- end
143
- when :Object
144
- # generic object (usually a Hash), return directly
145
- value
146
- when /\AArray<(?<inner_type>.+)>\z/
147
- inner_type = Regexp.last_match[:inner_type]
148
- value.map { |v| _deserialize(inner_type, v) }
149
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
- k_type = Regexp.last_match[:k_type]
151
- v_type = Regexp.last_match[:v_type]
152
- {}.tap do |hash|
153
- value.each do |k, v|
154
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
- end
156
- end
157
- else # model
158
- temp_model = CyberSource.const_get(type).new
159
- temp_model.build_from_hash(value)
160
- end
161
- end
162
-
163
- # Returns the string representation of the object
164
- # @return [String] String presentation of the object
165
- def to_s
166
- to_hash.to_s
167
- end
168
-
169
- # to_body is an alias to to_hash (backward compatibility)
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_body
172
- to_hash
173
- end
174
-
175
- # Returns the object in the form of hash
176
- # @return [Hash] Returns the object in the form of hash
177
- def to_hash
178
- hash = {}
179
- self.class.attribute_map.each_pair do |attr, param|
180
- value = self.send(attr)
181
- next if value.nil?
182
- hash[param] = _to_hash(value)
183
- end
184
- hash
185
- end
186
-
187
- # Outputs non-array value in the form of hash
188
- # For object, use to_hash. Otherwise, just return the value
189
- # @param [Object] value Any valid value
190
- # @return [Hash] Returns the value in the form of hash
191
- def _to_hash(value)
192
- if value.is_a?(Array)
193
- value.compact.map { |v| _to_hash(v) }
194
- elsif value.is_a?(Hash)
195
- {}.tap do |hash|
196
- value.each { |k, v| hash[k] = _to_hash(v) }
197
- end
198
- elsif value.respond_to? :to_hash
199
- value.to_hash
200
- else
201
- value
202
- end
203
- end
204
- end
205
- end
@@ -1,194 +0,0 @@
1
- =begin
2
- #CyberSource Merged Spec
3
-
4
- #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- class TMSErrorDetails
17
- # The name of the field that caused the error.
18
- attr_accessor :name
19
-
20
- # The location of the field that caused the error.
21
- attr_accessor :location
22
-
23
- # Attribute mapping from ruby-style variable name to JSON key.
24
- def self.attribute_map
25
- {
26
- :'name' => :'name',
27
- :'location' => :'location'
28
- }
29
- end
30
-
31
- # Attribute type mapping.
32
- def self.swagger_types
33
- {
34
- :'name' => :'String',
35
- :'location' => :'String'
36
- }
37
- end
38
-
39
- # Initializes the object
40
- # @param [Hash] attributes Model attributes in the form of hash
41
- def initialize(attributes = {})
42
- return unless attributes.is_a?(Hash)
43
-
44
- # convert string to symbol for hash key
45
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
46
-
47
- if attributes.has_key?(:'name')
48
- self.name = attributes[:'name']
49
- end
50
-
51
- if attributes.has_key?(:'location')
52
- self.location = attributes[:'location']
53
- end
54
- end
55
-
56
- # Show invalid properties with the reasons. Usually used together with valid?
57
- # @return Array for valid properties with the reasons
58
- def list_invalid_properties
59
- invalid_properties = Array.new
60
- invalid_properties
61
- end
62
-
63
- # Check to see if the all the properties in the model are valid
64
- # @return true if the model is valid
65
- def valid?
66
- true
67
- end
68
-
69
- # Checks equality by comparing each attribute.
70
- # @param [Object] Object to be compared
71
- def ==(o)
72
- return true if self.equal?(o)
73
- self.class == o.class &&
74
- name == o.name &&
75
- location == o.location
76
- end
77
-
78
- # @see the `==` method
79
- # @param [Object] Object to be compared
80
- def eql?(o)
81
- self == o
82
- end
83
-
84
- # Calculates hash code according to all attributes.
85
- # @return [Fixnum] Hash code
86
- def hash
87
- [name, location].hash
88
- end
89
-
90
- # Builds the object from hash
91
- # @param [Hash] attributes Model attributes in the form of hash
92
- # @return [Object] Returns the model itself
93
- def build_from_hash(attributes)
94
- return nil unless attributes.is_a?(Hash)
95
- self.class.swagger_types.each_pair do |key, type|
96
- if type =~ /\AArray<(.*)>/i
97
- # check to ensure the input is an array given that the the attribute
98
- # is documented as an array but the input is not
99
- if attributes[self.class.attribute_map[key]].is_a?(Array)
100
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
- end
102
- elsif !attributes[self.class.attribute_map[key]].nil?
103
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
- end # or else data not found in attributes(hash), not an issue as the data can be optional
105
- end
106
-
107
- self
108
- end
109
-
110
- # Deserializes the data based on type
111
- # @param string type Data type
112
- # @param string value Value to be deserialized
113
- # @return [Object] Deserialized data
114
- def _deserialize(type, value)
115
- case type.to_sym
116
- when :DateTime
117
- DateTime.parse(value)
118
- when :Date
119
- Date.parse(value)
120
- when :String
121
- value.to_s
122
- when :Integer
123
- value.to_i
124
- when :Float
125
- value.to_f
126
- when :BOOLEAN
127
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
- true
129
- else
130
- false
131
- end
132
- when :Object
133
- # generic object (usually a Hash), return directly
134
- value
135
- when /\AArray<(?<inner_type>.+)>\z/
136
- inner_type = Regexp.last_match[:inner_type]
137
- value.map { |v| _deserialize(inner_type, v) }
138
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
- k_type = Regexp.last_match[:k_type]
140
- v_type = Regexp.last_match[:v_type]
141
- {}.tap do |hash|
142
- value.each do |k, v|
143
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
- end
145
- end
146
- else # model
147
- temp_model = CyberSource.const_get(type).new
148
- temp_model.build_from_hash(value)
149
- end
150
- end
151
-
152
- # Returns the string representation of the object
153
- # @return [String] String presentation of the object
154
- def to_s
155
- to_hash.to_s
156
- end
157
-
158
- # to_body is an alias to to_hash (backward compatibility)
159
- # @return [Hash] Returns the object in the form of hash
160
- def to_body
161
- to_hash
162
- end
163
-
164
- # Returns the object in the form of hash
165
- # @return [Hash] Returns the object in the form of hash
166
- def to_hash
167
- hash = {}
168
- self.class.attribute_map.each_pair do |attr, param|
169
- value = self.send(attr)
170
- next if value.nil?
171
- hash[param] = _to_hash(value)
172
- end
173
- hash
174
- end
175
-
176
- # Outputs non-array value in the form of hash
177
- # For object, use to_hash. Otherwise, just return the value
178
- # @param [Object] value Any valid value
179
- # @return [Hash] Returns the value in the form of hash
180
- def _to_hash(value)
181
- if value.is_a?(Array)
182
- value.compact.map { |v| _to_hash(v) }
183
- elsif value.is_a?(Hash)
184
- {}.tap do |hash|
185
- value.each { |k, v| hash[k] = _to_hash(v) }
186
- end
187
- elsif value.respond_to? :to_hash
188
- value.to_hash
189
- else
190
- value
191
- end
192
- end
193
- end
194
- end