simplyrets 1.0.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -21
  3. data/Makefile +48 -0
  4. data/README.org +5 -58
  5. data/example.rb +14 -4
  6. data/lib/simplyrets.rb +42 -21
  7. data/lib/simplyrets/api/default_api.rb +292 -59
  8. data/lib/simplyrets/api_client.rb +370 -0
  9. data/lib/simplyrets/api_error.rb +36 -0
  10. data/lib/simplyrets/configuration.rb +170 -0
  11. data/lib/simplyrets/models/agent.rb +146 -11
  12. data/lib/simplyrets/models/broker.rb +133 -7
  13. data/lib/simplyrets/models/contact_information.rb +149 -17
  14. data/lib/simplyrets/models/error.rb +138 -9
  15. data/lib/simplyrets/models/geographic_data.rb +150 -12
  16. data/lib/simplyrets/models/listing.rb +248 -49
  17. data/lib/simplyrets/models/mls_information.rb +148 -12
  18. data/lib/simplyrets/models/office.rb +146 -11
  19. data/lib/simplyrets/models/open_house.rb +215 -12
  20. data/lib/simplyrets/models/parking.rb +148 -17
  21. data/lib/simplyrets/models/property.rb +353 -129
  22. data/lib/simplyrets/models/sales.rb +163 -25
  23. data/lib/simplyrets/models/school.rb +167 -24
  24. data/lib/simplyrets/models/street_address.rb +204 -26
  25. data/lib/simplyrets/models/tax.rb +150 -18
  26. data/lib/simplyrets/version.rb +15 -0
  27. data/multi-query-param.patch +44 -0
  28. data/simplyrets.gemspec +4 -4
  29. data/spec/api/default_api_spec.rb +172 -0
  30. data/spec/models/agent_spec.rb +75 -0
  31. data/spec/models/broker_spec.rb +45 -0
  32. data/spec/models/contact_information_spec.rb +65 -0
  33. data/spec/models/error_spec.rb +55 -0
  34. data/spec/models/geographic_data_spec.rb +85 -0
  35. data/spec/models/listing_spec.rb +245 -0
  36. data/spec/models/mls_information_spec.rb +75 -0
  37. data/spec/models/office_spec.rb +75 -0
  38. data/spec/models/open_house_spec.rb +115 -0
  39. data/spec/models/parking_spec.rb +65 -0
  40. data/spec/models/property_spec.rb +365 -0
  41. data/spec/models/sales_spec.rb +85 -0
  42. data/spec/models/school_spec.rb +75 -0
  43. data/spec/models/street_address_spec.rb +105 -0
  44. data/spec/models/tax_spec.rb +65 -0
  45. data/spec/spec_helper.rb +78 -0
  46. metadata +33 -18
  47. data/lib/simplyrets.rb~ +0 -34
  48. data/lib/simplyrets/api/#default_api.rb# +0 -146
  49. data/lib/simplyrets/simplyrets/api_error.rb +0 -26
  50. data/lib/simplyrets/simplyrets/configuration.rb +0 -101
  51. data/lib/simplyrets/simplyrets/request.rb +0 -248
  52. data/lib/simplyrets/simplyrets/response.rb +0 -156
  53. data/lib/simplyrets/simplyrets/version.rb +0 -5
  54. data/simplyrets-1.0.6.gem +0 -0
@@ -1,40 +1,62 @@
1
+ =begin
2
+ SimplyRETS API
3
+
4
+ The SimplyRETS API is an exciting step towards making it easier for\ndevelopers and real estate agents to build something awesome with\nreal estate data!\n\nThe documentation below makes live requests to our API using the\ntrial data. To get set up with the API using live MLS data, you\nmust have RETS credentials from your MLS, which you can then use to\ncreate an app with SimplyRETS. For more information on that\nprocess, please see our [FAQ](https://simplyrets.com/faq), [Getting\nStarted](https://simplyrets.com/blog/getting-set-up.html) page, or\n[contact us](https://simplyrets.com/\\#home-contact).\n\nBelow you'll find the API endpoints, query parameters, response bodies,\nand other information about using the SimplyRETS API. You can run\nqueries by clicking the 'Try it Out' button at the bottom of each\nsection.\n\n### Authentication\nThe SimplyRETS API uses Basic Authentication. When you create an\napp, you'll get a set of API credentials to access your\nlistings. If you're trying out the test data, you can use\n`simplyrets:simplyrets` for connecting to the API.\n\n### Media Types\nThe SimplyRETS API uses the `Accept` header to allow clients to\ncontrol media types (content versions). We maintain backwards\ncompatibility with API clients by allowing them to specify a\ncontent version. We highly recommend setting and explicity media\ntype when your application reaches production. Both the structure\nand content of our API response bodies is subject to change so we\ncan add new features while respecting the stability of applications\nwhich have already been developed.\n\nTo always use the latest SimplyRETS content version, simply use\n`application/json` in your application `Accept` header.\n\nIf you want to pin your clients media type to a specific version,\nyou can use the vendor-specific SimplyRETS media type, e.g.\n`application/vnd.simplyrets-v0.1+json\"`\n\nTo view all valid content-types for making an `OPTIONS`, make a\nrequest to the SimplyRETS api root\n\n`curl -XOPTIONS -u simplyrets:simplyrets https://api.simplyrets.com/`\n\nThe default media types used in our API responses may change in the\nfuture. If you're building an application and care about the\nstability of the API, be sure to request a specific media type in the\nAccept header as shown in the examples below.\n\nThe wordpress plugin automatically sets the `Accept` header for the\ncompatible SimplyRETS media types.\n\n### Pagination\nThere a few pieces of useful information about each request stored\nin the HTTP Headers:\n\n- `X-Total-Count` shows you the total amount of listings that match\n your current query.\n- `Link` contains pre-built pagination links for accessing the next\n'page' of listings that match your query. Read more about that\n[here](https://simplyrets.com/blog/api-pagination.html).\n
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
1
15
  module SimplyRetsClient
2
- #
3
- class Parking < BaseObject
4
- attr_accessor :spaces, :description, :leased
5
- # attribute mapping from ruby-style variable name to JSON key
16
+ # RETS MLS School Data
17
+ class Parking
18
+ attr_accessor :leased
19
+
20
+ # Number of parking spaces
21
+ attr_accessor :spaces
22
+
23
+ # Parking features description
24
+ attr_accessor :description
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
6
27
  def self.attribute_map
7
28
  {
8
29
 
9
- # Number of parking spaces
10
- :'spaces' => :'spaces',
30
+ :'leased' => :'leased',
11
31
 
12
- # Parking features description
13
- :'description' => :'description',
32
+ :'spaces' => :'spaces',
14
33
 
15
- #
16
- :'leased' => :'leased'
34
+ :'description' => :'description'
17
35
 
18
36
  }
19
37
  end
20
38
 
21
- # attribute type
22
- def self.simplyrets_types
39
+ # Attribute type mapping.
40
+ def self.swagger_types
23
41
  {
42
+ :'leased' => :'String',
24
43
  :'spaces' => :'Integer',
25
- :'description' => :'String',
26
- :'leased' => :'String'
44
+ :'description' => :'String'
27
45
 
28
46
  }
29
47
  end
30
48
 
31
49
  def initialize(attributes = {})
32
- return if !attributes.is_a?(Hash) || attributes.empty?
50
+ return unless attributes.is_a?(Hash)
33
51
 
34
52
  # convert string to symbol for hash key
35
53
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
54
 
37
55
 
56
+ if attributes[:'leased']
57
+ self.leased = attributes[:'leased']
58
+ end
59
+
38
60
  if attributes[:'spaces']
39
61
  self.spaces = attributes[:'spaces']
40
62
  end
@@ -43,10 +65,119 @@ module SimplyRetsClient
43
65
  self.description = attributes[:'description']
44
66
  end
45
67
 
46
- if attributes[:'leased']
47
- self.leased = attributes[:'leased']
68
+ end
69
+
70
+ # Check equality by comparing each attribute.
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ leased == o.leased &&
75
+ spaces == o.spaces &&
76
+ description == o.description
77
+ end
78
+
79
+ # @see the `==` method
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculate hash code according to all attributes.
85
+ def hash
86
+ [leased, spaces, description].hash
87
+ end
88
+
89
+ # build the object from hash
90
+ def build_from_hash(attributes)
91
+ return nil unless attributes.is_a?(Hash)
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /^Array<(.*)>/i
94
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
95
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
96
+ else
97
+ #TODO show warning in debug mode
98
+ end
99
+ elsif !attributes[self.class.attribute_map[key]].nil?
100
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
101
+ else
102
+ # data not found in attributes(hash), not an issue as the data can be optional
103
+ end
48
104
  end
49
105
 
106
+ self
107
+ end
108
+
109
+ def _deserialize(type, value)
110
+ case type.to_sym
111
+ when :DateTime
112
+ DateTime.parse(value)
113
+ when :Date
114
+ Date.parse(value)
115
+ when :String
116
+ value.to_s
117
+ when :Integer
118
+ value.to_i
119
+ when :Float
120
+ value.to_f
121
+ when :BOOLEAN
122
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
123
+ true
124
+ else
125
+ false
126
+ end
127
+ when :Object
128
+ # generic object (usually a Hash), return directly
129
+ value
130
+ when /\AArray<(?<inner_type>.+)>\z/
131
+ inner_type = Regexp.last_match[:inner_type]
132
+ value.map { |v| _deserialize(inner_type, v) }
133
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
134
+ k_type = Regexp.last_match[:k_type]
135
+ v_type = Regexp.last_match[:v_type]
136
+ {}.tap do |hash|
137
+ value.each do |k, v|
138
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
139
+ end
140
+ end
141
+ else # model
142
+ _model = SimplyRetsClient.const_get(type).new
143
+ _model.build_from_hash(value)
144
+ end
145
+ end
146
+
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_body (backward compatibility))
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # return the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Method to output non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ def _to_hash(value)
170
+ if value.is_a?(Array)
171
+ value.compact.map{ |v| _to_hash(v) }
172
+ elsif value.is_a?(Hash)
173
+ {}.tap do |hash|
174
+ value.each { |k, v| hash[k] = _to_hash(v) }
175
+ end
176
+ elsif value.respond_to? :to_hash
177
+ value.to_hash
178
+ else
179
+ value
180
+ end
50
181
  end
51
182
 
52
183
  end
@@ -1,95 +1,118 @@
1
+ =begin
2
+ SimplyRETS API
3
+
4
+ The SimplyRETS API is an exciting step towards making it easier for\ndevelopers and real estate agents to build something awesome with\nreal estate data!\n\nThe documentation below makes live requests to our API using the\ntrial data. To get set up with the API using live MLS data, you\nmust have RETS credentials from your MLS, which you can then use to\ncreate an app with SimplyRETS. For more information on that\nprocess, please see our [FAQ](https://simplyrets.com/faq), [Getting\nStarted](https://simplyrets.com/blog/getting-set-up.html) page, or\n[contact us](https://simplyrets.com/\\#home-contact).\n\nBelow you'll find the API endpoints, query parameters, response bodies,\nand other information about using the SimplyRETS API. You can run\nqueries by clicking the 'Try it Out' button at the bottom of each\nsection.\n\n### Authentication\nThe SimplyRETS API uses Basic Authentication. When you create an\napp, you'll get a set of API credentials to access your\nlistings. If you're trying out the test data, you can use\n`simplyrets:simplyrets` for connecting to the API.\n\n### Media Types\nThe SimplyRETS API uses the `Accept` header to allow clients to\ncontrol media types (content versions). We maintain backwards\ncompatibility with API clients by allowing them to specify a\ncontent version. We highly recommend setting and explicity media\ntype when your application reaches production. Both the structure\nand content of our API response bodies is subject to change so we\ncan add new features while respecting the stability of applications\nwhich have already been developed.\n\nTo always use the latest SimplyRETS content version, simply use\n`application/json` in your application `Accept` header.\n\nIf you want to pin your clients media type to a specific version,\nyou can use the vendor-specific SimplyRETS media type, e.g.\n`application/vnd.simplyrets-v0.1+json\"`\n\nTo view all valid content-types for making an `OPTIONS`, make a\nrequest to the SimplyRETS api root\n\n`curl -XOPTIONS -u simplyrets:simplyrets https://api.simplyrets.com/`\n\nThe default media types used in our API responses may change in the\nfuture. If you're building an application and care about the\nstability of the API, be sure to request a specific media type in the\nAccept header as shown in the examples below.\n\nThe wordpress plugin automatically sets the `Accept` header for the\ncompatible SimplyRETS media types.\n\n### Pagination\nThere a few pieces of useful information about each request stored\nin the HTTP Headers:\n\n- `X-Total-Count` shows you the total amount of listings that match\n your current query.\n- `Link` contains pre-built pagination links for accessing the next\n'page' of listings that match your query. Read more about that\n[here](https://simplyrets.com/blog/api-pagination.html).\n
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
1
15
  module SimplyRetsClient
2
16
  # Rets MLS Listing Property
3
- class Property < BaseObject
17
+ class Property
4
18
  # Property roof description
5
19
  attr_accessor :roof
6
20
 
21
+ # A description of the cooling or air conditioning features of the property.
22
+ attr_accessor :cooling
23
+
7
24
  # Property style description or short string
8
25
  attr_accessor :style
9
26
 
10
27
  # Square footage of the building associated with a listing
11
28
  attr_accessor :area
12
29
 
13
- attr_accessor :area_source
14
-
15
30
  # Number of full bathrooms
16
31
  attr_accessor :baths_full
17
32
 
18
33
  # Number of half bathrooms
19
34
  attr_accessor :baths_half
20
35
 
21
- # Number of stories or levels. Represented as a `double' to\naccount for half stories.
36
+ # Number of stories or levels. Represented as a `double' to\naccount for half stories.\n
22
37
  attr_accessor :stories
23
38
 
24
39
  # Number of fireplaces
25
40
  attr_accessor :fireplaces
26
41
 
42
+ # The type(s) of flooring found within the property.
43
+ attr_accessor :flooring
44
+
27
45
  # Heating description or short string
28
46
  attr_accessor :heating
29
47
 
30
- # Number of bedrooms
31
- attr_accessor :bedrooms
48
+ attr_accessor :foundation
32
49
 
33
- # The properties interior features
34
- attr_accessor :interior_features
50
+ attr_accessor :pool_features
35
51
 
36
- # Square footage of the entire property lot
37
- attr_accessor :lot_size
52
+ attr_accessor :laundry_features
38
53
 
39
- #
40
- attr_accessor :exterior_features
54
+ attr_accessor :occupant_name
41
55
 
42
- # The subdivision or community name
43
- attr_accessor :subdivision
56
+ attr_accessor :lot_description
44
57
 
45
- # Abbreviated property type. RES is Residential, CND is CondoOrTownhome,\nRNT is Rental, MLF is Multi-Family, CRE is Commercial, LND is Land,\nFRM is Farm. See the 'propertySubType' field for more information.
46
- attr_accessor :type
58
+ # Lot size in acres\n\n**Added on 2016/05/04 - Not available for all RETS vendors**\n
59
+ attr_accessor :lot_size_acres
47
60
 
48
- # The property's sub-type, i.e. SingleFamilyResidential,\nCondo, etc. Or a list of Sub Types for Mobile, such as\nExpando, Manufactured, Modular, etc.
61
+ # The property's sub-type, i.e. SingleFamilyResidential,\nCondo, etc. Or a list of Sub Types for Mobile, such as\nExpando, Manufactured, Modular, etc.\n
49
62
  attr_accessor :sub_type
50
63
 
51
- # Year the property was built
52
- attr_accessor :year_built
64
+ # Number of bedrooms
65
+ attr_accessor :bedrooms
53
66
 
54
- # Additional room information
55
- attr_accessor :additional_rooms
67
+ # The properties interior features
68
+ attr_accessor :interior_features
69
+
70
+ # Lot size dimensions or square footage as a text. This\nfield is generally used to show the pretty formatted\nlot size.\n
71
+ attr_accessor :lot_size
72
+
73
+ attr_accessor :area_source
56
74
 
57
75
  # Yearly maintenance expense
58
76
  attr_accessor :maintenance_expense
59
77
 
60
- # Number of garage spaces
61
- attr_accessor :garage_spaces
62
-
63
- attr_accessor :pool_features
78
+ # Additional room information
79
+ attr_accessor :additional_rooms
64
80
 
65
- attr_accessor :lot_description
81
+ # Exterior Features for the listing\n
82
+ attr_accessor :exterior_features
66
83
 
67
- attr_accessor :occupant_type
84
+ # Water description and details
85
+ attr_accessor :water
68
86
 
69
- attr_accessor :occupant_name
87
+ # View details and description
88
+ attr_accessor :view
70
89
 
71
- attr_accessor :foundation
90
+ # The total area of the lot. See `lotSizeUnits` for the units\nof measurement (Square Feet, Square Meters, Acres, etc.).\n\n**Added on 2016/05/04 - Not available for all RETS vendors**\n
91
+ attr_accessor :lot_size_area
72
92
 
73
- attr_accessor :laundry_features
93
+ # The subdivision or community name
94
+ attr_accessor :subdivision
74
95
 
75
96
  # The materials that were used in the construction of the property.
76
97
  attr_accessor :construction
77
98
 
78
- # The type(s) of flooring found within the property.
79
- attr_accessor :flooring
99
+ attr_accessor :parking
80
100
 
81
- # A description of the cooling or air conditioning features of the property.
82
- attr_accessor :cooling
101
+ # Unit of measurement for the lotSizeArea field. e.g. Square\nFeet, Square Meters, Acres, etc.\n\nIf this field is `null` the units is the default unit\nof measure specified by your RETS provider.\n\n**Added on 2016/05/04 - Not available for all RETS vendors**\n
102
+ attr_accessor :lot_size_area_units
83
103
 
84
- # View details and description
85
- attr_accessor :view
104
+ # Abbreviated property type. RES is Residential, CND is CondoOrTownhome,\nRNT is Rental, MLF is Multi-Family, CRE is Commercial, LND is Land,\nFRM is Farm. See the `propertySubType` field for more information.\n
105
+ attr_accessor :type
86
106
 
87
- # Water description and details
88
- attr_accessor :water
107
+ # Number of garage spaces
108
+ attr_accessor :garage_spaces
89
109
 
90
110
  attr_accessor :accessibility
91
111
 
92
- attr_accessor :parking
112
+ attr_accessor :occupant_type
113
+
114
+ # Year the property was built
115
+ attr_accessor :year_built
93
116
 
94
117
  # Attribute mapping from ruby-style variable name to JSON key.
95
118
  def self.attribute_map
@@ -97,12 +120,12 @@ module SimplyRetsClient
97
120
 
98
121
  :'roof' => :'roof',
99
122
 
123
+ :'cooling' => :'cooling',
124
+
100
125
  :'style' => :'style',
101
126
 
102
127
  :'area' => :'area',
103
128
 
104
- :'area_source' => :'areaSource',
105
-
106
129
  :'baths_full' => :'bathsFull',
107
130
 
108
131
  :'baths_half' => :'bathsHalf',
@@ -111,101 +134,110 @@ module SimplyRetsClient
111
134
 
112
135
  :'fireplaces' => :'fireplaces',
113
136
 
137
+ :'flooring' => :'flooring',
138
+
114
139
  :'heating' => :'heating',
115
140
 
116
- :'bedrooms' => :'bedrooms',
141
+ :'foundation' => :'foundation',
117
142
 
118
- :'interior_features' => :'interiorFeatures',
143
+ :'pool_features' => :'poolFeatures',
119
144
 
120
- :'lot_size' => :'lotSize',
145
+ :'laundry_features' => :'laundryFeatures',
121
146
 
122
- :'exterior_features' => :'exteriorFeatures',
147
+ :'occupant_name' => :'occupantName',
123
148
 
124
- :'subdivision' => :'subdivision',
149
+ :'lot_description' => :'lotDescription',
125
150
 
126
- :'type' => :'type',
151
+ :'lot_size_acres' => :'lotSizeAcres',
127
152
 
128
153
  :'sub_type' => :'subType',
129
154
 
130
- :'year_built' => :'yearBuilt',
155
+ :'bedrooms' => :'bedrooms',
131
156
 
132
- :'additional_rooms' => :'additionalRooms',
157
+ :'interior_features' => :'interiorFeatures',
133
158
 
134
- :'maintenance_expense' => :'maintenanceExpense',
159
+ :'lot_size' => :'lotSize',
135
160
 
136
- :'garage_spaces' => :'garageSpaces',
161
+ :'area_source' => :'areaSource',
137
162
 
138
- :'pool_features' => :'poolFeatures',
163
+ :'maintenance_expense' => :'maintenanceExpense',
139
164
 
140
- :'lot_description' => :'lotDescription',
165
+ :'additional_rooms' => :'additionalRooms',
141
166
 
142
- :'occupant_type' => :'occupantType',
167
+ :'exterior_features' => :'exteriorFeatures',
143
168
 
144
- :'occupant_name' => :'occupantName',
169
+ :'water' => :'water',
145
170
 
146
- :'foundation' => :'foundation',
171
+ :'view' => :'view',
147
172
 
148
- :'laundry_features' => :'laundryFeatures',
173
+ :'lot_size_area' => :'lotSizeArea',
174
+
175
+ :'subdivision' => :'subdivision',
149
176
 
150
177
  :'construction' => :'construction',
151
178
 
152
- :'flooring' => :'flooring',
179
+ :'parking' => :'parking',
153
180
 
154
- :'cooling' => :'cooling',
181
+ :'lot_size_area_units' => :'lotSizeAreaUnits',
155
182
 
156
- :'view' => :'view',
183
+ :'type' => :'type',
157
184
 
158
- :'water' => :'water',
185
+ :'garage_spaces' => :'garageSpaces',
159
186
 
160
187
  :'accessibility' => :'accessibility',
161
188
 
162
- :'parking' => :'parking'
189
+ :'occupant_type' => :'occupantType',
190
+
191
+ :'year_built' => :'yearBuilt'
163
192
 
164
193
  }
165
194
  end
166
195
 
167
- # attribute type
168
- def self.simplyrets_types
196
+ # Attribute type mapping.
197
+ def self.swagger_types
169
198
  {
170
199
  :'roof' => :'String',
200
+ :'cooling' => :'String',
171
201
  :'style' => :'String',
172
202
  :'area' => :'Integer',
173
- :'area_source' => :'String',
174
203
  :'baths_full' => :'Integer',
175
204
  :'baths_half' => :'Integer',
176
205
  :'stories' => :'Float',
177
206
  :'fireplaces' => :'Integer',
207
+ :'flooring' => :'String',
178
208
  :'heating' => :'String',
209
+ :'foundation' => :'String',
210
+ :'pool_features' => :'String',
211
+ :'laundry_features' => :'String',
212
+ :'occupant_name' => :'String',
213
+ :'lot_description' => :'String',
214
+ :'lot_size_acres' => :'Float',
215
+ :'sub_type' => :'String',
179
216
  :'bedrooms' => :'Integer',
180
217
  :'interior_features' => :'String',
181
218
  :'lot_size' => :'String',
219
+ :'area_source' => :'String',
220
+ :'maintenance_expense' => :'Float',
221
+ :'additional_rooms' => :'String',
182
222
  :'exterior_features' => :'String',
223
+ :'water' => :'String',
224
+ :'view' => :'String',
225
+ :'lot_size_area' => :'Float',
183
226
  :'subdivision' => :'String',
227
+ :'construction' => :'String',
228
+ :'parking' => :'School',
229
+ :'lot_size_area_units' => :'String',
184
230
  :'type' => :'String',
185
- :'sub_type' => :'String',
186
- :'year_built' => :'Integer',
187
- :'additional_rooms' => :'String',
188
- :'maintenance_expense' => :'Float',
189
231
  :'garage_spaces' => :'Float',
190
- :'pool_features' => :'String',
191
- :'lot_description' => :'String',
192
- :'occupant_type' => :'String',
193
- :'occupant_name' => :'String',
194
- :'foundation' => :'String',
195
- :'laundry_features' => :'String',
196
- :'construction' => :'String',
197
- :'flooring' => :'String',
198
- :'cooling' => :'String',
199
- :'view' => :'String',
200
- :'water' => :'String',
201
232
  :'accessibility' => :'String',
202
- :'parking' => :'School'
233
+ :'occupant_type' => :'String',
234
+ :'year_built' => :'Integer'
203
235
 
204
236
  }
205
237
  end
206
238
 
207
239
  def initialize(attributes = {})
208
- return if !attributes.is_a?(Hash) || attributes.empty?
240
+ return unless attributes.is_a?(Hash)
209
241
 
210
242
  # convert string to symbol for hash key
211
243
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
@@ -213,18 +245,24 @@ module SimplyRetsClient
213
245
 
214
246
  if attributes[:'roof']
215
247
  self.roof = attributes[:'roof']
248
+ else
249
+ self.roof = "Composition"
250
+ end
251
+
252
+ if attributes[:'cooling']
253
+ self.cooling = attributes[:'cooling']
216
254
  end
217
255
 
218
256
  if attributes[:'style']
219
257
  self.style = attributes[:'style']
258
+ else
259
+ self.style = "Ranch, Traditional"
220
260
  end
221
261
 
222
262
  if attributes[:'area']
223
263
  self.area = attributes[:'area']
224
- end
225
-
226
- if attributes[:'areaSource']
227
- self.area_source = attributes[:'areaSource']
264
+ else
265
+ self.area = 5984
228
266
  end
229
267
 
230
268
  if attributes[:'bathsFull']
@@ -237,110 +275,150 @@ module SimplyRetsClient
237
275
 
238
276
  if attributes[:'stories']
239
277
  self.stories = attributes[:'stories']
278
+ else
279
+ self.stories = 2.0
240
280
  end
241
281
 
242
282
  if attributes[:'fireplaces']
243
283
  self.fireplaces = attributes[:'fireplaces']
284
+ else
285
+ self.fireplaces = 1
286
+ end
287
+
288
+ if attributes[:'flooring']
289
+ self.flooring = attributes[:'flooring']
244
290
  end
245
291
 
246
292
  if attributes[:'heating']
247
293
  self.heating = attributes[:'heating']
294
+ else
295
+ self.heating = "Central System, Forced Air, Gas"
248
296
  end
249
297
 
250
- if attributes[:'bedrooms']
251
- self.bedrooms = attributes[:'bedrooms']
298
+ if attributes[:'foundation']
299
+ self.foundation = attributes[:'foundation']
252
300
  end
253
301
 
254
- if attributes[:'interiorFeatures']
255
- self.interior_features = attributes[:'interiorFeatures']
302
+ if attributes[:'poolFeatures']
303
+ self.pool_features = attributes[:'poolFeatures']
256
304
  end
257
305
 
258
- if attributes[:'lotSize']
259
- self.lot_size = attributes[:'lotSize']
306
+ if attributes[:'laundryFeatures']
307
+ self.laundry_features = attributes[:'laundryFeatures']
260
308
  end
261
309
 
262
- if attributes[:'exteriorFeatures']
263
- self.exterior_features = attributes[:'exteriorFeatures']
310
+ if attributes[:'occupantName']
311
+ self.occupant_name = attributes[:'occupantName']
264
312
  end
265
313
 
266
- if attributes[:'subdivision']
267
- self.subdivision = attributes[:'subdivision']
314
+ if attributes[:'lotDescription']
315
+ self.lot_description = attributes[:'lotDescription']
268
316
  end
269
317
 
270
- if attributes[:'type']
271
- self.type = attributes[:'type']
318
+ if attributes[:'lotSizeAcres']
319
+ self.lot_size_acres = attributes[:'lotSizeAcres']
320
+ else
321
+ self.lot_size_acres = 10.0
272
322
  end
273
323
 
274
324
  if attributes[:'subType']
275
- self.type = attributes[:'subType']
325
+ self.sub_type = attributes[:'subType']
276
326
  end
277
327
 
278
- if attributes[:'yearBuilt']
279
- self.year_built = attributes[:'yearBuilt']
328
+ if attributes[:'bedrooms']
329
+ self.bedrooms = attributes[:'bedrooms']
330
+ else
331
+ self.bedrooms = 5
280
332
  end
281
333
 
282
- if attributes[:'additionalRooms']
283
- self.additional_rooms = attributes[:'additionalRooms']
334
+ if attributes[:'interiorFeatures']
335
+ self.interior_features = attributes[:'interiorFeatures']
336
+ else
337
+ self.interior_features = "2-Story Foyer,9 ft + Ceil Main,Cathedral Ceiling,Double Vnty\nOther,High Speed Internet Available,Entrance Foyer,Hardwood\nFloors,Trey Ceilings,Walk-In Closet(s),Wall/Wall Carpet\n"
284
338
  end
285
339
 
286
- if attributes[:'maintenanceExpense']
287
- self.maintenance_expense = attributes[:'maintenanceExpense']
340
+ if attributes[:'lotSize']
341
+ self.lot_size = attributes[:'lotSize']
342
+ else
343
+ self.lot_size = "3/4 Up To 1 Acre"
288
344
  end
289
345
 
290
- if attributes[:'garageSpaces']
291
- self.garage_spaces = attributes[:'garageSpaces']
346
+ if attributes[:'areaSource']
347
+ self.area_source = attributes[:'areaSource']
348
+ else
349
+ self.area_source = "Tax Record"
292
350
  end
293
351
 
294
- if attributes[:'poolFeatures']
295
- self.pool_features = attributes[:'poolFeatures']
352
+ if attributes[:'maintenanceExpense']
353
+ self.maintenance_expense = attributes[:'maintenanceExpense']
296
354
  end
297
355
 
298
- if attributes[:'lotDescription']
299
- self.lot_description = attributes[:'lotDescription']
356
+ if attributes[:'additionalRooms']
357
+ self.additional_rooms = attributes[:'additionalRooms']
300
358
  end
301
359
 
302
- if attributes[:'occupantType']
303
- self.occupant_type = attributes[:'occupantType']
360
+ if attributes[:'exteriorFeatures']
361
+ self.exterior_features = attributes[:'exteriorFeatures']
362
+ else
363
+ self.exterior_features = "1-2 Step Entry,Barn(s),Fenced Yard,Front Porch,Garden\nArea,Guest House,Out-Buildings,Patio,Prof Landscaping\n"
304
364
  end
305
365
 
306
- if attributes[:'occupantName']
307
- self.occupant_name = attributes[:'occupantName']
366
+ if attributes[:'water']
367
+ self.water = attributes[:'water']
308
368
  end
309
369
 
310
- if attributes[:'foundation']
311
- self.foundation = attributes[:'foundation']
370
+ if attributes[:'view']
371
+ self.view = attributes[:'view']
312
372
  end
313
373
 
314
- if attributes[:'laundryFeatures']
315
- self.laundry_features = attributes[:'laundryFeatures']
374
+ if attributes[:'lotSizeArea']
375
+ self.lot_size_area = attributes[:'lotSizeArea']
376
+ else
377
+ self.lot_size_area = 5000.0
378
+ end
379
+
380
+ if attributes[:'subdivision']
381
+ self.subdivision = attributes[:'subdivision']
382
+ else
383
+ self.subdivision = "River Oaks"
316
384
  end
317
385
 
318
386
  if attributes[:'construction']
319
387
  self.construction = attributes[:'construction']
320
388
  end
321
389
 
322
- if attributes[:'flooring']
323
- self.flooring = attributes[:'flooring']
390
+ if attributes[:'parking']
391
+ self.parking = attributes[:'parking']
324
392
  end
325
393
 
326
- if attributes[:'cooling']
327
- self.cooling = attributes[:'cooling']
394
+ if attributes[:'lotSizeAreaUnits']
395
+ self.lot_size_area_units = attributes[:'lotSizeAreaUnits']
396
+ else
397
+ self.lot_size_area_units = "Sq Ft"
328
398
  end
329
399
 
330
- if attributes[:'view']
331
- self.view = attributes[:'view']
400
+ if attributes[:'type']
401
+ self.type = attributes[:'type']
402
+ else
403
+ self.type = "RES"
332
404
  end
333
405
 
334
- if attributes[:'water']
335
- self.water = attributes[:'water']
406
+ if attributes[:'garageSpaces']
407
+ self.garage_spaces = attributes[:'garageSpaces']
336
408
  end
337
409
 
338
410
  if attributes[:'accessibility']
339
411
  self.accessibility = attributes[:'accessibility']
340
412
  end
341
413
 
342
- if attributes[:'parking']
343
- self.parking = attributes[:'parking']
414
+ if attributes[:'occupantType']
415
+ self.occupant_type = attributes[:'occupantType']
416
+ end
417
+
418
+ if attributes[:'yearBuilt']
419
+ self.year_built = attributes[:'yearBuilt']
420
+ else
421
+ self.year_built = 2007
344
422
  end
345
423
 
346
424
  end
@@ -354,5 +432,151 @@ module SimplyRetsClient
354
432
  @type = type
355
433
  end
356
434
 
435
+ # Check equality by comparing each attribute.
436
+ def ==(o)
437
+ return true if self.equal?(o)
438
+ self.class == o.class &&
439
+ roof == o.roof &&
440
+ cooling == o.cooling &&
441
+ style == o.style &&
442
+ area == o.area &&
443
+ baths_full == o.baths_full &&
444
+ baths_half == o.baths_half &&
445
+ stories == o.stories &&
446
+ fireplaces == o.fireplaces &&
447
+ flooring == o.flooring &&
448
+ heating == o.heating &&
449
+ foundation == o.foundation &&
450
+ pool_features == o.pool_features &&
451
+ laundry_features == o.laundry_features &&
452
+ occupant_name == o.occupant_name &&
453
+ lot_description == o.lot_description &&
454
+ lot_size_acres == o.lot_size_acres &&
455
+ sub_type == o.sub_type &&
456
+ bedrooms == o.bedrooms &&
457
+ interior_features == o.interior_features &&
458
+ lot_size == o.lot_size &&
459
+ area_source == o.area_source &&
460
+ maintenance_expense == o.maintenance_expense &&
461
+ additional_rooms == o.additional_rooms &&
462
+ exterior_features == o.exterior_features &&
463
+ water == o.water &&
464
+ view == o.view &&
465
+ lot_size_area == o.lot_size_area &&
466
+ subdivision == o.subdivision &&
467
+ construction == o.construction &&
468
+ parking == o.parking &&
469
+ lot_size_area_units == o.lot_size_area_units &&
470
+ type == o.type &&
471
+ garage_spaces == o.garage_spaces &&
472
+ accessibility == o.accessibility &&
473
+ occupant_type == o.occupant_type &&
474
+ year_built == o.year_built
475
+ end
476
+
477
+ # @see the `==` method
478
+ def eql?(o)
479
+ self == o
480
+ end
481
+
482
+ # Calculate hash code according to all attributes.
483
+ def hash
484
+ [roof, cooling, style, area, baths_full, baths_half, stories, fireplaces, flooring, heating, foundation, pool_features, laundry_features, occupant_name, lot_description, lot_size_acres, sub_type, bedrooms, interior_features, lot_size, area_source, maintenance_expense, additional_rooms, exterior_features, water, view, lot_size_area, subdivision, construction, parking, lot_size_area_units, type, garage_spaces, accessibility, occupant_type, year_built].hash
485
+ end
486
+
487
+ # build the object from hash
488
+ def build_from_hash(attributes)
489
+ return nil unless attributes.is_a?(Hash)
490
+ self.class.swagger_types.each_pair do |key, type|
491
+ if type =~ /^Array<(.*)>/i
492
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
493
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
494
+ else
495
+ #TODO show warning in debug mode
496
+ end
497
+ elsif !attributes[self.class.attribute_map[key]].nil?
498
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
499
+ else
500
+ # data not found in attributes(hash), not an issue as the data can be optional
501
+ end
502
+ end
503
+
504
+ self
505
+ end
506
+
507
+ def _deserialize(type, value)
508
+ case type.to_sym
509
+ when :DateTime
510
+ DateTime.parse(value)
511
+ when :Date
512
+ Date.parse(value)
513
+ when :String
514
+ value.to_s
515
+ when :Integer
516
+ value.to_i
517
+ when :Float
518
+ value.to_f
519
+ when :BOOLEAN
520
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
521
+ true
522
+ else
523
+ false
524
+ end
525
+ when :Object
526
+ # generic object (usually a Hash), return directly
527
+ value
528
+ when /\AArray<(?<inner_type>.+)>\z/
529
+ inner_type = Regexp.last_match[:inner_type]
530
+ value.map { |v| _deserialize(inner_type, v) }
531
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
532
+ k_type = Regexp.last_match[:k_type]
533
+ v_type = Regexp.last_match[:v_type]
534
+ {}.tap do |hash|
535
+ value.each do |k, v|
536
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
537
+ end
538
+ end
539
+ else # model
540
+ _model = SimplyRetsClient.const_get(type).new
541
+ _model.build_from_hash(value)
542
+ end
543
+ end
544
+
545
+ def to_s
546
+ to_hash.to_s
547
+ end
548
+
549
+ # to_body is an alias to to_body (backward compatibility))
550
+ def to_body
551
+ to_hash
552
+ end
553
+
554
+ # return the object in the form of hash
555
+ def to_hash
556
+ hash = {}
557
+ self.class.attribute_map.each_pair do |attr, param|
558
+ value = self.send(attr)
559
+ next if value.nil?
560
+ hash[param] = _to_hash(value)
561
+ end
562
+ hash
563
+ end
564
+
565
+ # Method to output non-array value in the form of hash
566
+ # For object, use to_hash. Otherwise, just return the value
567
+ def _to_hash(value)
568
+ if value.is_a?(Array)
569
+ value.compact.map{ |v| _to_hash(v) }
570
+ elsif value.is_a?(Hash)
571
+ {}.tap do |hash|
572
+ value.each { |k, v| hash[k] = _to_hash(v) }
573
+ end
574
+ elsif value.respond_to? :to_hash
575
+ value.to_hash
576
+ else
577
+ value
578
+ end
579
+ end
580
+
357
581
  end
358
582
  end