simplyrets 1.0.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -21
- data/Makefile +48 -0
- data/README.org +5 -58
- data/example.rb +14 -4
- data/lib/simplyrets.rb +42 -21
- data/lib/simplyrets/api/default_api.rb +292 -59
- data/lib/simplyrets/api_client.rb +370 -0
- data/lib/simplyrets/api_error.rb +36 -0
- data/lib/simplyrets/configuration.rb +170 -0
- data/lib/simplyrets/models/agent.rb +146 -11
- data/lib/simplyrets/models/broker.rb +133 -7
- data/lib/simplyrets/models/contact_information.rb +149 -17
- data/lib/simplyrets/models/error.rb +138 -9
- data/lib/simplyrets/models/geographic_data.rb +150 -12
- data/lib/simplyrets/models/listing.rb +248 -49
- data/lib/simplyrets/models/mls_information.rb +148 -12
- data/lib/simplyrets/models/office.rb +146 -11
- data/lib/simplyrets/models/open_house.rb +215 -12
- data/lib/simplyrets/models/parking.rb +148 -17
- data/lib/simplyrets/models/property.rb +353 -129
- data/lib/simplyrets/models/sales.rb +163 -25
- data/lib/simplyrets/models/school.rb +167 -24
- data/lib/simplyrets/models/street_address.rb +204 -26
- data/lib/simplyrets/models/tax.rb +150 -18
- data/lib/simplyrets/version.rb +15 -0
- data/multi-query-param.patch +44 -0
- data/simplyrets.gemspec +4 -4
- data/spec/api/default_api_spec.rb +172 -0
- data/spec/models/agent_spec.rb +75 -0
- data/spec/models/broker_spec.rb +45 -0
- data/spec/models/contact_information_spec.rb +65 -0
- data/spec/models/error_spec.rb +55 -0
- data/spec/models/geographic_data_spec.rb +85 -0
- data/spec/models/listing_spec.rb +245 -0
- data/spec/models/mls_information_spec.rb +75 -0
- data/spec/models/office_spec.rb +75 -0
- data/spec/models/open_house_spec.rb +115 -0
- data/spec/models/parking_spec.rb +65 -0
- data/spec/models/property_spec.rb +365 -0
- data/spec/models/sales_spec.rb +85 -0
- data/spec/models/school_spec.rb +75 -0
- data/spec/models/street_address_spec.rb +105 -0
- data/spec/models/tax_spec.rb +65 -0
- data/spec/spec_helper.rb +78 -0
- metadata +33 -18
- data/lib/simplyrets.rb~ +0 -34
- data/lib/simplyrets/api/#default_api.rb# +0 -146
- data/lib/simplyrets/simplyrets/api_error.rb +0 -26
- data/lib/simplyrets/simplyrets/configuration.rb +0 -101
- data/lib/simplyrets/simplyrets/request.rb +0 -248
- data/lib/simplyrets/simplyrets/response.rb +0 -156
- data/lib/simplyrets/simplyrets/version.rb +0 -5
- data/simplyrets-1.0.6.gem +0 -0
@@ -1,28 +1,49 @@
|
|
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 MlsInformation
|
4
|
-
|
5
|
-
|
16
|
+
# RETS MLS Vendor Data
|
17
|
+
class MlsInformation
|
18
|
+
# MLS Status Code. Compliant with data dictionary v1.3 ListingStatus\nListing statuses depend on your MLS's availability. Below is\na brief description of each status with possible synonyms which\nmay map to your MLS-specific statuses\n- Active: Active Listing which is still on the market\n- ActiveUnderContract: An offer has been accepted but the listing is still on market. Synonyms: Accepting Backup Offers, Backup Offer, Active With Accepted. Synonyms: Offer, Backup, Contingent\n- Pending: An offer has been accepted and the listing is no longer on market. Synonyms: Offer Accepted, Under Contract\n- Hold: The listing has been withdrawn from the market, but a contract\n still exists between the seller and the listing member. Synonyms: Hold, Hold Do Not Show, Temp Off Market\n- Withdrawn: The listing has been withdrawn from the market, but a contract\n still exists between the seller and the listing member. Synonyms: Hold, Hold Do Not Show, Temp Off Market\n- Closed: The purchase agreement has been fulfilled or the lease\n agreement has been executed. Synonyms: Sold, Leased, Rented, Closed Sale\n- Expired: The listing contract has expired\n- Delete: The listing contract was never valid or other reason for the contract to be nullified. Synonyms: Kill, Zap\n- Incomplete: The listing has not yet be completely entered and is not yet\n published in the MLS. Synonyms: Draft, Partially Complted\n- ComingSoon\n
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# MLS Area. Generally a subdivision or community name.
|
22
|
+
attr_accessor :area
|
23
|
+
|
24
|
+
# Amount of days the property has been Active
|
25
|
+
attr_accessor :days_on_market
|
26
|
+
|
27
|
+
# Alias for the listing office or brokerage
|
28
|
+
attr_accessor :serving_name
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
31
|
def self.attribute_map
|
7
32
|
{
|
8
33
|
|
9
|
-
# MLS Status Code. Compliant with data dictionary v1.3 ListingStatus
|
10
34
|
:'status' => :'status',
|
11
35
|
|
12
|
-
# MLS Area. Generally a subdivision or community name.
|
13
36
|
:'area' => :'area',
|
14
37
|
|
15
|
-
# Amount of days the property has been Active
|
16
38
|
:'days_on_market' => :'daysOnMarket',
|
17
39
|
|
18
|
-
# Alias for the listing office or brokerage
|
19
40
|
:'serving_name' => :'servingName'
|
20
41
|
|
21
42
|
}
|
22
43
|
end
|
23
44
|
|
24
|
-
#
|
25
|
-
def self.
|
45
|
+
# Attribute type mapping.
|
46
|
+
def self.swagger_types
|
26
47
|
{
|
27
48
|
:'status' => :'String',
|
28
49
|
:'area' => :'String',
|
@@ -33,7 +54,7 @@ module SimplyRetsClient
|
|
33
54
|
end
|
34
55
|
|
35
56
|
def initialize(attributes = {})
|
36
|
-
return
|
57
|
+
return unless attributes.is_a?(Hash)
|
37
58
|
|
38
59
|
# convert string to symbol for hash key
|
39
60
|
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
@@ -57,13 +78,128 @@ module SimplyRetsClient
|
|
57
78
|
|
58
79
|
end
|
59
80
|
|
81
|
+
# Custom attribute writer method checking allowed values (enum).
|
60
82
|
def status=(status)
|
61
|
-
allowed_values = ["Active", "ActiveUnderContract", "Pending", "Hold", "Withdrawn", "Closed", "Expired", "
|
83
|
+
allowed_values = ["Active", "ActiveUnderContract (Backup-Offer)", "Pending", "Hold", "Withdrawn", "Closed", "Expired", "Delete", "Incomplete", "ComingSoon"]
|
62
84
|
if status && !allowed_values.include?(status)
|
63
85
|
fail "invalid value for 'status', must be one of #{allowed_values}"
|
64
86
|
end
|
65
87
|
@status = status
|
66
88
|
end
|
67
89
|
|
90
|
+
# Check equality by comparing each attribute.
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
status == o.status &&
|
95
|
+
area == o.area &&
|
96
|
+
days_on_market == o.days_on_market &&
|
97
|
+
serving_name == o.serving_name
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
def eql?(o)
|
102
|
+
self == o
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calculate hash code according to all attributes.
|
106
|
+
def hash
|
107
|
+
[status, area, days_on_market, serving_name].hash
|
108
|
+
end
|
109
|
+
|
110
|
+
# build the object from hash
|
111
|
+
def build_from_hash(attributes)
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
113
|
+
self.class.swagger_types.each_pair do |key, type|
|
114
|
+
if type =~ /^Array<(.*)>/i
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
117
|
+
else
|
118
|
+
#TODO show warning in debug mode
|
119
|
+
end
|
120
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
+
else
|
123
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :BOOLEAN
|
143
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
_model = SimplyRetsClient.const_get(type).new
|
164
|
+
_model.build_from_hash(value)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_body (backward compatibility))
|
173
|
+
def to_body
|
174
|
+
to_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# return the object in the form of hash
|
178
|
+
def to_hash
|
179
|
+
hash = {}
|
180
|
+
self.class.attribute_map.each_pair do |attr, param|
|
181
|
+
value = self.send(attr)
|
182
|
+
next if value.nil?
|
183
|
+
hash[param] = _to_hash(value)
|
184
|
+
end
|
185
|
+
hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Method to output non-array value in the form of hash
|
189
|
+
# For object, use to_hash. Otherwise, just return the value
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map{ |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
68
204
|
end
|
69
205
|
end
|
@@ -1,28 +1,49 @@
|
|
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 Office
|
4
|
-
|
5
|
-
|
16
|
+
# RETS MLS Office
|
17
|
+
class Office
|
18
|
+
# Associated contact details for the office. The availability of this\ninformation depends on your MLS rules and regulations\n
|
19
|
+
attr_accessor :contact
|
20
|
+
|
21
|
+
# Pimary office name
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
# Primary office or brokerage name
|
25
|
+
attr_accessor :serving_name
|
26
|
+
|
27
|
+
# Office or brokerage MLS identifier\n\n**Not available for all RETS vendors**\n
|
28
|
+
attr_accessor :brokerid
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
31
|
def self.attribute_map
|
7
32
|
{
|
8
33
|
|
9
|
-
#
|
10
34
|
:'contact' => :'contact',
|
11
35
|
|
12
|
-
# Pimary office name
|
13
36
|
:'name' => :'name',
|
14
37
|
|
15
|
-
# Primary office or brokerage name
|
16
38
|
:'serving_name' => :'servingName',
|
17
39
|
|
18
|
-
# Office or brokerage MLS identifier
|
19
40
|
:'brokerid' => :'brokerid'
|
20
41
|
|
21
42
|
}
|
22
43
|
end
|
23
44
|
|
24
|
-
#
|
25
|
-
def self.
|
45
|
+
# Attribute type mapping.
|
46
|
+
def self.swagger_types
|
26
47
|
{
|
27
48
|
:'contact' => :'ContactInformation',
|
28
49
|
:'name' => :'String',
|
@@ -33,7 +54,7 @@ module SimplyRetsClient
|
|
33
54
|
end
|
34
55
|
|
35
56
|
def initialize(attributes = {})
|
36
|
-
return
|
57
|
+
return unless attributes.is_a?(Hash)
|
37
58
|
|
38
59
|
# convert string to symbol for hash key
|
39
60
|
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
@@ -57,5 +78,119 @@ module SimplyRetsClient
|
|
57
78
|
|
58
79
|
end
|
59
80
|
|
81
|
+
# Check equality by comparing each attribute.
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
contact == o.contact &&
|
86
|
+
name == o.name &&
|
87
|
+
serving_name == o.serving_name &&
|
88
|
+
brokerid == o.brokerid
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
def eql?(o)
|
93
|
+
self == o
|
94
|
+
end
|
95
|
+
|
96
|
+
# Calculate hash code according to all attributes.
|
97
|
+
def hash
|
98
|
+
[contact, name, serving_name, brokerid].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# build the object from hash
|
102
|
+
def build_from_hash(attributes)
|
103
|
+
return nil unless attributes.is_a?(Hash)
|
104
|
+
self.class.swagger_types.each_pair do |key, type|
|
105
|
+
if type =~ /^Array<(.*)>/i
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
108
|
+
else
|
109
|
+
#TODO show warning in debug mode
|
110
|
+
end
|
111
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
+
else
|
114
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
self
|
119
|
+
end
|
120
|
+
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(value)
|
125
|
+
when :Date
|
126
|
+
Date.parse(value)
|
127
|
+
when :String
|
128
|
+
value.to_s
|
129
|
+
when :Integer
|
130
|
+
value.to_i
|
131
|
+
when :Float
|
132
|
+
value.to_f
|
133
|
+
when :BOOLEAN
|
134
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
135
|
+
true
|
136
|
+
else
|
137
|
+
false
|
138
|
+
end
|
139
|
+
when :Object
|
140
|
+
# generic object (usually a Hash), return directly
|
141
|
+
value
|
142
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
143
|
+
inner_type = Regexp.last_match[:inner_type]
|
144
|
+
value.map { |v| _deserialize(inner_type, v) }
|
145
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
146
|
+
k_type = Regexp.last_match[:k_type]
|
147
|
+
v_type = Regexp.last_match[:v_type]
|
148
|
+
{}.tap do |hash|
|
149
|
+
value.each do |k, v|
|
150
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else # model
|
154
|
+
_model = SimplyRetsClient.const_get(type).new
|
155
|
+
_model.build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def to_s
|
160
|
+
to_hash.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
# to_body is an alias to to_body (backward compatibility))
|
164
|
+
def to_body
|
165
|
+
to_hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# return the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Method to output non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
def _to_hash(value)
|
182
|
+
if value.is_a?(Array)
|
183
|
+
value.compact.map{ |v| _to_hash(v) }
|
184
|
+
elsif value.is_a?(Hash)
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
187
|
+
end
|
188
|
+
elsif value.respond_to? :to_hash
|
189
|
+
value.to_hash
|
190
|
+
else
|
191
|
+
value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
60
195
|
end
|
61
196
|
end
|
@@ -1,36 +1,239 @@
|
|
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 OpenHouse
|
4
|
-
|
5
|
-
|
16
|
+
# SimplyRETS Open House object
|
17
|
+
class OpenHouse
|
18
|
+
# Provided
|
19
|
+
attr_accessor :refreshments
|
20
|
+
|
21
|
+
# The full listing associated with the OpenHouse
|
22
|
+
attr_accessor :listing
|
23
|
+
|
24
|
+
# Start Date for the open house
|
25
|
+
attr_accessor :start_time
|
26
|
+
|
27
|
+
# A unique identifier for the open house which is specific to the\nSimplyRETS API\n
|
28
|
+
attr_accessor :open_house_key
|
29
|
+
|
30
|
+
# The ending date time for the open house
|
31
|
+
attr_accessor :end_time
|
32
|
+
|
33
|
+
# The MLS number or id provided by the MLS\n
|
34
|
+
attr_accessor :open_house_id
|
35
|
+
|
36
|
+
# The open house type. For example, Public or Private
|
37
|
+
attr_accessor :type
|
38
|
+
|
39
|
+
# The remarks and/or description details for the open house
|
40
|
+
attr_accessor :description
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
43
|
def self.attribute_map
|
7
44
|
{
|
8
45
|
|
9
|
-
|
10
|
-
|
46
|
+
:'refreshments' => :'refreshments',
|
47
|
+
|
48
|
+
:'listing' => :'listing',
|
49
|
+
|
50
|
+
:'start_time' => :'startTime',
|
51
|
+
|
52
|
+
:'open_house_key' => :'openHouseKey',
|
53
|
+
|
54
|
+
:'end_time' => :'endTime',
|
55
|
+
|
56
|
+
:'open_house_id' => :'openHouseId',
|
57
|
+
|
58
|
+
:'type' => :'type',
|
59
|
+
|
60
|
+
:'description' => :'description'
|
11
61
|
|
12
62
|
}
|
13
63
|
end
|
14
64
|
|
15
|
-
#
|
16
|
-
def self.
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.swagger_types
|
17
67
|
{
|
18
|
-
:'
|
68
|
+
:'refreshments' => :'String',
|
69
|
+
:'listing' => :'Listing',
|
70
|
+
:'start_time' => :'DateTime',
|
71
|
+
:'open_house_key' => :'String',
|
72
|
+
:'end_time' => :'DateTime',
|
73
|
+
:'open_house_id' => :'String',
|
74
|
+
:'type' => :'String',
|
75
|
+
:'description' => :'String'
|
19
76
|
|
20
77
|
}
|
21
78
|
end
|
22
79
|
|
23
80
|
def initialize(attributes = {})
|
24
|
-
return
|
81
|
+
return unless attributes.is_a?(Hash)
|
25
82
|
|
26
83
|
# convert string to symbol for hash key
|
27
84
|
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
28
85
|
|
29
86
|
|
30
|
-
if attributes[:'
|
31
|
-
self.
|
87
|
+
if attributes[:'refreshments']
|
88
|
+
self.refreshments = attributes[:'refreshments']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes[:'listing']
|
92
|
+
self.listing = attributes[:'listing']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes[:'startTime']
|
96
|
+
self.start_time = attributes[:'startTime']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes[:'openHouseKey']
|
100
|
+
self.open_house_key = attributes[:'openHouseKey']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes[:'endTime']
|
104
|
+
self.end_time = attributes[:'endTime']
|
32
105
|
end
|
33
106
|
|
107
|
+
if attributes[:'openHouseId']
|
108
|
+
self.open_house_id = attributes[:'openHouseId']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes[:'type']
|
112
|
+
self.type = attributes[:'type']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes[:'description']
|
116
|
+
self.description = attributes[:'description']
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
# Check equality by comparing each attribute.
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
refreshments == o.refreshments &&
|
126
|
+
listing == o.listing &&
|
127
|
+
start_time == o.start_time &&
|
128
|
+
open_house_key == o.open_house_key &&
|
129
|
+
end_time == o.end_time &&
|
130
|
+
open_house_id == o.open_house_id &&
|
131
|
+
type == o.type &&
|
132
|
+
description == o.description
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
def eql?(o)
|
137
|
+
self == o
|
138
|
+
end
|
139
|
+
|
140
|
+
# Calculate hash code according to all attributes.
|
141
|
+
def hash
|
142
|
+
[refreshments, listing, start_time, open_house_key, end_time, open_house_id, type, description].hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# build the object from hash
|
146
|
+
def build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
self.class.swagger_types.each_pair do |key, type|
|
149
|
+
if type =~ /^Array<(.*)>/i
|
150
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
151
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
152
|
+
else
|
153
|
+
#TODO show warning in debug mode
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
+
else
|
158
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
def _deserialize(type, value)
|
166
|
+
case type.to_sym
|
167
|
+
when :DateTime
|
168
|
+
DateTime.parse(value)
|
169
|
+
when :Date
|
170
|
+
Date.parse(value)
|
171
|
+
when :String
|
172
|
+
value.to_s
|
173
|
+
when :Integer
|
174
|
+
value.to_i
|
175
|
+
when :Float
|
176
|
+
value.to_f
|
177
|
+
when :BOOLEAN
|
178
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
179
|
+
true
|
180
|
+
else
|
181
|
+
false
|
182
|
+
end
|
183
|
+
when :Object
|
184
|
+
# generic object (usually a Hash), return directly
|
185
|
+
value
|
186
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
187
|
+
inner_type = Regexp.last_match[:inner_type]
|
188
|
+
value.map { |v| _deserialize(inner_type, v) }
|
189
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
190
|
+
k_type = Regexp.last_match[:k_type]
|
191
|
+
v_type = Regexp.last_match[:v_type]
|
192
|
+
{}.tap do |hash|
|
193
|
+
value.each do |k, v|
|
194
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
else # model
|
198
|
+
_model = SimplyRetsClient.const_get(type).new
|
199
|
+
_model.build_from_hash(value)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def to_s
|
204
|
+
to_hash.to_s
|
205
|
+
end
|
206
|
+
|
207
|
+
# to_body is an alias to to_body (backward compatibility))
|
208
|
+
def to_body
|
209
|
+
to_hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# return the object in the form of hash
|
213
|
+
def to_hash
|
214
|
+
hash = {}
|
215
|
+
self.class.attribute_map.each_pair do |attr, param|
|
216
|
+
value = self.send(attr)
|
217
|
+
next if value.nil?
|
218
|
+
hash[param] = _to_hash(value)
|
219
|
+
end
|
220
|
+
hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Method to output non-array value in the form of hash
|
224
|
+
# For object, use to_hash. Otherwise, just return the value
|
225
|
+
def _to_hash(value)
|
226
|
+
if value.is_a?(Array)
|
227
|
+
value.compact.map{ |v| _to_hash(v) }
|
228
|
+
elsif value.is_a?(Hash)
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
231
|
+
end
|
232
|
+
elsif value.respond_to? :to_hash
|
233
|
+
value.to_hash
|
234
|
+
else
|
235
|
+
value
|
236
|
+
end
|
34
237
|
end
|
35
238
|
|
36
239
|
end
|