avm_client 1.0.0
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/Gemfile.lock +79 -0
- data/README.md +104 -0
- data/Rakefile +10 -0
- data/avm_client.gemspec +45 -0
- data/docs/AdditionalFeatures.md +53 -0
- data/docs/BuiltForm.md +16 -0
- data/docs/DefaultApi.md +67 -0
- data/docs/EnergyEfficiency.md +16 -0
- data/docs/EnergyRating.md +16 -0
- data/docs/FloorLevel.md +16 -0
- data/docs/LeaseholdOrFreehold.md +16 -0
- data/docs/NewOrResale.md +16 -0
- data/docs/Problem.md +25 -0
- data/docs/PropertyFeatures.md +19 -0
- data/docs/PropertyType.md +16 -0
- data/docs/RequiredFeatures.md +27 -0
- data/docs/RoofInsulation.md +16 -0
- data/docs/RoofType.md +16 -0
- data/docs/Valuation.md +25 -0
- data/docs/ValuationPriceDistribution.md +21 -0
- data/docs/WallInsulation.md +16 -0
- data/docs/WallType.md +16 -0
- data/docs/WindowGlazingType.md +16 -0
- data/lib/avm_client/api/default_api.rb +146 -0
- data/lib/avm_client/avm_client.rb +386 -0
- data/lib/avm_client/avm_error.rb +57 -0
- data/lib/avm_client/configuration.rb +248 -0
- data/lib/avm_client/models/additional_features.rb +373 -0
- data/lib/avm_client/models/built_form.rb +40 -0
- data/lib/avm_client/models/energy_efficiency.rb +39 -0
- data/lib/avm_client/models/energy_rating.rb +42 -0
- data/lib/avm_client/models/floor_level.rb +59 -0
- data/lib/avm_client/models/leasehold_or_freehold.rb +36 -0
- data/lib/avm_client/models/new_or_resale.rb +36 -0
- data/lib/avm_client/models/problem.rb +264 -0
- data/lib/avm_client/models/property_features.rb +210 -0
- data/lib/avm_client/models/property_type.rb +38 -0
- data/lib/avm_client/models/required_features.rb +329 -0
- data/lib/avm_client/models/roof_insulation.rb +39 -0
- data/lib/avm_client/models/roof_type.rb +38 -0
- data/lib/avm_client/models/valuation.rb +239 -0
- data/lib/avm_client/models/valuation_price_distribution.rb +217 -0
- data/lib/avm_client/models/wall_insulation.rb +38 -0
- data/lib/avm_client/models/wall_type.rb +42 -0
- data/lib/avm_client/models/window_glazing_type.rb +40 -0
- data/lib/avm_client/version.rb +15 -0
- data/lib/avm_client.rb +58 -0
- metadata +272 -0
@@ -0,0 +1,248 @@
|
|
1
|
+
=begin
|
2
|
+
#AVM
|
3
|
+
|
4
|
+
#This is api for AVM (automated valuation machine)
|
5
|
+
|
6
|
+
The version of the AvmClient document: 1.0.0
|
7
|
+
Contact: info@enbisys.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module AvmClient
|
14
|
+
class Configuration
|
15
|
+
# Defines url scheme
|
16
|
+
attr_accessor :scheme
|
17
|
+
|
18
|
+
# Defines url host
|
19
|
+
attr_accessor :host
|
20
|
+
|
21
|
+
# Defines url base path
|
22
|
+
attr_accessor :base_path
|
23
|
+
|
24
|
+
# Defines API keys used with API Key authentications.
|
25
|
+
#
|
26
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
27
|
+
#
|
28
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
29
|
+
# config.api_key['api_key'] = 'xxx'
|
30
|
+
attr_accessor :api_key
|
31
|
+
|
32
|
+
# Defines API key prefixes used with API Key authentications.
|
33
|
+
#
|
34
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
35
|
+
#
|
36
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
37
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
38
|
+
attr_accessor :api_key_prefix
|
39
|
+
|
40
|
+
# Defines the username used with HTTP basic authentication.
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :username
|
44
|
+
|
45
|
+
# Defines the password used with HTTP basic authentication.
|
46
|
+
#
|
47
|
+
# @return [String]
|
48
|
+
attr_accessor :password
|
49
|
+
|
50
|
+
# Defines the access token (Bearer) used with OAuth2.
|
51
|
+
attr_accessor :access_token
|
52
|
+
|
53
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
54
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
55
|
+
# Default to false.
|
56
|
+
#
|
57
|
+
# @return [true, false]
|
58
|
+
attr_accessor :debugging
|
59
|
+
|
60
|
+
# Defines the logger used for debugging.
|
61
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
62
|
+
#
|
63
|
+
# @return [#debug]
|
64
|
+
attr_accessor :logger
|
65
|
+
|
66
|
+
# Defines the temporary folder to store downloaded files
|
67
|
+
# (for API endpoints that have file response).
|
68
|
+
# Default to use `Tempfile`.
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
attr_accessor :temp_folder_path
|
72
|
+
|
73
|
+
# The time limit for HTTP request in seconds.
|
74
|
+
# Default to 0 (never times out).
|
75
|
+
attr_accessor :timeout
|
76
|
+
|
77
|
+
# Set this to false to skip client side validation in the operation.
|
78
|
+
# Default to true.
|
79
|
+
# @return [true, false]
|
80
|
+
attr_accessor :client_side_validation
|
81
|
+
|
82
|
+
### TLS/SSL setting
|
83
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
84
|
+
# Default to true.
|
85
|
+
#
|
86
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
87
|
+
#
|
88
|
+
# @return [true, false]
|
89
|
+
attr_accessor :verify_ssl
|
90
|
+
|
91
|
+
### TLS/SSL setting
|
92
|
+
# Set this to false to skip verifying SSL host name
|
93
|
+
# Default to true.
|
94
|
+
#
|
95
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
96
|
+
#
|
97
|
+
# @return [true, false]
|
98
|
+
attr_accessor :verify_ssl_host
|
99
|
+
|
100
|
+
### TLS/SSL setting
|
101
|
+
# Set this to customize the certificate file to verify the peer.
|
102
|
+
#
|
103
|
+
# @return [String] the path to the certificate file
|
104
|
+
#
|
105
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
106
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
107
|
+
attr_accessor :ssl_ca_cert
|
108
|
+
|
109
|
+
### TLS/SSL setting
|
110
|
+
# Client certificate file (for client certificate)
|
111
|
+
attr_accessor :cert_file
|
112
|
+
|
113
|
+
### TLS/SSL setting
|
114
|
+
# Client private key file (for client certificate)
|
115
|
+
attr_accessor :key_file
|
116
|
+
|
117
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
118
|
+
# Default to nil.
|
119
|
+
#
|
120
|
+
# @see The params_encoding option of Ethon. Related source code:
|
121
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
122
|
+
attr_accessor :params_encoding
|
123
|
+
|
124
|
+
attr_accessor :inject_format
|
125
|
+
|
126
|
+
attr_accessor :force_ending_format
|
127
|
+
|
128
|
+
def initialize
|
129
|
+
@scheme = 'https'
|
130
|
+
@host = 'avm.enbisys.com/api'
|
131
|
+
@base_path = ''
|
132
|
+
@api_key = {}
|
133
|
+
@api_key_prefix = {}
|
134
|
+
@timeout = 0
|
135
|
+
@client_side_validation = true
|
136
|
+
@verify_ssl = true
|
137
|
+
@verify_ssl_host = true
|
138
|
+
@params_encoding = nil
|
139
|
+
@cert_file = nil
|
140
|
+
@key_file = nil
|
141
|
+
@debugging = false
|
142
|
+
@inject_format = false
|
143
|
+
@force_ending_format = false
|
144
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
145
|
+
|
146
|
+
yield(self) if block_given?
|
147
|
+
end
|
148
|
+
|
149
|
+
# The default Configuration object.
|
150
|
+
def self.default
|
151
|
+
@@default ||= Configuration.new
|
152
|
+
end
|
153
|
+
|
154
|
+
def configure
|
155
|
+
yield(self) if block_given?
|
156
|
+
end
|
157
|
+
|
158
|
+
def scheme=(scheme)
|
159
|
+
# remove :// from scheme
|
160
|
+
@scheme = scheme.sub(/:\/\//, '')
|
161
|
+
end
|
162
|
+
|
163
|
+
def host=(host)
|
164
|
+
# remove http(s):// and anything after a slash
|
165
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
166
|
+
end
|
167
|
+
|
168
|
+
def base_path=(base_path)
|
169
|
+
# Add leading and trailing slashes to base_path
|
170
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
171
|
+
@base_path = '' if @base_path == '/'
|
172
|
+
end
|
173
|
+
|
174
|
+
def base_url
|
175
|
+
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
176
|
+
end
|
177
|
+
|
178
|
+
# Gets API key (with prefix if set).
|
179
|
+
# @param [String] param_name the parameter name of API key auth
|
180
|
+
def api_key_with_prefix(param_name)
|
181
|
+
if @api_key_prefix[param_name]
|
182
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
183
|
+
else
|
184
|
+
@api_key[param_name]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
# Gets Basic Auth token string
|
189
|
+
def basic_auth_token
|
190
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns Auth Settings hash for api client.
|
194
|
+
def auth_settings
|
195
|
+
{
|
196
|
+
'ApiKeyAuth' =>
|
197
|
+
{
|
198
|
+
type: 'api_key',
|
199
|
+
in: 'header',
|
200
|
+
key: 'X-API-KEY',
|
201
|
+
value: api_key_with_prefix('X-API-KEY')
|
202
|
+
},
|
203
|
+
}
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns an array of Server setting
|
207
|
+
def server_settings
|
208
|
+
[
|
209
|
+
{
|
210
|
+
url: "/",
|
211
|
+
description: "No descriptoin provided",
|
212
|
+
}
|
213
|
+
]
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns URL based on server settings
|
217
|
+
#
|
218
|
+
# @param index array index of the server settings
|
219
|
+
# @param variables hash of variable and the corresponding value
|
220
|
+
def server_url(index, variables = {})
|
221
|
+
servers = server_settings
|
222
|
+
|
223
|
+
# check array index out of bound
|
224
|
+
if (index < 0 || index >= servers.size)
|
225
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
226
|
+
end
|
227
|
+
|
228
|
+
server = servers[index]
|
229
|
+
url = server[:url]
|
230
|
+
|
231
|
+
# go through variable and assign a value
|
232
|
+
server[:variables].each do |name, variable|
|
233
|
+
if variables.key?(name)
|
234
|
+
if (server[:variables][name][:enum_values].include? variables[name])
|
235
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
236
|
+
else
|
237
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
238
|
+
end
|
239
|
+
else
|
240
|
+
# use default value
|
241
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
url
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,373 @@
|
|
1
|
+
=begin
|
2
|
+
#AVM
|
3
|
+
|
4
|
+
#This is api for AVM (automated valuation machine)
|
5
|
+
|
6
|
+
The version of the AvmClient document: 1.0.0
|
7
|
+
Contact: info@enbisys.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AvmClient
|
16
|
+
class AdditionalFeatures
|
17
|
+
attr_accessor :price_of_previous_sale
|
18
|
+
|
19
|
+
attr_accessor :date_of_previous_sale
|
20
|
+
|
21
|
+
attr_accessor :leasehold_or_freehold
|
22
|
+
|
23
|
+
attr_accessor :wall_type
|
24
|
+
|
25
|
+
attr_accessor :wall_insulation
|
26
|
+
|
27
|
+
attr_accessor :wall_energy_efficiency
|
28
|
+
|
29
|
+
attr_accessor :roof_type
|
30
|
+
|
31
|
+
attr_accessor :roof_insulation
|
32
|
+
|
33
|
+
attr_accessor :roof_energy_efficiency
|
34
|
+
|
35
|
+
attr_accessor :window_glazing_type
|
36
|
+
|
37
|
+
attr_accessor :window_energy_efficiency
|
38
|
+
|
39
|
+
attr_accessor :current_energy_rating
|
40
|
+
|
41
|
+
attr_accessor :potential_energy_rating
|
42
|
+
|
43
|
+
attr_accessor :annual_heating_cost_in_pounds
|
44
|
+
|
45
|
+
attr_accessor :annual_hot_water_cost_in_pounds
|
46
|
+
|
47
|
+
attr_accessor :annual_lighting_cost_in_pounds
|
48
|
+
|
49
|
+
attr_accessor :annual_energy_consumption_in_k_wh
|
50
|
+
|
51
|
+
attr_accessor :floor_height_in_foot
|
52
|
+
|
53
|
+
attr_accessor :built_form
|
54
|
+
|
55
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
56
|
+
def self.attribute_map
|
57
|
+
{
|
58
|
+
:'price_of_previous_sale' => :'priceOfPreviousSale',
|
59
|
+
:'date_of_previous_sale' => :'dateOfPreviousSale',
|
60
|
+
:'leasehold_or_freehold' => :'leaseholdOrFreehold',
|
61
|
+
:'wall_type' => :'wallType',
|
62
|
+
:'wall_insulation' => :'wallInsulation',
|
63
|
+
:'wall_energy_efficiency' => :'wallEnergyEfficiency',
|
64
|
+
:'roof_type' => :'roofType',
|
65
|
+
:'roof_insulation' => :'roofInsulation',
|
66
|
+
:'roof_energy_efficiency' => :'roofEnergyEfficiency',
|
67
|
+
:'window_glazing_type' => :'windowGlazingType',
|
68
|
+
:'window_energy_efficiency' => :'windowEnergyEfficiency',
|
69
|
+
:'current_energy_rating' => :'currentEnergyRating',
|
70
|
+
:'potential_energy_rating' => :'potentialEnergyRating',
|
71
|
+
:'annual_heating_cost_in_pounds' => :'annualHeatingCostInPounds',
|
72
|
+
:'annual_hot_water_cost_in_pounds' => :'annualHotWaterCostInPounds',
|
73
|
+
:'annual_lighting_cost_in_pounds' => :'annualLightingCostInPounds',
|
74
|
+
:'annual_energy_consumption_in_k_wh' => :'annualEnergyConsumptionInKWh',
|
75
|
+
:'floor_height_in_foot' => :'floorHeightInFoot',
|
76
|
+
:'built_form' => :'builtForm'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute type mapping.
|
81
|
+
def self.avm_types
|
82
|
+
{
|
83
|
+
:'price_of_previous_sale' => :'Integer',
|
84
|
+
:'date_of_previous_sale' => :'Date',
|
85
|
+
:'leasehold_or_freehold' => :'LeaseholdOrFreehold',
|
86
|
+
:'wall_type' => :'WallType',
|
87
|
+
:'wall_insulation' => :'WallInsulation',
|
88
|
+
:'wall_energy_efficiency' => :'EnergyEfficiency',
|
89
|
+
:'roof_type' => :'RoofType',
|
90
|
+
:'roof_insulation' => :'RoofInsulation',
|
91
|
+
:'roof_energy_efficiency' => :'EnergyEfficiency',
|
92
|
+
:'window_glazing_type' => :'WindowGlazingType',
|
93
|
+
:'window_energy_efficiency' => :'EnergyEfficiency',
|
94
|
+
:'current_energy_rating' => :'EnergyRating',
|
95
|
+
:'potential_energy_rating' => :'EnergyRating',
|
96
|
+
:'annual_heating_cost_in_pounds' => :'Integer',
|
97
|
+
:'annual_hot_water_cost_in_pounds' => :'Integer',
|
98
|
+
:'annual_lighting_cost_in_pounds' => :'Integer',
|
99
|
+
:'annual_energy_consumption_in_k_wh' => :'Integer',
|
100
|
+
:'floor_height_in_foot' => :'Float',
|
101
|
+
:'built_form' => :'BuiltForm'
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
# Initializes the object
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
def initialize(attributes = {})
|
108
|
+
if (!attributes.is_a?(Hash))
|
109
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AvmClient::AdditionalFeatures` initialize method"
|
110
|
+
end
|
111
|
+
|
112
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
113
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
114
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
115
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AvmClient::AdditionalFeatures`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
116
|
+
end
|
117
|
+
h[k.to_sym] = v
|
118
|
+
}
|
119
|
+
|
120
|
+
if attributes.key?(:'price_of_previous_sale')
|
121
|
+
self.price_of_previous_sale = attributes[:'price_of_previous_sale']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'date_of_previous_sale')
|
125
|
+
self.date_of_previous_sale = attributes[:'date_of_previous_sale']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'leasehold_or_freehold')
|
129
|
+
self.leasehold_or_freehold = attributes[:'leasehold_or_freehold']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'wall_type')
|
133
|
+
self.wall_type = attributes[:'wall_type']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'wall_insulation')
|
137
|
+
self.wall_insulation = attributes[:'wall_insulation']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'wall_energy_efficiency')
|
141
|
+
self.wall_energy_efficiency = attributes[:'wall_energy_efficiency']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'roof_type')
|
145
|
+
self.roof_type = attributes[:'roof_type']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'roof_insulation')
|
149
|
+
self.roof_insulation = attributes[:'roof_insulation']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'roof_energy_efficiency')
|
153
|
+
self.roof_energy_efficiency = attributes[:'roof_energy_efficiency']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'window_glazing_type')
|
157
|
+
self.window_glazing_type = attributes[:'window_glazing_type']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'window_energy_efficiency')
|
161
|
+
self.window_energy_efficiency = attributes[:'window_energy_efficiency']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'current_energy_rating')
|
165
|
+
self.current_energy_rating = attributes[:'current_energy_rating']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'potential_energy_rating')
|
169
|
+
self.potential_energy_rating = attributes[:'potential_energy_rating']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'annual_heating_cost_in_pounds')
|
173
|
+
self.annual_heating_cost_in_pounds = attributes[:'annual_heating_cost_in_pounds']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.key?(:'annual_hot_water_cost_in_pounds')
|
177
|
+
self.annual_hot_water_cost_in_pounds = attributes[:'annual_hot_water_cost_in_pounds']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.key?(:'annual_lighting_cost_in_pounds')
|
181
|
+
self.annual_lighting_cost_in_pounds = attributes[:'annual_lighting_cost_in_pounds']
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'annual_energy_consumption_in_k_wh')
|
185
|
+
self.annual_energy_consumption_in_k_wh = attributes[:'annual_energy_consumption_in_k_wh']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.key?(:'floor_height_in_foot')
|
189
|
+
self.floor_height_in_foot = attributes[:'floor_height_in_foot']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.key?(:'built_form')
|
193
|
+
self.built_form = attributes[:'built_form']
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
198
|
+
# @return Array for valid properties with the reasons
|
199
|
+
def list_invalid_properties
|
200
|
+
invalid_properties = Array.new
|
201
|
+
if !@price_of_previous_sale.nil? && @price_of_previous_sale < 1
|
202
|
+
invalid_properties.push('invalid value for "price_of_previous_sale", must be greater than or equal to 1.')
|
203
|
+
end
|
204
|
+
|
205
|
+
invalid_properties
|
206
|
+
end
|
207
|
+
|
208
|
+
# Check to see if the all the properties in the model are valid
|
209
|
+
# @return true if the model is valid
|
210
|
+
def valid?
|
211
|
+
return false if !@price_of_previous_sale.nil? && @price_of_previous_sale < 1
|
212
|
+
true
|
213
|
+
end
|
214
|
+
|
215
|
+
# Custom attribute writer method with validation
|
216
|
+
# @param [Object] price_of_previous_sale Value to be assigned
|
217
|
+
def price_of_previous_sale=(price_of_previous_sale)
|
218
|
+
if !price_of_previous_sale.nil? && price_of_previous_sale < 1
|
219
|
+
fail ArgumentError, 'invalid value for "price_of_previous_sale", must be greater than or equal to 1.'
|
220
|
+
end
|
221
|
+
|
222
|
+
@price_of_previous_sale = price_of_previous_sale
|
223
|
+
end
|
224
|
+
|
225
|
+
# Checks equality by comparing each attribute.
|
226
|
+
# @param [Object] Object to be compared
|
227
|
+
def ==(o)
|
228
|
+
return true if self.equal?(o)
|
229
|
+
self.class == o.class &&
|
230
|
+
price_of_previous_sale == o.price_of_previous_sale &&
|
231
|
+
date_of_previous_sale == o.date_of_previous_sale &&
|
232
|
+
leasehold_or_freehold == o.leasehold_or_freehold &&
|
233
|
+
wall_type == o.wall_type &&
|
234
|
+
wall_insulation == o.wall_insulation &&
|
235
|
+
wall_energy_efficiency == o.wall_energy_efficiency &&
|
236
|
+
roof_type == o.roof_type &&
|
237
|
+
roof_insulation == o.roof_insulation &&
|
238
|
+
roof_energy_efficiency == o.roof_energy_efficiency &&
|
239
|
+
window_glazing_type == o.window_glazing_type &&
|
240
|
+
window_energy_efficiency == o.window_energy_efficiency &&
|
241
|
+
current_energy_rating == o.current_energy_rating &&
|
242
|
+
potential_energy_rating == o.potential_energy_rating &&
|
243
|
+
annual_heating_cost_in_pounds == o.annual_heating_cost_in_pounds &&
|
244
|
+
annual_hot_water_cost_in_pounds == o.annual_hot_water_cost_in_pounds &&
|
245
|
+
annual_lighting_cost_in_pounds == o.annual_lighting_cost_in_pounds &&
|
246
|
+
annual_energy_consumption_in_k_wh == o.annual_energy_consumption_in_k_wh &&
|
247
|
+
floor_height_in_foot == o.floor_height_in_foot &&
|
248
|
+
built_form == o.built_form
|
249
|
+
end
|
250
|
+
|
251
|
+
# @see the `==` method
|
252
|
+
# @param [Object] Object to be compared
|
253
|
+
def eql?(o)
|
254
|
+
self == o
|
255
|
+
end
|
256
|
+
|
257
|
+
# Calculates hash code according to all attributes.
|
258
|
+
# @return [Integer] Hash code
|
259
|
+
def hash
|
260
|
+
[price_of_previous_sale, date_of_previous_sale, leasehold_or_freehold, wall_type, wall_insulation, wall_energy_efficiency, roof_type, roof_insulation, roof_energy_efficiency, window_glazing_type, window_energy_efficiency, current_energy_rating, potential_energy_rating, annual_heating_cost_in_pounds, annual_hot_water_cost_in_pounds, annual_lighting_cost_in_pounds, annual_energy_consumption_in_k_wh, floor_height_in_foot, built_form].hash
|
261
|
+
end
|
262
|
+
|
263
|
+
# Builds the object from hash
|
264
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
265
|
+
# @return [Object] Returns the model itself
|
266
|
+
def self.build_from_hash(attributes)
|
267
|
+
new.build_from_hash(attributes)
|
268
|
+
end
|
269
|
+
|
270
|
+
# Builds the object from hash
|
271
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
272
|
+
# @return [Object] Returns the model itself
|
273
|
+
def build_from_hash(attributes)
|
274
|
+
return nil unless attributes.is_a?(Hash)
|
275
|
+
self.class.avm_types.each_pair do |key, type|
|
276
|
+
if type =~ /\AArray<(.*)>/i
|
277
|
+
# check to ensure the input is an array given that the attribute
|
278
|
+
# is documented as an array but the input is not
|
279
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
280
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
281
|
+
end
|
282
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
283
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
284
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
285
|
+
end
|
286
|
+
|
287
|
+
self
|
288
|
+
end
|
289
|
+
|
290
|
+
# Deserializes the data based on type
|
291
|
+
# @param string type Data type
|
292
|
+
# @param string value Value to be deserialized
|
293
|
+
# @return [Object] Deserialized data
|
294
|
+
def _deserialize(type, value)
|
295
|
+
case type.to_sym
|
296
|
+
when :DateTime
|
297
|
+
DateTime.parse(value)
|
298
|
+
when :Date
|
299
|
+
Date.parse(value)
|
300
|
+
when :String
|
301
|
+
value.to_s
|
302
|
+
when :Integer
|
303
|
+
value.to_i
|
304
|
+
when :Float
|
305
|
+
value.to_f
|
306
|
+
when :Boolean
|
307
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
308
|
+
true
|
309
|
+
else
|
310
|
+
false
|
311
|
+
end
|
312
|
+
when :Object
|
313
|
+
# generic object (usually a Hash), return directly
|
314
|
+
value
|
315
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
316
|
+
inner_type = Regexp.last_match[:inner_type]
|
317
|
+
value.map { |v| _deserialize(inner_type, v) }
|
318
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
319
|
+
k_type = Regexp.last_match[:k_type]
|
320
|
+
v_type = Regexp.last_match[:v_type]
|
321
|
+
{}.tap do |hash|
|
322
|
+
value.each do |k, v|
|
323
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
else # model
|
327
|
+
AvmClient.const_get(type).build_from_hash(value)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
# Returns the string representation of the object
|
332
|
+
# @return [String] String presentation of the object
|
333
|
+
def to_s
|
334
|
+
to_hash.to_s
|
335
|
+
end
|
336
|
+
|
337
|
+
# to_body is an alias to to_hash (backward compatibility)
|
338
|
+
# @return [Hash] Returns the object in the form of hash
|
339
|
+
def to_body
|
340
|
+
to_hash
|
341
|
+
end
|
342
|
+
|
343
|
+
# Returns the object in the form of hash
|
344
|
+
# @return [Hash] Returns the object in the form of hash
|
345
|
+
def to_hash
|
346
|
+
hash = {}
|
347
|
+
self.class.attribute_map.each_pair do |attr, param|
|
348
|
+
value = self.send(attr)
|
349
|
+
next if value.nil?
|
350
|
+
hash[param] = _to_hash(value)
|
351
|
+
end
|
352
|
+
hash
|
353
|
+
end
|
354
|
+
|
355
|
+
# Outputs non-array value in the form of hash
|
356
|
+
# For object, use to_hash. Otherwise, just return the value
|
357
|
+
# @param [Object] value Any valid value
|
358
|
+
# @return [Hash] Returns the value in the form of hash
|
359
|
+
def _to_hash(value)
|
360
|
+
if value.is_a?(Array)
|
361
|
+
value.compact.map { |v| _to_hash(v) }
|
362
|
+
elsif value.is_a?(Hash)
|
363
|
+
{}.tap do |hash|
|
364
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
365
|
+
end
|
366
|
+
elsif value.respond_to? :to_hash
|
367
|
+
value.to_hash
|
368
|
+
else
|
369
|
+
value
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
=begin
|
2
|
+
#AVM
|
3
|
+
|
4
|
+
#This is api for AVM (automated valuation machine)
|
5
|
+
|
6
|
+
The version of the AvmClient document: 1.0.0
|
7
|
+
Contact: info@enbisys.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AvmClient
|
16
|
+
class BuiltForm
|
17
|
+
DETACHED = "detached".freeze
|
18
|
+
SEMI_DETACHED = "semi_detached".freeze
|
19
|
+
ENCLOSED_MID_TERRACE = "enclosed_mid_terrace".freeze
|
20
|
+
ENCLOSED_END_TERRACE = "enclosed_end_terrace".freeze
|
21
|
+
END_TERRACE = "end_terrace".freeze
|
22
|
+
MID_TERRACE = "mid_terrace".freeze
|
23
|
+
|
24
|
+
# Builds the enum from string
|
25
|
+
# @param [String] The enum value in the form of the string
|
26
|
+
# @return [String] The enum value
|
27
|
+
def self.build_from_hash(value)
|
28
|
+
new.build_from_hash(value)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Builds the enum from string
|
32
|
+
# @param [String] The enum value in the form of the string
|
33
|
+
# @return [String] The enum value
|
34
|
+
def build_from_hash(value)
|
35
|
+
constantValues = BuiltForm.constants.select { |c| BuiltForm::const_get(c) == value }
|
36
|
+
raise "Invalid ENUM value #{value} for class #BuiltForm" if constantValues.empty?
|
37
|
+
value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
#AVM
|
3
|
+
|
4
|
+
#This is api for AVM (automated valuation machine)
|
5
|
+
|
6
|
+
The version of the AvmClient document: 1.0.0
|
7
|
+
Contact: info@enbisys.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AvmClient
|
16
|
+
class EnergyEfficiency
|
17
|
+
AVERAGE = "average".freeze
|
18
|
+
GOOD = "good".freeze
|
19
|
+
POOR = "poor".freeze
|
20
|
+
VERY_GOOD = "very_good".freeze
|
21
|
+
VERY_POOR = "very_poor".freeze
|
22
|
+
|
23
|
+
# Builds the enum from string
|
24
|
+
# @param [String] The enum value in the form of the string
|
25
|
+
# @return [String] The enum value
|
26
|
+
def self.build_from_hash(value)
|
27
|
+
new.build_from_hash(value)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Builds the enum from string
|
31
|
+
# @param [String] The enum value in the form of the string
|
32
|
+
# @return [String] The enum value
|
33
|
+
def build_from_hash(value)
|
34
|
+
constantValues = EnergyEfficiency.constants.select { |c| EnergyEfficiency::const_get(c) == value }
|
35
|
+
raise "Invalid ENUM value #{value} for class #EnergyEfficiency" if constantValues.empty?
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|