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,90 +1,268 @@
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 StreetAddress < BaseObject
4
- attr_accessor :country, :postal_code, :street_name, :city, :street_number, :full, :cross_street, :state
5
- # attribute mapping from ruby-style variable name to JSON key
16
+ # RETS MLS Street Address
17
+ class StreetAddress
18
+ # Known cross street
19
+ attr_accessor :cross_street
20
+
21
+ # State or province. Maps to the data dictionary field `StateOrProvince`.
22
+ attr_accessor :state
23
+
24
+ # Street address country (United States or Canada)
25
+ attr_accessor :country
26
+
27
+ # Street Address postal code
28
+ attr_accessor :postal_code
29
+
30
+ # Name of the street
31
+ attr_accessor :street_name
32
+
33
+ # Textual representation of the street number. This field\nis usually redundant with what's in `streetNumber` but is\noccassionally usefuly for street number which are actually\nalpha-numerical. For example, \"N63453\" or \"34556B\".\n\n**Added on 2016/05/02**\n
34
+ attr_accessor :street_number_text
35
+
36
+ # City name
37
+ attr_accessor :city
38
+
39
+ # Street number
40
+ attr_accessor :street_number
41
+
42
+ # Full pretty-printed address with suffix (if available)
43
+ attr_accessor :full
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
6
46
  def self.attribute_map
7
47
  {
8
48
 
9
- # Street address country (United States or Canada)
49
+ :'cross_street' => :'crossStreet',
50
+
51
+ :'state' => :'state',
52
+
10
53
  :'country' => :'country',
11
54
 
12
- # Street Address postal code
13
55
  :'postal_code' => :'postalCode',
14
56
 
15
- # Name of the street
16
57
  :'street_name' => :'streetName',
17
58
 
18
- # City name
59
+ :'street_number_text' => :'streetNumberText',
60
+
19
61
  :'city' => :'city',
20
62
 
21
- # Street number
22
63
  :'street_number' => :'streetNumber',
23
64
 
24
- # Full pretty-printed address with suffix (if available)
25
- :'full' => :'full',
26
-
27
- # Known cross street
28
- :'cross_street' => :'crossStreet',
65
+ :'full' => :'full'
29
66
 
30
- # state or province
31
- :'state' => :'state'
32
67
  }
33
68
  end
34
69
 
35
- # attribute type
36
- def self.simplyrets_types
70
+ # Attribute type mapping.
71
+ def self.swagger_types
37
72
  {
73
+ :'cross_street' => :'String',
74
+ :'state' => :'String',
38
75
  :'country' => :'String',
39
76
  :'postal_code' => :'String',
40
77
  :'street_name' => :'String',
78
+ :'street_number_text' => :'String',
41
79
  :'city' => :'String',
42
80
  :'street_number' => :'Integer',
43
- :'full' => :'String',
44
- :'cross_street' => :'String',
45
- :'state' => :'String'
81
+ :'full' => :'String'
82
+
46
83
  }
47
84
  end
48
85
 
49
86
  def initialize(attributes = {})
50
- return if !attributes.is_a?(Hash) || attributes.empty?
87
+ return unless attributes.is_a?(Hash)
51
88
 
52
89
  # convert string to symbol for hash key
53
90
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
54
91
 
55
92
 
93
+ if attributes[:'crossStreet']
94
+ self.cross_street = attributes[:'crossStreet']
95
+ else
96
+ self.cross_street = "456 Cross Rd"
97
+ end
98
+
99
+ if attributes[:'state']
100
+ self.state = attributes[:'state']
101
+ else
102
+ self.state = "Texas"
103
+ end
104
+
56
105
  if attributes[:'country']
57
106
  self.country = attributes[:'country']
107
+ else
108
+ self.country = "United States"
58
109
  end
59
110
 
60
111
  if attributes[:'postalCode']
61
112
  self.postal_code = attributes[:'postalCode']
113
+ else
114
+ self.postal_code = "77324"
62
115
  end
63
116
 
64
117
  if attributes[:'streetName']
65
118
  self.street_name = attributes[:'streetName']
119
+ else
120
+ self.street_name = "SimplyRETS Drive"
121
+ end
122
+
123
+ if attributes[:'streetNumberText']
124
+ self.street_number_text = attributes[:'streetNumberText']
125
+ else
126
+ self.street_number_text = "1234"
66
127
  end
67
128
 
68
129
  if attributes[:'city']
69
130
  self.city = attributes[:'city']
131
+ else
132
+ self.city = "Houston"
70
133
  end
71
134
 
72
135
  if attributes[:'streetNumber']
73
136
  self.street_number = attributes[:'streetNumber']
137
+ else
138
+ self.street_number = 1234
74
139
  end
75
140
 
76
141
  if attributes[:'full']
77
142
  self.full = attributes[:'full']
143
+ else
144
+ self.full = "1234 SimplyRETS Drive"
78
145
  end
79
146
 
80
- if attributes[:'crossStreet']
81
- self.cross_street = attributes[:'crossStreet']
147
+ end
148
+
149
+ # Check equality by comparing each attribute.
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ cross_street == o.cross_street &&
154
+ state == o.state &&
155
+ country == o.country &&
156
+ postal_code == o.postal_code &&
157
+ street_name == o.street_name &&
158
+ street_number_text == o.street_number_text &&
159
+ city == o.city &&
160
+ street_number == o.street_number &&
161
+ full == o.full
162
+ end
163
+
164
+ # @see the `==` method
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculate hash code according to all attributes.
170
+ def hash
171
+ [cross_street, state, country, postal_code, street_name, street_number_text, city, street_number, full].hash
172
+ end
173
+
174
+ # build the object from hash
175
+ def build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ self.class.swagger_types.each_pair do |key, type|
178
+ if type =~ /^Array<(.*)>/i
179
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
180
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
181
+ else
182
+ #TODO show warning in debug mode
183
+ end
184
+ elsif !attributes[self.class.attribute_map[key]].nil?
185
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
+ else
187
+ # data not found in attributes(hash), not an issue as the data can be optional
188
+ end
82
189
  end
83
190
 
84
- if attributes[:'state']
85
- self.state = attributes[:'state']
191
+ self
192
+ end
193
+
194
+ def _deserialize(type, value)
195
+ case type.to_sym
196
+ when :DateTime
197
+ DateTime.parse(value)
198
+ when :Date
199
+ Date.parse(value)
200
+ when :String
201
+ value.to_s
202
+ when :Integer
203
+ value.to_i
204
+ when :Float
205
+ value.to_f
206
+ when :BOOLEAN
207
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
208
+ true
209
+ else
210
+ false
211
+ end
212
+ when :Object
213
+ # generic object (usually a Hash), return directly
214
+ value
215
+ when /\AArray<(?<inner_type>.+)>\z/
216
+ inner_type = Regexp.last_match[:inner_type]
217
+ value.map { |v| _deserialize(inner_type, v) }
218
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
219
+ k_type = Regexp.last_match[:k_type]
220
+ v_type = Regexp.last_match[:v_type]
221
+ {}.tap do |hash|
222
+ value.each do |k, v|
223
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
224
+ end
225
+ end
226
+ else # model
227
+ _model = SimplyRetsClient.const_get(type).new
228
+ _model.build_from_hash(value)
229
+ end
230
+ end
231
+
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_body (backward compatibility))
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # return the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ next if value.nil?
247
+ hash[param] = _to_hash(value)
86
248
  end
249
+ hash
250
+ end
87
251
 
252
+ # Method to output non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map{ |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
88
266
  end
89
267
 
90
268
  end
@@ -1,53 +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 Tax < BaseObject
4
- attr_accessor :id, :annual_amount, :year
5
- # attribute mapping from ruby-style variable name to JSON key
16
+ # RETS MLS Tax Data
17
+ class Tax
18
+ # Tax Year
19
+ attr_accessor :year
20
+
21
+ # Annual tax amount in USD
22
+ attr_accessor :annual_amount
23
+
24
+ # Tax Parcel ID for the listing
25
+ attr_accessor :id
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
6
28
  def self.attribute_map
7
29
  {
8
30
 
9
- # Tax Parcel ID for the listing
10
- :'id' => :'id',
31
+ :'year' => :'year',
11
32
 
12
- # Annual tax amount in USD
13
33
  :'annual_amount' => :'annualAmount',
14
34
 
15
- # Tax Year
16
- :'year' => :'year'
35
+ :'id' => :'id'
17
36
 
18
37
  }
19
38
  end
20
39
 
21
- # attribute type
22
- def self.simplyrets_types
40
+ # Attribute type mapping.
41
+ def self.swagger_types
23
42
  {
24
- :'id' => :'String',
43
+ :'year' => :'Integer',
25
44
  :'annual_amount' => :'String',
26
- :'year' => :'Integer'
45
+ :'id' => :'String'
27
46
 
28
47
  }
29
48
  end
30
49
 
31
50
  def initialize(attributes = {})
32
- return if !attributes.is_a?(Hash) || attributes.empty?
51
+ return unless attributes.is_a?(Hash)
33
52
 
34
53
  # convert string to symbol for hash key
35
54
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
55
 
37
56
 
38
- if attributes[:'id']
39
- self.id = attributes[:'id']
57
+ if attributes[:'year']
58
+ self.year = attributes[:'year']
40
59
  end
41
60
 
42
61
  if attributes[:'annualAmount']
43
62
  self.annual_amount = attributes[:'annualAmount']
44
63
  end
45
64
 
46
- if attributes[:'year']
47
- self.year = attributes[:'year']
65
+ if attributes[:'id']
66
+ self.id = attributes[:'id']
48
67
  end
49
68
 
50
69
  end
51
70
 
71
+ # Check equality by comparing each attribute.
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ year == o.year &&
76
+ annual_amount == o.annual_amount &&
77
+ id == o.id
78
+ end
79
+
80
+ # @see the `==` method
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculate hash code according to all attributes.
86
+ def hash
87
+ [year, annual_amount, id].hash
88
+ end
89
+
90
+ # build the object from hash
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /^Array<(.*)>/i
95
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
96
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
97
+ else
98
+ #TODO show warning in debug mode
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ else
103
+ # data not found in attributes(hash), not an issue as the data can be optional
104
+ end
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ def _deserialize(type, value)
111
+ case type.to_sym
112
+ when :DateTime
113
+ DateTime.parse(value)
114
+ when :Date
115
+ Date.parse(value)
116
+ when :String
117
+ value.to_s
118
+ when :Integer
119
+ value.to_i
120
+ when :Float
121
+ value.to_f
122
+ when :BOOLEAN
123
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
124
+ true
125
+ else
126
+ false
127
+ end
128
+ when :Object
129
+ # generic object (usually a Hash), return directly
130
+ value
131
+ when /\AArray<(?<inner_type>.+)>\z/
132
+ inner_type = Regexp.last_match[:inner_type]
133
+ value.map { |v| _deserialize(inner_type, v) }
134
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
135
+ k_type = Regexp.last_match[:k_type]
136
+ v_type = Regexp.last_match[:v_type]
137
+ {}.tap do |hash|
138
+ value.each do |k, v|
139
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
140
+ end
141
+ end
142
+ else # model
143
+ _model = SimplyRetsClient.const_get(type).new
144
+ _model.build_from_hash(value)
145
+ end
146
+ end
147
+
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_body (backward compatibility))
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # return the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Method to output non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ def _to_hash(value)
171
+ if value.is_a?(Array)
172
+ value.compact.map{ |v| _to_hash(v) }
173
+ elsif value.is_a?(Hash)
174
+ {}.tap do |hash|
175
+ value.each { |k, v| hash[k] = _to_hash(v) }
176
+ end
177
+ elsif value.respond_to? :to_hash
178
+ value.to_hash
179
+ else
180
+ value
181
+ end
182
+ end
183
+
52
184
  end
53
185
  end