dock_genius_api_ruby_client 0.1.1.pre.g582ac6 → 0.1.2.pre.ge30447
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config.json +10 -0
- data/dg-api-gem +1 -0
- data/swagger.yml +3075 -0
- metadata +170 -78
- data/LICENSE +0 -201
- data/README.md +0 -200
- data/dock_genius_api_ruby_client.gemspec +0 -55
- data/docs/AccessToken.md +0 -11
- data/docs/Address.md +0 -16
- data/docs/Customer.md +0 -22
- data/docs/CustomerApi.md +0 -1938
- data/docs/Dock.md +0 -20
- data/docs/DockApi.md +0 -1112
- data/docs/EmailAddress.md +0 -9
- data/docs/GeoPoint.md +0 -9
- data/docs/InlineResponse200.md +0 -8
- data/docs/InlineResponse2001.md +0 -8
- data/docs/InlineResponse2002.md +0 -8
- data/docs/ListingAgent.md +0 -12
- data/docs/Marina.md +0 -15
- data/docs/MarinaApi.md +0 -1602
- data/docs/Phone.md +0 -9
- data/git_push.sh +0 -67
- data/lib/dock_genius_api_ruby_client.rb +0 -65
- data/lib/dock_genius_api_ruby_client/api/customer_api.rb +0 -2363
- data/lib/dock_genius_api_ruby_client/api/dock_api.rb +0 -1352
- data/lib/dock_genius_api_ruby_client/api/marina_api.rb +0 -1945
- data/lib/dock_genius_api_ruby_client/api_client.rb +0 -378
- data/lib/dock_genius_api_ruby_client/api_error.rb +0 -47
- data/lib/dock_genius_api_ruby_client/configuration.rb +0 -207
- data/lib/dock_genius_api_ruby_client/models/access_token.rb +0 -230
- data/lib/dock_genius_api_ruby_client/models/address.rb +0 -281
- data/lib/dock_genius_api_ruby_client/models/customer.rb +0 -330
- data/lib/dock_genius_api_ruby_client/models/dock.rb +0 -327
- data/lib/dock_genius_api_ruby_client/models/email_address.rb +0 -208
- data/lib/dock_genius_api_ruby_client/models/geo_point.rb +0 -208
- data/lib/dock_genius_api_ruby_client/models/inline_response_200.rb +0 -199
- data/lib/dock_genius_api_ruby_client/models/inline_response_200_1.rb +0 -200
- data/lib/dock_genius_api_ruby_client/models/inline_response_200_2.rb +0 -199
- data/lib/dock_genius_api_ruby_client/models/listing_agent.rb +0 -239
- data/lib/dock_genius_api_ruby_client/models/marina.rb +0 -263
- data/lib/dock_genius_api_ruby_client/models/phone.rb +0 -209
- data/lib/dock_genius_api_ruby_client/version.rb +0 -26
- data/spec/api/customer_api_spec.rb +0 -551
- data/spec/api/dock_api_spec.rb +0 -332
- data/spec/api/marina_api_spec.rb +0 -461
- data/spec/api_client_spec.rb +0 -237
- data/spec/configuration_spec.rb +0 -53
- data/spec/models/access_token_spec.rb +0 -71
- data/spec/models/address_spec.rb +0 -101
- data/spec/models/customer_spec.rb +0 -137
- data/spec/models/dock_spec.rb +0 -125
- data/spec/models/email_address_spec.rb +0 -59
- data/spec/models/geo_point_spec.rb +0 -59
- data/spec/models/inline_response_200_1_spec.rb +0 -53
- data/spec/models/inline_response_200_2_spec.rb +0 -53
- data/spec/models/inline_response_200_spec.rb +0 -53
- data/spec/models/listing_agent_spec.rb +0 -77
- data/spec/models/marina_spec.rb +0 -95
- data/spec/models/phone_spec.rb +0 -59
- data/spec/spec_helper.rb +0 -122
@@ -1,230 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#dockgenius-sl
|
3
|
-
|
4
|
-
#No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
-
|
6
|
-
OpenAPI spec version: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
|
10
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
-
you may not use this file except in compliance with the License.
|
12
|
-
You may obtain a copy of the License at
|
13
|
-
|
14
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
-
|
16
|
-
Unless required by applicable law or agreed to in writing, software
|
17
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
-
See the License for the specific language governing permissions and
|
20
|
-
limitations under the License.
|
21
|
-
|
22
|
-
=end
|
23
|
-
|
24
|
-
require 'date'
|
25
|
-
|
26
|
-
module DockGeniusApiRubyClient
|
27
|
-
|
28
|
-
class AccessToken
|
29
|
-
attr_accessor :id
|
30
|
-
|
31
|
-
# time to live in seconds (2 weeks by default)
|
32
|
-
attr_accessor :ttl
|
33
|
-
|
34
|
-
attr_accessor :created
|
35
|
-
|
36
|
-
attr_accessor :user_id
|
37
|
-
|
38
|
-
|
39
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
40
|
-
def self.attribute_map
|
41
|
-
{
|
42
|
-
:'id' => :'id',
|
43
|
-
:'ttl' => :'ttl',
|
44
|
-
:'created' => :'created',
|
45
|
-
:'user_id' => :'userId'
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
# Attribute type mapping.
|
50
|
-
def self.swagger_types
|
51
|
-
{
|
52
|
-
:'id' => :'String',
|
53
|
-
:'ttl' => :'Float',
|
54
|
-
:'created' => :'Date',
|
55
|
-
:'user_id' => :'Float'
|
56
|
-
}
|
57
|
-
end
|
58
|
-
|
59
|
-
# Initializes the object
|
60
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
-
def initialize(attributes = {})
|
62
|
-
return unless attributes.is_a?(Hash)
|
63
|
-
|
64
|
-
# convert string to symbol for hash key
|
65
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
66
|
-
|
67
|
-
if attributes.has_key?(:'id')
|
68
|
-
self.id = attributes[:'id']
|
69
|
-
end
|
70
|
-
|
71
|
-
if attributes.has_key?(:'ttl')
|
72
|
-
self.ttl = attributes[:'ttl']
|
73
|
-
else
|
74
|
-
self.ttl = 1209600.0
|
75
|
-
end
|
76
|
-
|
77
|
-
if attributes.has_key?(:'created')
|
78
|
-
self.created = attributes[:'created']
|
79
|
-
end
|
80
|
-
|
81
|
-
if attributes.has_key?(:'userId')
|
82
|
-
self.user_id = attributes[:'userId']
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
88
|
-
# @return Array for valid properies with the reasons
|
89
|
-
def list_invalid_properties
|
90
|
-
invalid_properties = Array.new
|
91
|
-
return invalid_properties
|
92
|
-
end
|
93
|
-
|
94
|
-
# Check to see if the all the properties in the model are valid
|
95
|
-
# @return true if the model is valid
|
96
|
-
def valid?
|
97
|
-
return false if @id.nil?
|
98
|
-
return true
|
99
|
-
end
|
100
|
-
|
101
|
-
# Checks equality by comparing each attribute.
|
102
|
-
# @param [Object] Object to be compared
|
103
|
-
def ==(o)
|
104
|
-
return true if self.equal?(o)
|
105
|
-
self.class == o.class &&
|
106
|
-
id == o.id &&
|
107
|
-
ttl == o.ttl &&
|
108
|
-
created == o.created &&
|
109
|
-
user_id == o.user_id
|
110
|
-
end
|
111
|
-
|
112
|
-
# @see the `==` method
|
113
|
-
# @param [Object] Object to be compared
|
114
|
-
def eql?(o)
|
115
|
-
self == o
|
116
|
-
end
|
117
|
-
|
118
|
-
# Calculates hash code according to all attributes.
|
119
|
-
# @return [Fixnum] Hash code
|
120
|
-
def hash
|
121
|
-
[id, ttl, created, user_id].hash
|
122
|
-
end
|
123
|
-
|
124
|
-
# Builds the object from hash
|
125
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
-
# @return [Object] Returns the model itself
|
127
|
-
def build_from_hash(attributes)
|
128
|
-
return nil unless attributes.is_a?(Hash)
|
129
|
-
self.class.swagger_types.each_pair do |key, type|
|
130
|
-
if type =~ /^Array<(.*)>/i
|
131
|
-
# check to ensure the input is an array given that the the attribute
|
132
|
-
# is documented as an array but the input is not
|
133
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
135
|
-
end
|
136
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
-
end
|
140
|
-
|
141
|
-
self
|
142
|
-
end
|
143
|
-
|
144
|
-
# Deserializes the data based on type
|
145
|
-
# @param string type Data type
|
146
|
-
# @param string value Value to be deserialized
|
147
|
-
# @return [Object] Deserialized data
|
148
|
-
def _deserialize(type, value)
|
149
|
-
case type.to_sym
|
150
|
-
when :DateTime
|
151
|
-
DateTime.parse(value)
|
152
|
-
when :Date
|
153
|
-
Date.parse(value)
|
154
|
-
when :String
|
155
|
-
value.to_s
|
156
|
-
when :Integer
|
157
|
-
value.to_i
|
158
|
-
when :Float
|
159
|
-
value.to_f
|
160
|
-
when :BOOLEAN
|
161
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
162
|
-
true
|
163
|
-
else
|
164
|
-
false
|
165
|
-
end
|
166
|
-
when :Object
|
167
|
-
# generic object (usually a Hash), return directly
|
168
|
-
value
|
169
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
-
inner_type = Regexp.last_match[:inner_type]
|
171
|
-
value.map { |v| _deserialize(inner_type, v) }
|
172
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
173
|
-
k_type = Regexp.last_match[:k_type]
|
174
|
-
v_type = Regexp.last_match[:v_type]
|
175
|
-
{}.tap do |hash|
|
176
|
-
value.each do |k, v|
|
177
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
else # model
|
181
|
-
temp_model = DockGeniusApiRubyClient.const_get(type).new
|
182
|
-
temp_model.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
|
-
next if value.nil?
|
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
|
@@ -1,281 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#dockgenius-sl
|
3
|
-
|
4
|
-
#No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
-
|
6
|
-
OpenAPI spec version: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
|
10
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
-
you may not use this file except in compliance with the License.
|
12
|
-
You may obtain a copy of the License at
|
13
|
-
|
14
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
-
|
16
|
-
Unless required by applicable law or agreed to in writing, software
|
17
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
-
See the License for the specific language governing permissions and
|
20
|
-
limitations under the License.
|
21
|
-
|
22
|
-
=end
|
23
|
-
|
24
|
-
require 'date'
|
25
|
-
|
26
|
-
module DockGeniusApiRubyClient
|
27
|
-
# This class describes a physical address. Field names follow the xNAL standard.
|
28
|
-
class Address
|
29
|
-
# Country (always required, 2 character ISO code)
|
30
|
-
attr_accessor :country
|
31
|
-
|
32
|
-
# State / Province / Region (ISO code when available)
|
33
|
-
attr_accessor :administrative_area
|
34
|
-
|
35
|
-
# County / District (optional)
|
36
|
-
attr_accessor :sub_administrative_area
|
37
|
-
|
38
|
-
# City / Town
|
39
|
-
attr_accessor :locality
|
40
|
-
|
41
|
-
# Dependent locality (unused in the US)
|
42
|
-
attr_accessor :dependent_locality
|
43
|
-
|
44
|
-
# Postal code / ZIP Code
|
45
|
-
attr_accessor :postal_code
|
46
|
-
|
47
|
-
# Street address (including number in the US)
|
48
|
-
attr_accessor :thoroughfare
|
49
|
-
|
50
|
-
# Apartment, Suite, Box number, etc.
|
51
|
-
attr_accessor :premise
|
52
|
-
|
53
|
-
attr_accessor :id
|
54
|
-
|
55
|
-
|
56
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
-
def self.attribute_map
|
58
|
-
{
|
59
|
-
:'country' => :'country',
|
60
|
-
:'administrative_area' => :'administrative_area',
|
61
|
-
:'sub_administrative_area' => :'sub_administrative_area',
|
62
|
-
:'locality' => :'locality',
|
63
|
-
:'dependent_locality' => :'dependent_locality',
|
64
|
-
:'postal_code' => :'postal_code',
|
65
|
-
:'thoroughfare' => :'thoroughfare',
|
66
|
-
:'premise' => :'premise',
|
67
|
-
:'id' => :'id'
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
# Attribute type mapping.
|
72
|
-
def self.swagger_types
|
73
|
-
{
|
74
|
-
:'country' => :'String',
|
75
|
-
:'administrative_area' => :'String',
|
76
|
-
:'sub_administrative_area' => :'String',
|
77
|
-
:'locality' => :'String',
|
78
|
-
:'dependent_locality' => :'String',
|
79
|
-
:'postal_code' => :'String',
|
80
|
-
:'thoroughfare' => :'String',
|
81
|
-
:'premise' => :'String',
|
82
|
-
:'id' => :'String'
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
# Initializes the object
|
87
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
-
def initialize(attributes = {})
|
89
|
-
return unless attributes.is_a?(Hash)
|
90
|
-
|
91
|
-
# convert string to symbol for hash key
|
92
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
93
|
-
|
94
|
-
if attributes.has_key?(:'country')
|
95
|
-
self.country = attributes[:'country']
|
96
|
-
else
|
97
|
-
self.country = "US"
|
98
|
-
end
|
99
|
-
|
100
|
-
if attributes.has_key?(:'administrative_area')
|
101
|
-
self.administrative_area = attributes[:'administrative_area']
|
102
|
-
end
|
103
|
-
|
104
|
-
if attributes.has_key?(:'sub_administrative_area')
|
105
|
-
self.sub_administrative_area = attributes[:'sub_administrative_area']
|
106
|
-
end
|
107
|
-
|
108
|
-
if attributes.has_key?(:'locality')
|
109
|
-
self.locality = attributes[:'locality']
|
110
|
-
end
|
111
|
-
|
112
|
-
if attributes.has_key?(:'dependent_locality')
|
113
|
-
self.dependent_locality = attributes[:'dependent_locality']
|
114
|
-
end
|
115
|
-
|
116
|
-
if attributes.has_key?(:'postal_code')
|
117
|
-
self.postal_code = attributes[:'postal_code']
|
118
|
-
end
|
119
|
-
|
120
|
-
if attributes.has_key?(:'thoroughfare')
|
121
|
-
self.thoroughfare = attributes[:'thoroughfare']
|
122
|
-
end
|
123
|
-
|
124
|
-
if attributes.has_key?(:'premise')
|
125
|
-
self.premise = attributes[:'premise']
|
126
|
-
end
|
127
|
-
|
128
|
-
if attributes.has_key?(:'id')
|
129
|
-
self.id = attributes[:'id']
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
-
# @return Array for valid properies with the reasons
|
136
|
-
def list_invalid_properties
|
137
|
-
invalid_properties = Array.new
|
138
|
-
return invalid_properties
|
139
|
-
end
|
140
|
-
|
141
|
-
# Check to see if the all the properties in the model are valid
|
142
|
-
# @return true if the model is valid
|
143
|
-
def valid?
|
144
|
-
return true
|
145
|
-
end
|
146
|
-
|
147
|
-
# Checks equality by comparing each attribute.
|
148
|
-
# @param [Object] Object to be compared
|
149
|
-
def ==(o)
|
150
|
-
return true if self.equal?(o)
|
151
|
-
self.class == o.class &&
|
152
|
-
country == o.country &&
|
153
|
-
administrative_area == o.administrative_area &&
|
154
|
-
sub_administrative_area == o.sub_administrative_area &&
|
155
|
-
locality == o.locality &&
|
156
|
-
dependent_locality == o.dependent_locality &&
|
157
|
-
postal_code == o.postal_code &&
|
158
|
-
thoroughfare == o.thoroughfare &&
|
159
|
-
premise == o.premise &&
|
160
|
-
id == o.id
|
161
|
-
end
|
162
|
-
|
163
|
-
# @see the `==` method
|
164
|
-
# @param [Object] Object to be compared
|
165
|
-
def eql?(o)
|
166
|
-
self == o
|
167
|
-
end
|
168
|
-
|
169
|
-
# Calculates hash code according to all attributes.
|
170
|
-
# @return [Fixnum] Hash code
|
171
|
-
def hash
|
172
|
-
[country, administrative_area, sub_administrative_area, locality, dependent_locality, postal_code, thoroughfare, premise, id].hash
|
173
|
-
end
|
174
|
-
|
175
|
-
# Builds the object from hash
|
176
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
-
# @return [Object] Returns the model itself
|
178
|
-
def build_from_hash(attributes)
|
179
|
-
return nil unless attributes.is_a?(Hash)
|
180
|
-
self.class.swagger_types.each_pair do |key, type|
|
181
|
-
if type =~ /^Array<(.*)>/i
|
182
|
-
# check to ensure the input is an array given that the the attribute
|
183
|
-
# is documented as an array but the input is not
|
184
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
185
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
186
|
-
end
|
187
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
188
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
189
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
190
|
-
end
|
191
|
-
|
192
|
-
self
|
193
|
-
end
|
194
|
-
|
195
|
-
# Deserializes the data based on type
|
196
|
-
# @param string type Data type
|
197
|
-
# @param string value Value to be deserialized
|
198
|
-
# @return [Object] Deserialized data
|
199
|
-
def _deserialize(type, value)
|
200
|
-
case type.to_sym
|
201
|
-
when :DateTime
|
202
|
-
DateTime.parse(value)
|
203
|
-
when :Date
|
204
|
-
Date.parse(value)
|
205
|
-
when :String
|
206
|
-
value.to_s
|
207
|
-
when :Integer
|
208
|
-
value.to_i
|
209
|
-
when :Float
|
210
|
-
value.to_f
|
211
|
-
when :BOOLEAN
|
212
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
213
|
-
true
|
214
|
-
else
|
215
|
-
false
|
216
|
-
end
|
217
|
-
when :Object
|
218
|
-
# generic object (usually a Hash), return directly
|
219
|
-
value
|
220
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
221
|
-
inner_type = Regexp.last_match[:inner_type]
|
222
|
-
value.map { |v| _deserialize(inner_type, v) }
|
223
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
224
|
-
k_type = Regexp.last_match[:k_type]
|
225
|
-
v_type = Regexp.last_match[:v_type]
|
226
|
-
{}.tap do |hash|
|
227
|
-
value.each do |k, v|
|
228
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
else # model
|
232
|
-
temp_model = DockGeniusApiRubyClient.const_get(type).new
|
233
|
-
temp_model.build_from_hash(value)
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
# Returns the string representation of the object
|
238
|
-
# @return [String] String presentation of the object
|
239
|
-
def to_s
|
240
|
-
to_hash.to_s
|
241
|
-
end
|
242
|
-
|
243
|
-
# to_body is an alias to to_hash (backward compatibility)
|
244
|
-
# @return [Hash] Returns the object in the form of hash
|
245
|
-
def to_body
|
246
|
-
to_hash
|
247
|
-
end
|
248
|
-
|
249
|
-
# Returns the object in the form of hash
|
250
|
-
# @return [Hash] Returns the object in the form of hash
|
251
|
-
def to_hash
|
252
|
-
hash = {}
|
253
|
-
self.class.attribute_map.each_pair do |attr, param|
|
254
|
-
value = self.send(attr)
|
255
|
-
next if value.nil?
|
256
|
-
hash[param] = _to_hash(value)
|
257
|
-
end
|
258
|
-
hash
|
259
|
-
end
|
260
|
-
|
261
|
-
# Outputs non-array value in the form of hash
|
262
|
-
# For object, use to_hash. Otherwise, just return the value
|
263
|
-
# @param [Object] value Any valid value
|
264
|
-
# @return [Hash] Returns the value in the form of hash
|
265
|
-
def _to_hash(value)
|
266
|
-
if value.is_a?(Array)
|
267
|
-
value.compact.map{ |v| _to_hash(v) }
|
268
|
-
elsif value.is_a?(Hash)
|
269
|
-
{}.tap do |hash|
|
270
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
271
|
-
end
|
272
|
-
elsif value.respond_to? :to_hash
|
273
|
-
value.to_hash
|
274
|
-
else
|
275
|
-
value
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
end
|
280
|
-
|
281
|
-
end
|