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,208 +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 EmailAddress
|
29
|
-
attr_accessor :address
|
30
|
-
|
31
|
-
attr_accessor :id
|
32
|
-
|
33
|
-
|
34
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
-
def self.attribute_map
|
36
|
-
{
|
37
|
-
:'address' => :'address',
|
38
|
-
:'id' => :'id'
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# Attribute type mapping.
|
43
|
-
def self.swagger_types
|
44
|
-
{
|
45
|
-
:'address' => :'String',
|
46
|
-
:'id' => :'String'
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
# Initializes the object
|
51
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
-
def initialize(attributes = {})
|
53
|
-
return unless attributes.is_a?(Hash)
|
54
|
-
|
55
|
-
# convert string to symbol for hash key
|
56
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
-
|
58
|
-
if attributes.has_key?(:'address')
|
59
|
-
self.address = attributes[:'address']
|
60
|
-
end
|
61
|
-
|
62
|
-
if attributes.has_key?(:'id')
|
63
|
-
self.id = attributes[:'id']
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
-
# @return Array for valid properies with the reasons
|
70
|
-
def list_invalid_properties
|
71
|
-
invalid_properties = Array.new
|
72
|
-
return invalid_properties
|
73
|
-
end
|
74
|
-
|
75
|
-
# Check to see if the all the properties in the model are valid
|
76
|
-
# @return true if the model is valid
|
77
|
-
def valid?
|
78
|
-
return true
|
79
|
-
end
|
80
|
-
|
81
|
-
# Checks equality by comparing each attribute.
|
82
|
-
# @param [Object] Object to be compared
|
83
|
-
def ==(o)
|
84
|
-
return true if self.equal?(o)
|
85
|
-
self.class == o.class &&
|
86
|
-
address == o.address &&
|
87
|
-
id == o.id
|
88
|
-
end
|
89
|
-
|
90
|
-
# @see the `==` method
|
91
|
-
# @param [Object] Object to be compared
|
92
|
-
def eql?(o)
|
93
|
-
self == o
|
94
|
-
end
|
95
|
-
|
96
|
-
# Calculates hash code according to all attributes.
|
97
|
-
# @return [Fixnum] Hash code
|
98
|
-
def hash
|
99
|
-
[address, id].hash
|
100
|
-
end
|
101
|
-
|
102
|
-
# Builds the object from hash
|
103
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
-
# @return [Object] Returns the model itself
|
105
|
-
def build_from_hash(attributes)
|
106
|
-
return nil unless attributes.is_a?(Hash)
|
107
|
-
self.class.swagger_types.each_pair do |key, type|
|
108
|
-
if type =~ /^Array<(.*)>/i
|
109
|
-
# check to ensure the input is an array given that the the attribute
|
110
|
-
# is documented as an array but the input is not
|
111
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
112
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
113
|
-
end
|
114
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
115
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
116
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
117
|
-
end
|
118
|
-
|
119
|
-
self
|
120
|
-
end
|
121
|
-
|
122
|
-
# Deserializes the data based on type
|
123
|
-
# @param string type Data type
|
124
|
-
# @param string value Value to be deserialized
|
125
|
-
# @return [Object] Deserialized data
|
126
|
-
def _deserialize(type, value)
|
127
|
-
case type.to_sym
|
128
|
-
when :DateTime
|
129
|
-
DateTime.parse(value)
|
130
|
-
when :Date
|
131
|
-
Date.parse(value)
|
132
|
-
when :String
|
133
|
-
value.to_s
|
134
|
-
when :Integer
|
135
|
-
value.to_i
|
136
|
-
when :Float
|
137
|
-
value.to_f
|
138
|
-
when :BOOLEAN
|
139
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
140
|
-
true
|
141
|
-
else
|
142
|
-
false
|
143
|
-
end
|
144
|
-
when :Object
|
145
|
-
# generic object (usually a Hash), return directly
|
146
|
-
value
|
147
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
148
|
-
inner_type = Regexp.last_match[:inner_type]
|
149
|
-
value.map { |v| _deserialize(inner_type, v) }
|
150
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
151
|
-
k_type = Regexp.last_match[:k_type]
|
152
|
-
v_type = Regexp.last_match[:v_type]
|
153
|
-
{}.tap do |hash|
|
154
|
-
value.each do |k, v|
|
155
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
else # model
|
159
|
-
temp_model = DockGeniusApiRubyClient.const_get(type).new
|
160
|
-
temp_model.build_from_hash(value)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
# Returns the string representation of the object
|
165
|
-
# @return [String] String presentation of the object
|
166
|
-
def to_s
|
167
|
-
to_hash.to_s
|
168
|
-
end
|
169
|
-
|
170
|
-
# to_body is an alias to to_hash (backward compatibility)
|
171
|
-
# @return [Hash] Returns the object in the form of hash
|
172
|
-
def to_body
|
173
|
-
to_hash
|
174
|
-
end
|
175
|
-
|
176
|
-
# Returns the object in the form of hash
|
177
|
-
# @return [Hash] Returns the object in the form of hash
|
178
|
-
def to_hash
|
179
|
-
hash = {}
|
180
|
-
self.class.attribute_map.each_pair do |attr, param|
|
181
|
-
value = self.send(attr)
|
182
|
-
next if value.nil?
|
183
|
-
hash[param] = _to_hash(value)
|
184
|
-
end
|
185
|
-
hash
|
186
|
-
end
|
187
|
-
|
188
|
-
# Outputs non-array value in the form of hash
|
189
|
-
# For object, use to_hash. Otherwise, just return the value
|
190
|
-
# @param [Object] value Any valid value
|
191
|
-
# @return [Hash] Returns the value in the form of hash
|
192
|
-
def _to_hash(value)
|
193
|
-
if value.is_a?(Array)
|
194
|
-
value.compact.map{ |v| _to_hash(v) }
|
195
|
-
elsif value.is_a?(Hash)
|
196
|
-
{}.tap do |hash|
|
197
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
198
|
-
end
|
199
|
-
elsif value.respond_to? :to_hash
|
200
|
-
value.to_hash
|
201
|
-
else
|
202
|
-
value
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
@@ -1,208 +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 GeoPoint
|
29
|
-
attr_accessor :lat
|
30
|
-
|
31
|
-
attr_accessor :lng
|
32
|
-
|
33
|
-
|
34
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
-
def self.attribute_map
|
36
|
-
{
|
37
|
-
:'lat' => :'lat',
|
38
|
-
:'lng' => :'lng'
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# Attribute type mapping.
|
43
|
-
def self.swagger_types
|
44
|
-
{
|
45
|
-
:'lat' => :'Float',
|
46
|
-
:'lng' => :'Float'
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
# Initializes the object
|
51
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
-
def initialize(attributes = {})
|
53
|
-
return unless attributes.is_a?(Hash)
|
54
|
-
|
55
|
-
# convert string to symbol for hash key
|
56
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
-
|
58
|
-
if attributes.has_key?(:'lat')
|
59
|
-
self.lat = attributes[:'lat']
|
60
|
-
end
|
61
|
-
|
62
|
-
if attributes.has_key?(:'lng')
|
63
|
-
self.lng = attributes[:'lng']
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
-
# @return Array for valid properies with the reasons
|
70
|
-
def list_invalid_properties
|
71
|
-
invalid_properties = Array.new
|
72
|
-
return invalid_properties
|
73
|
-
end
|
74
|
-
|
75
|
-
# Check to see if the all the properties in the model are valid
|
76
|
-
# @return true if the model is valid
|
77
|
-
def valid?
|
78
|
-
return true
|
79
|
-
end
|
80
|
-
|
81
|
-
# Checks equality by comparing each attribute.
|
82
|
-
# @param [Object] Object to be compared
|
83
|
-
def ==(o)
|
84
|
-
return true if self.equal?(o)
|
85
|
-
self.class == o.class &&
|
86
|
-
lat == o.lat &&
|
87
|
-
lng == o.lng
|
88
|
-
end
|
89
|
-
|
90
|
-
# @see the `==` method
|
91
|
-
# @param [Object] Object to be compared
|
92
|
-
def eql?(o)
|
93
|
-
self == o
|
94
|
-
end
|
95
|
-
|
96
|
-
# Calculates hash code according to all attributes.
|
97
|
-
# @return [Fixnum] Hash code
|
98
|
-
def hash
|
99
|
-
[lat, lng].hash
|
100
|
-
end
|
101
|
-
|
102
|
-
# Builds the object from hash
|
103
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
-
# @return [Object] Returns the model itself
|
105
|
-
def build_from_hash(attributes)
|
106
|
-
return nil unless attributes.is_a?(Hash)
|
107
|
-
self.class.swagger_types.each_pair do |key, type|
|
108
|
-
if type =~ /^Array<(.*)>/i
|
109
|
-
# check to ensure the input is an array given that the the attribute
|
110
|
-
# is documented as an array but the input is not
|
111
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
112
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
113
|
-
end
|
114
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
115
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
116
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
117
|
-
end
|
118
|
-
|
119
|
-
self
|
120
|
-
end
|
121
|
-
|
122
|
-
# Deserializes the data based on type
|
123
|
-
# @param string type Data type
|
124
|
-
# @param string value Value to be deserialized
|
125
|
-
# @return [Object] Deserialized data
|
126
|
-
def _deserialize(type, value)
|
127
|
-
case type.to_sym
|
128
|
-
when :DateTime
|
129
|
-
DateTime.parse(value)
|
130
|
-
when :Date
|
131
|
-
Date.parse(value)
|
132
|
-
when :String
|
133
|
-
value.to_s
|
134
|
-
when :Integer
|
135
|
-
value.to_i
|
136
|
-
when :Float
|
137
|
-
value.to_f
|
138
|
-
when :BOOLEAN
|
139
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
140
|
-
true
|
141
|
-
else
|
142
|
-
false
|
143
|
-
end
|
144
|
-
when :Object
|
145
|
-
# generic object (usually a Hash), return directly
|
146
|
-
value
|
147
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
148
|
-
inner_type = Regexp.last_match[:inner_type]
|
149
|
-
value.map { |v| _deserialize(inner_type, v) }
|
150
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
151
|
-
k_type = Regexp.last_match[:k_type]
|
152
|
-
v_type = Regexp.last_match[:v_type]
|
153
|
-
{}.tap do |hash|
|
154
|
-
value.each do |k, v|
|
155
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
else # model
|
159
|
-
temp_model = DockGeniusApiRubyClient.const_get(type).new
|
160
|
-
temp_model.build_from_hash(value)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
# Returns the string representation of the object
|
165
|
-
# @return [String] String presentation of the object
|
166
|
-
def to_s
|
167
|
-
to_hash.to_s
|
168
|
-
end
|
169
|
-
|
170
|
-
# to_body is an alias to to_hash (backward compatibility)
|
171
|
-
# @return [Hash] Returns the object in the form of hash
|
172
|
-
def to_body
|
173
|
-
to_hash
|
174
|
-
end
|
175
|
-
|
176
|
-
# Returns the object in the form of hash
|
177
|
-
# @return [Hash] Returns the object in the form of hash
|
178
|
-
def to_hash
|
179
|
-
hash = {}
|
180
|
-
self.class.attribute_map.each_pair do |attr, param|
|
181
|
-
value = self.send(attr)
|
182
|
-
next if value.nil?
|
183
|
-
hash[param] = _to_hash(value)
|
184
|
-
end
|
185
|
-
hash
|
186
|
-
end
|
187
|
-
|
188
|
-
# Outputs non-array value in the form of hash
|
189
|
-
# For object, use to_hash. Otherwise, just return the value
|
190
|
-
# @param [Object] value Any valid value
|
191
|
-
# @return [Hash] Returns the value in the form of hash
|
192
|
-
def _to_hash(value)
|
193
|
-
if value.is_a?(Array)
|
194
|
-
value.compact.map{ |v| _to_hash(v) }
|
195
|
-
elsif value.is_a?(Hash)
|
196
|
-
{}.tap do |hash|
|
197
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
198
|
-
end
|
199
|
-
elsif value.respond_to? :to_hash
|
200
|
-
value.to_hash
|
201
|
-
else
|
202
|
-
value
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
@@ -1,199 +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 InlineResponse200
|
29
|
-
attr_accessor :count
|
30
|
-
|
31
|
-
|
32
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
-
def self.attribute_map
|
34
|
-
{
|
35
|
-
:'count' => :'count'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# Attribute type mapping.
|
40
|
-
def self.swagger_types
|
41
|
-
{
|
42
|
-
:'count' => :'Float'
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
# Initializes the object
|
47
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
-
def initialize(attributes = {})
|
49
|
-
return unless attributes.is_a?(Hash)
|
50
|
-
|
51
|
-
# convert string to symbol for hash key
|
52
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
-
|
54
|
-
if attributes.has_key?(:'count')
|
55
|
-
self.count = attributes[:'count']
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
-
# @return Array for valid properies with the reasons
|
62
|
-
def list_invalid_properties
|
63
|
-
invalid_properties = Array.new
|
64
|
-
return invalid_properties
|
65
|
-
end
|
66
|
-
|
67
|
-
# Check to see if the all the properties in the model are valid
|
68
|
-
# @return true if the model is valid
|
69
|
-
def valid?
|
70
|
-
return true
|
71
|
-
end
|
72
|
-
|
73
|
-
# Checks equality by comparing each attribute.
|
74
|
-
# @param [Object] Object to be compared
|
75
|
-
def ==(o)
|
76
|
-
return true if self.equal?(o)
|
77
|
-
self.class == o.class &&
|
78
|
-
count == o.count
|
79
|
-
end
|
80
|
-
|
81
|
-
# @see the `==` method
|
82
|
-
# @param [Object] Object to be compared
|
83
|
-
def eql?(o)
|
84
|
-
self == o
|
85
|
-
end
|
86
|
-
|
87
|
-
# Calculates hash code according to all attributes.
|
88
|
-
# @return [Fixnum] Hash code
|
89
|
-
def hash
|
90
|
-
[count].hash
|
91
|
-
end
|
92
|
-
|
93
|
-
# Builds the object from hash
|
94
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
-
# @return [Object] Returns the model itself
|
96
|
-
def build_from_hash(attributes)
|
97
|
-
return nil unless attributes.is_a?(Hash)
|
98
|
-
self.class.swagger_types.each_pair do |key, type|
|
99
|
-
if type =~ /^Array<(.*)>/i
|
100
|
-
# check to ensure the input is an array given that the the attribute
|
101
|
-
# is documented as an array but the input is not
|
102
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
104
|
-
end
|
105
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
-
end
|
109
|
-
|
110
|
-
self
|
111
|
-
end
|
112
|
-
|
113
|
-
# Deserializes the data based on type
|
114
|
-
# @param string type Data type
|
115
|
-
# @param string value Value to be deserialized
|
116
|
-
# @return [Object] Deserialized data
|
117
|
-
def _deserialize(type, value)
|
118
|
-
case type.to_sym
|
119
|
-
when :DateTime
|
120
|
-
DateTime.parse(value)
|
121
|
-
when :Date
|
122
|
-
Date.parse(value)
|
123
|
-
when :String
|
124
|
-
value.to_s
|
125
|
-
when :Integer
|
126
|
-
value.to_i
|
127
|
-
when :Float
|
128
|
-
value.to_f
|
129
|
-
when :BOOLEAN
|
130
|
-
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
131
|
-
true
|
132
|
-
else
|
133
|
-
false
|
134
|
-
end
|
135
|
-
when :Object
|
136
|
-
# generic object (usually a Hash), return directly
|
137
|
-
value
|
138
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
-
inner_type = Regexp.last_match[:inner_type]
|
140
|
-
value.map { |v| _deserialize(inner_type, v) }
|
141
|
-
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
142
|
-
k_type = Regexp.last_match[:k_type]
|
143
|
-
v_type = Regexp.last_match[:v_type]
|
144
|
-
{}.tap do |hash|
|
145
|
-
value.each do |k, v|
|
146
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
else # model
|
150
|
-
temp_model = DockGeniusApiRubyClient.const_get(type).new
|
151
|
-
temp_model.build_from_hash(value)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
# Returns the string representation of the object
|
156
|
-
# @return [String] String presentation of the object
|
157
|
-
def to_s
|
158
|
-
to_hash.to_s
|
159
|
-
end
|
160
|
-
|
161
|
-
# to_body is an alias to to_hash (backward compatibility)
|
162
|
-
# @return [Hash] Returns the object in the form of hash
|
163
|
-
def to_body
|
164
|
-
to_hash
|
165
|
-
end
|
166
|
-
|
167
|
-
# Returns the object in the form of hash
|
168
|
-
# @return [Hash] Returns the object in the form of hash
|
169
|
-
def to_hash
|
170
|
-
hash = {}
|
171
|
-
self.class.attribute_map.each_pair do |attr, param|
|
172
|
-
value = self.send(attr)
|
173
|
-
next if value.nil?
|
174
|
-
hash[param] = _to_hash(value)
|
175
|
-
end
|
176
|
-
hash
|
177
|
-
end
|
178
|
-
|
179
|
-
# Outputs non-array value in the form of hash
|
180
|
-
# For object, use to_hash. Otherwise, just return the value
|
181
|
-
# @param [Object] value Any valid value
|
182
|
-
# @return [Hash] Returns the value in the form of hash
|
183
|
-
def _to_hash(value)
|
184
|
-
if value.is_a?(Array)
|
185
|
-
value.compact.map{ |v| _to_hash(v) }
|
186
|
-
elsif value.is_a?(Hash)
|
187
|
-
{}.tap do |hash|
|
188
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
-
end
|
190
|
-
elsif value.respond_to? :to_hash
|
191
|
-
value.to_hash
|
192
|
-
else
|
193
|
-
value
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
end
|
198
|
-
|
199
|
-
end
|