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,22 +1,39 @@
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 Error < BaseObject
4
- attr_accessor :error, :message
5
- # attribute mapping from ruby-style variable name to JSON key
16
+ # Error information
17
+ class Error
18
+ # Error code. In general, we try to adhere to HTTP status code\nand use these error statuses for detailed reporting.\n
19
+ attr_accessor :error
20
+
21
+ # Status message with an explanation of the error
22
+ attr_accessor :message
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
6
25
  def self.attribute_map
7
26
  {
8
27
 
9
- # Error code. In general, we try to adhere to HTTP status code\nand use these error statuses for detailed reporting.\n
10
28
  :'error' => :'error',
11
29
 
12
- # Status message with an explanation of the error
13
30
  :'message' => :'message'
14
31
 
15
32
  }
16
33
  end
17
34
 
18
- # attribute type
19
- def self.simplyrets_types
35
+ # Attribute type mapping.
36
+ def self.swagger_types
20
37
  {
21
38
  :'error' => :'Integer',
22
39
  :'message' => :'String'
@@ -25,7 +42,7 @@ module SimplyRetsClient
25
42
  end
26
43
 
27
44
  def initialize(attributes = {})
28
- return if !attributes.is_a?(Hash) || attributes.empty?
45
+ return unless attributes.is_a?(Hash)
29
46
 
30
47
  # convert string to symbol for hash key
31
48
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
@@ -41,5 +58,117 @@ module SimplyRetsClient
41
58
 
42
59
  end
43
60
 
61
+ # Check equality by comparing each attribute.
62
+ def ==(o)
63
+ return true if self.equal?(o)
64
+ self.class == o.class &&
65
+ error == o.error &&
66
+ message == o.message
67
+ end
68
+
69
+ # @see the `==` method
70
+ def eql?(o)
71
+ self == o
72
+ end
73
+
74
+ # Calculate hash code according to all attributes.
75
+ def hash
76
+ [error, message].hash
77
+ end
78
+
79
+ # build the object from hash
80
+ def build_from_hash(attributes)
81
+ return nil unless attributes.is_a?(Hash)
82
+ self.class.swagger_types.each_pair do |key, type|
83
+ if type =~ /^Array<(.*)>/i
84
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
85
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
86
+ else
87
+ #TODO show warning in debug mode
88
+ end
89
+ elsif !attributes[self.class.attribute_map[key]].nil?
90
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
91
+ else
92
+ # data not found in attributes(hash), not an issue as the data can be optional
93
+ end
94
+ end
95
+
96
+ self
97
+ end
98
+
99
+ def _deserialize(type, value)
100
+ case type.to_sym
101
+ when :DateTime
102
+ DateTime.parse(value)
103
+ when :Date
104
+ Date.parse(value)
105
+ when :String
106
+ value.to_s
107
+ when :Integer
108
+ value.to_i
109
+ when :Float
110
+ value.to_f
111
+ when :BOOLEAN
112
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
113
+ true
114
+ else
115
+ false
116
+ end
117
+ when :Object
118
+ # generic object (usually a Hash), return directly
119
+ value
120
+ when /\AArray<(?<inner_type>.+)>\z/
121
+ inner_type = Regexp.last_match[:inner_type]
122
+ value.map { |v| _deserialize(inner_type, v) }
123
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
124
+ k_type = Regexp.last_match[:k_type]
125
+ v_type = Regexp.last_match[:v_type]
126
+ {}.tap do |hash|
127
+ value.each do |k, v|
128
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
129
+ end
130
+ end
131
+ else # model
132
+ _model = SimplyRetsClient.const_get(type).new
133
+ _model.build_from_hash(value)
134
+ end
135
+ end
136
+
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_body (backward compatibility))
142
+ def to_body
143
+ to_hash
144
+ end
145
+
146
+ # return the object in the form of hash
147
+ def to_hash
148
+ hash = {}
149
+ self.class.attribute_map.each_pair do |attr, param|
150
+ value = self.send(attr)
151
+ next if value.nil?
152
+ hash[param] = _to_hash(value)
153
+ end
154
+ hash
155
+ end
156
+
157
+ # Method to output non-array value in the form of hash
158
+ # For object, use to_hash. Otherwise, just return the value
159
+ def _to_hash(value)
160
+ if value.is_a?(Array)
161
+ value.compact.map{ |v| _to_hash(v) }
162
+ elsif value.is_a?(Hash)
163
+ {}.tap do |hash|
164
+ value.each { |k, v| hash[k] = _to_hash(v) }
165
+ end
166
+ elsif value.respond_to? :to_hash
167
+ value.to_hash
168
+ else
169
+ value
170
+ end
171
+ end
172
+
44
173
  end
45
174
  end
@@ -1,31 +1,54 @@
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 GeographicData < BaseObject
4
- attr_accessor :county, :lat, :lng, :market_area, :directions
5
- # attribute mapping from ruby-style variable name to JSON key
16
+ # RETS MLS Geographic Data
17
+ class GeographicData
18
+ # Listing county
19
+ attr_accessor :county
20
+
21
+ # Listing latitude (if available)
22
+ attr_accessor :lat
23
+
24
+ # Listing longitude (if available)
25
+ attr_accessor :lng
26
+
27
+ # Listing GeoMarket area. May be the same as mlsArea
28
+ attr_accessor :market_area
29
+
30
+ # Directions to the property
31
+ attr_accessor :directions
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
6
34
  def self.attribute_map
7
35
  {
8
36
 
9
- # Listing county
10
37
  :'county' => :'county',
11
38
 
12
- # Listing latitude (if available)
13
39
  :'lat' => :'lat',
14
40
 
15
- # Listing longitude (if available)
16
41
  :'lng' => :'lng',
17
42
 
18
- # Listing GeoMarket area. May be the same as mlsArea
19
43
  :'market_area' => :'marketArea',
20
44
 
21
- # Directions to the property
22
45
  :'directions' => :'directions'
23
46
 
24
47
  }
25
48
  end
26
49
 
27
- # attribute type
28
- def self.simplyrets_types
50
+ # Attribute type mapping.
51
+ def self.swagger_types
29
52
  {
30
53
  :'county' => :'String',
31
54
  :'lat' => :'Float',
@@ -37,7 +60,7 @@ module SimplyRetsClient
37
60
  end
38
61
 
39
62
  def initialize(attributes = {})
40
- return if !attributes.is_a?(Hash) || attributes.empty?
63
+ return unless attributes.is_a?(Hash)
41
64
 
42
65
  # convert string to symbol for hash key
43
66
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
@@ -65,5 +88,120 @@ module SimplyRetsClient
65
88
 
66
89
  end
67
90
 
91
+ # Check equality by comparing each attribute.
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ county == o.county &&
96
+ lat == o.lat &&
97
+ lng == o.lng &&
98
+ market_area == o.market_area &&
99
+ directions == o.directions
100
+ end
101
+
102
+ # @see the `==` method
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculate hash code according to all attributes.
108
+ def hash
109
+ [county, lat, lng, market_area, directions].hash
110
+ end
111
+
112
+ # build the object from hash
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /^Array<(.*)>/i
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
119
+ else
120
+ #TODO show warning in debug mode
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ else
125
+ # data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :BOOLEAN
145
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ _model = SimplyRetsClient.const_get(type).new
166
+ _model.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_body (backward compatibility))
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # return the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Method to output non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
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
+
68
206
  end
69
207
  end
@@ -1,118 +1,185 @@
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 Listing < BaseObject
4
- attr_accessor :property, :mls_id, :showing_instructions, :office, :disclaimer, :address, :list_date, :agent, :modified, :school, :sales, :photos, :list_price, :listing_id, :mls, :geo, :tax, :remarks, :private_remarks, :lease_term, :lease_type
5
- # attribute mapping from ruby-style variable name to JSON key
16
+ # RETS MLS Listing Property
17
+ class Listing
18
+ # Agent only remarks
19
+ attr_accessor :private_remarks
20
+
21
+ # Specific property data associated with listing.
22
+ attr_accessor :property
23
+
24
+ # A unique identifier for this listing specific to the\nSimplyRETS API. Thie identifier is specific to the\nSimplyRETS api and has no correlation with the MLS\nnumber. Use this id when making requests to the single\nlisting endpoint (eg, `/properties/{mlsId}`).\n\nApplications should not rely on specific `mlsId`s being\npresent. Instead, apps should dynamically use the `mlsId`\nafter using other more general query parameters. Many mls\nvendors require listings which are expired, terminated or\nsold to be purged, which will render calls to specific\n`mlsId`s to return nothing (or possibly a 404).\n
25
+ attr_accessor :mls_id
26
+
27
+ # Public instructions for showing the property.
28
+ attr_accessor :showing_instructions
29
+
30
+ # Listing office or brokerage.
31
+ attr_accessor :office
32
+
33
+ # Represents the length of the lease.
34
+ attr_accessor :lease_term
35
+
36
+ # Data accuracy disclaimer. The value in the disclaimer may\nchange depending on your MLS vendors rules.\n
37
+ attr_accessor :disclaimer
38
+
39
+ # Comprehensive property address information
40
+ attr_accessor :address
41
+
42
+ # Date and time the listing became Active
43
+ attr_accessor :list_date
44
+
45
+ # Comprehensive listing agent information
46
+ attr_accessor :agent
47
+
48
+ # Date and time of the last modification
49
+ attr_accessor :modified
50
+
51
+ # Comprehensive school zone data
52
+ attr_accessor :school
53
+
54
+ # Photos of the property. Images are served over https and are\nsuitable for production use on secure websites\n
55
+ attr_accessor :photos
56
+
57
+ # Price of the listing
58
+ attr_accessor :list_price
59
+
60
+ # Data Dictionary v1.3 ListingId. The well known identifier\nfor the listing. The value is the id or number by the MLS as\na public identifier for the listing.\n\nThis identifier should not be confused with the `mlsId`, which is\nspecific to the SimplyRETS API.\n
61
+ attr_accessor :listing_id
62
+
63
+ # MLS vendor information and data
64
+ attr_accessor :mls
65
+
66
+ # Geographic data for the listing
67
+ attr_accessor :geo
68
+
69
+ # Associate tax data
70
+ attr_accessor :tax
71
+
72
+ # Sales data
73
+ attr_accessor :sales
74
+
75
+ # Information about the status of the existing lease on the property.
76
+ attr_accessor :lease_type
77
+
78
+ # The URL for an unbranded virtual tour of the property.\n\n**Added on 2016/05/04 - Not available for all RETS vendors**\n
79
+ attr_accessor :virtual_tour_url
80
+
81
+ # Description or remarks
82
+ attr_accessor :remarks
83
+
84
+ # Attribute mapping from ruby-style variable name to JSON key.
6
85
  def self.attribute_map
7
86
  {
8
87
 
9
- # Specific property data associated with listing.
88
+ :'private_remarks' => :'privateRemarks',
89
+
10
90
  :'property' => :'property',
11
91
 
12
- # A unique identifier for this listing specific to the SimplyRETS API.\n
13
92
  :'mls_id' => :'mlsId',
14
93
 
15
- # Public instructions for showing the property.
16
94
  :'showing_instructions' => :'showingInstructions',
17
95
 
18
- # Listing office or brokerage.
19
96
  :'office' => :'office',
20
97
 
21
- # Data accuracy disclaimer. The value in the disclaimer may\nchange depending on your MLS vendors rules.\n
98
+ :'lease_term' => :'leaseTerm',
99
+
22
100
  :'disclaimer' => :'disclaimer',
23
101
 
24
- # Comprehensive property address information
25
102
  :'address' => :'address',
26
103
 
27
- # Date and time the listing became Active
28
104
  :'list_date' => :'listDate',
29
105
 
30
- # Comprehensive listing agent information
31
106
  :'agent' => :'agent',
32
107
 
33
- # Date and time of the last modification
34
108
  :'modified' => :'modified',
35
109
 
36
- # Comprehensive school zone data
37
110
  :'school' => :'school',
38
111
 
39
- # Sales data
40
- :'sales' => :'sales',
41
-
42
- # Photos of the property. Images are served over https and are\nsuitable for production use on secure websites\n
43
112
  :'photos' => :'photos',
44
113
 
45
- # Price of the listing
46
114
  :'list_price' => :'listPrice',
47
115
 
48
- # Data Dictionary v1.3 ListingId. The well known identifier\nfor the listing. The value may be identical to\nmlsId. However, listingId is intended to be the value used\nby a human to retrieve the information about a specific\nlisting.\n
49
116
  :'listing_id' => :'listingId',
50
117
 
51
- # MLS vendor information and data
52
118
  :'mls' => :'mls',
53
119
 
54
- # Geographic data for the listing
55
120
  :'geo' => :'geo',
56
121
 
57
- # Associate tax data
58
122
  :'tax' => :'tax',
59
123
 
60
- # Description or remarks
61
- :'remarks' => :'remarks',
124
+ :'sales' => :'sales',
62
125
 
63
- # Agent only remarks
64
- :'private_remarks' => :'privateRemarks',
126
+ :'lease_type' => :'leaseType',
65
127
 
66
- #
67
- :'lease_term' => :'leaseTerm',
128
+ :'virtual_tour_url' => :'virtualTourUrl',
68
129
 
69
- #
70
- :'lease_type' => :'leaseType'
130
+ :'remarks' => :'remarks'
71
131
 
72
132
  }
73
133
  end
74
134
 
75
- # attribute type
76
- def self.simplyrets_types
135
+ # Attribute type mapping.
136
+ def self.swagger_types
77
137
  {
138
+ :'private_remarks' => :'String',
78
139
  :'property' => :'Property',
79
140
  :'mls_id' => :'Integer',
80
141
  :'showing_instructions' => :'String',
81
142
  :'office' => :'Office',
143
+ :'lease_term' => :'String',
82
144
  :'disclaimer' => :'String',
83
145
  :'address' => :'StreetAddress',
84
146
  :'list_date' => :'DateTime',
85
147
  :'agent' => :'Agent',
86
148
  :'modified' => :'DateTime',
87
149
  :'school' => :'School',
88
- :'sales' => :'Sales',
89
150
  :'photos' => :'Array<String>',
90
151
  :'list_price' => :'Float',
91
152
  :'listing_id' => :'String',
92
153
  :'mls' => :'MlsInformation',
93
154
  :'geo' => :'GeographicData',
94
155
  :'tax' => :'Tax',
95
- :'remarks' => :'String',
96
- :'private_remarks' => :'String',
97
- :'lease_term' => :'String',
98
- :'lease_type' => :'String'
156
+ :'sales' => :'Sales',
157
+ :'lease_type' => :'String',
158
+ :'virtual_tour_url' => :'String',
159
+ :'remarks' => :'String'
99
160
 
100
161
  }
101
162
  end
102
163
 
103
164
  def initialize(attributes = {})
104
- return if !attributes.is_a?(Hash) || attributes.empty?
165
+ return unless attributes.is_a?(Hash)
105
166
 
106
167
  # convert string to symbol for hash key
107
168
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
108
169
 
109
170
 
171
+ if attributes[:'privateRemarks']
172
+ self.private_remarks = attributes[:'privateRemarks']
173
+ end
174
+
110
175
  if attributes[:'property']
111
176
  self.property = attributes[:'property']
112
177
  end
113
178
 
114
179
  if attributes[:'mlsId']
115
180
  self.mls_id = attributes[:'mlsId']
181
+ else
182
+ self.mls_id = 329479823
116
183
  end
117
184
 
118
185
  if attributes[:'showingInstructions']
@@ -123,6 +190,10 @@ module SimplyRetsClient
123
190
  self.office = attributes[:'office']
124
191
  end
125
192
 
193
+ if attributes[:'leaseTerm']
194
+ self.lease_term = attributes[:'leaseTerm']
195
+ end
196
+
126
197
  if attributes[:'disclaimer']
127
198
  self.disclaimer = attributes[:'disclaimer']
128
199
  end
@@ -147,10 +218,6 @@ module SimplyRetsClient
147
218
  self.school = attributes[:'school']
148
219
  end
149
220
 
150
- if attributes[:'sales']
151
- self.sales = attributes[:'sales']
152
- end
153
-
154
221
  if attributes[:'photos']
155
222
  if (value = attributes[:'photos']).is_a?(Array)
156
223
  self.photos = value
@@ -177,22 +244,154 @@ module SimplyRetsClient
177
244
  self.tax = attributes[:'tax']
178
245
  end
179
246
 
247
+ if attributes[:'sales']
248
+ self.sales = attributes[:'sales']
249
+ end
250
+
251
+ if attributes[:'leaseType']
252
+ self.lease_type = attributes[:'leaseType']
253
+ end
254
+
255
+ if attributes[:'virtualTourUrl']
256
+ self.virtual_tour_url = attributes[:'virtualTourUrl']
257
+ end
258
+
180
259
  if attributes[:'remarks']
181
260
  self.remarks = attributes[:'remarks']
182
261
  end
183
262
 
184
- if attributes[:'privateRemarks']
185
- self.private_remarks = attributes[:'privateRemarks']
263
+ end
264
+
265
+ # Check equality by comparing each attribute.
266
+ def ==(o)
267
+ return true if self.equal?(o)
268
+ self.class == o.class &&
269
+ private_remarks == o.private_remarks &&
270
+ property == o.property &&
271
+ mls_id == o.mls_id &&
272
+ showing_instructions == o.showing_instructions &&
273
+ office == o.office &&
274
+ lease_term == o.lease_term &&
275
+ disclaimer == o.disclaimer &&
276
+ address == o.address &&
277
+ list_date == o.list_date &&
278
+ agent == o.agent &&
279
+ modified == o.modified &&
280
+ school == o.school &&
281
+ photos == o.photos &&
282
+ list_price == o.list_price &&
283
+ listing_id == o.listing_id &&
284
+ mls == o.mls &&
285
+ geo == o.geo &&
286
+ tax == o.tax &&
287
+ sales == o.sales &&
288
+ lease_type == o.lease_type &&
289
+ virtual_tour_url == o.virtual_tour_url &&
290
+ remarks == o.remarks
291
+ end
292
+
293
+ # @see the `==` method
294
+ def eql?(o)
295
+ self == o
296
+ end
297
+
298
+ # Calculate hash code according to all attributes.
299
+ def hash
300
+ [private_remarks, property, mls_id, showing_instructions, office, lease_term, disclaimer, address, list_date, agent, modified, school, photos, list_price, listing_id, mls, geo, tax, sales, lease_type, virtual_tour_url, remarks].hash
301
+ end
302
+
303
+ # build the object from hash
304
+ def build_from_hash(attributes)
305
+ return nil unless attributes.is_a?(Hash)
306
+ self.class.swagger_types.each_pair do |key, type|
307
+ if type =~ /^Array<(.*)>/i
308
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
309
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
310
+ else
311
+ #TODO show warning in debug mode
312
+ end
313
+ elsif !attributes[self.class.attribute_map[key]].nil?
314
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
315
+ else
316
+ # data not found in attributes(hash), not an issue as the data can be optional
317
+ end
186
318
  end
187
319
 
188
- if attributes[:'leaseTerm']
189
- self.lease_term = attributes[:'leaseTerm']
320
+ self
321
+ end
322
+
323
+ def _deserialize(type, value)
324
+ case type.to_sym
325
+ when :DateTime
326
+ DateTime.parse(value)
327
+ when :Date
328
+ Date.parse(value)
329
+ when :String
330
+ value.to_s
331
+ when :Integer
332
+ value.to_i
333
+ when :Float
334
+ value.to_f
335
+ when :BOOLEAN
336
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
337
+ true
338
+ else
339
+ false
340
+ end
341
+ when :Object
342
+ # generic object (usually a Hash), return directly
343
+ value
344
+ when /\AArray<(?<inner_type>.+)>\z/
345
+ inner_type = Regexp.last_match[:inner_type]
346
+ value.map { |v| _deserialize(inner_type, v) }
347
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
348
+ k_type = Regexp.last_match[:k_type]
349
+ v_type = Regexp.last_match[:v_type]
350
+ {}.tap do |hash|
351
+ value.each do |k, v|
352
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
353
+ end
354
+ end
355
+ else # model
356
+ _model = SimplyRetsClient.const_get(type).new
357
+ _model.build_from_hash(value)
190
358
  end
359
+ end
191
360
 
192
- if attributes[:'leaseType']
193
- self.lease_type = attributes[:'leaseType']
361
+ def to_s
362
+ to_hash.to_s
363
+ end
364
+
365
+ # to_body is an alias to to_body (backward compatibility))
366
+ def to_body
367
+ to_hash
368
+ end
369
+
370
+ # return the object in the form of hash
371
+ def to_hash
372
+ hash = {}
373
+ self.class.attribute_map.each_pair do |attr, param|
374
+ value = self.send(attr)
375
+ next if value.nil?
376
+ hash[param] = _to_hash(value)
194
377
  end
378
+ hash
379
+ end
195
380
 
381
+ # Method to output non-array value in the form of hash
382
+ # For object, use to_hash. Otherwise, just return the value
383
+ def _to_hash(value)
384
+ if value.is_a?(Array)
385
+ value.compact.map{ |v| _to_hash(v) }
386
+ elsif value.is_a?(Hash)
387
+ {}.tap do |hash|
388
+ value.each { |k, v| hash[k] = _to_hash(v) }
389
+ end
390
+ elsif value.respond_to? :to_hash
391
+ value.to_hash
392
+ else
393
+ value
394
+ end
196
395
  end
197
396
 
198
397
  end