simplyrets 0.1 → 1.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 +46 -13
- data/README.org +6 -6
- data/example.rb +9 -9
- data/lib/simplyrets.rb +33 -56
- data/lib/simplyrets/#listing.rb# +199 -0
- data/lib/simplyrets/api/default_api.rb +154 -0
- data/lib/simplyrets/listing.rb~ +199 -0
- data/lib/simplyrets/models/agent.rb +61 -0
- data/lib/simplyrets/models/base_object.rb +87 -0
- data/lib/simplyrets/models/broker.rb +37 -0
- data/lib/simplyrets/models/contact_information.rb +53 -0
- data/lib/simplyrets/models/error.rb +45 -0
- data/lib/simplyrets/models/geographic_data.rb +69 -0
- data/lib/simplyrets/models/listing.rb +199 -0
- data/lib/simplyrets/models/listing.rb~ +199 -0
- data/lib/simplyrets/models/mls_information.rb +69 -0
- data/lib/simplyrets/models/office.rb +61 -0
- data/lib/simplyrets/models/open_house.rb +37 -0
- data/lib/simplyrets/models/parking.rb +53 -0
- data/lib/simplyrets/models/property.rb +277 -0
- data/lib/simplyrets/models/sales.rb +69 -0
- data/lib/simplyrets/models/school.rb +61 -0
- data/lib/simplyrets/models/street_address.rb +85 -0
- data/lib/simplyrets/models/tax.rb +53 -0
- data/lib/simplyrets/simplyrets.rb +76 -0
- data/lib/simplyrets/simplyrets/api_error.rb +26 -0
- data/lib/simplyrets/simplyrets/configuration.rb +101 -0
- data/lib/simplyrets/simplyrets/request.rb +213 -0
- data/lib/simplyrets/simplyrets/response.rb +156 -0
- data/lib/simplyrets/simplyrets/version.rb +5 -0
- data/simplyrets.gemspec +16 -9
- metadata +153 -36
- data/#example.rb# +0 -29
- data/lib/monkey.rb +0 -90
- data/lib/properties_api.rb +0 -75
- data/lib/simplyrets.rb~ +0 -85
- data/lib/simplyrets/configuration.rb +0 -25
- data/lib/simplyrets/request.rb +0 -205
- data/lib/simplyrets/response.rb +0 -70
- data/lib/simplyrets/version.rb +0 -4
- data/models/agent.rb +0 -39
- data/models/contactinformation.rb +0 -36
- data/models/geographicdata.rb +0 -43
- data/models/listing.rb +0 -95
- data/models/mlsinformation.rb +0 -35
- data/models/office.rb +0 -39
- data/models/property.rb +0 -84
- data/models/school.rb +0 -27
- data/models/streetaddress.rb +0 -47
- data/models/tax.rb +0 -28
- data/pkg/simplyrets-0.1.gem +0 -0
data/lib/simplyrets/response.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
module SimplyRets
|
2
|
-
|
3
|
-
class Response
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
attr_accessor :raw
|
7
|
-
|
8
|
-
def initialize(raw)
|
9
|
-
self.raw = raw
|
10
|
-
|
11
|
-
case self.code
|
12
|
-
when 500..510 then raise(ServerError, self.error_message)
|
13
|
-
when 299..426 then raise(ClientError, self.error_message)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def code
|
18
|
-
raw.code
|
19
|
-
end
|
20
|
-
|
21
|
-
# Account for error messages that take different forms...
|
22
|
-
def error_message
|
23
|
-
body['message']
|
24
|
-
rescue
|
25
|
-
body
|
26
|
-
end
|
27
|
-
|
28
|
-
# If body is JSON, parse it
|
29
|
-
# Otherwise return raw string
|
30
|
-
def body
|
31
|
-
JSON.parse raw.body
|
32
|
-
rescue
|
33
|
-
raw.body
|
34
|
-
end
|
35
|
-
|
36
|
-
# `headers_hash` is a Typhoeus-specific extension of Hash,
|
37
|
-
# so simplify it back into a regular old Hash.
|
38
|
-
def headers
|
39
|
-
h = {}
|
40
|
-
raw.headers_hash.each {|k,v| h[k] = v }
|
41
|
-
h
|
42
|
-
end
|
43
|
-
|
44
|
-
# Extract the response format from the header hash
|
45
|
-
# e.g. {'Content-Type' => 'application/json'}
|
46
|
-
def format
|
47
|
-
headers['Content-Type'].split("/").last.downcase
|
48
|
-
end
|
49
|
-
|
50
|
-
def json?
|
51
|
-
format == 'json'
|
52
|
-
end
|
53
|
-
|
54
|
-
def xml?
|
55
|
-
format == 'xml'
|
56
|
-
end
|
57
|
-
|
58
|
-
def pretty_body
|
59
|
-
return unless body.present?
|
60
|
-
case format
|
61
|
-
when 'json' then JSON.pretty_generate(body).gsub(/\n/, '<br/>')
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def pretty_headers
|
66
|
-
JSON.pretty_generate(headers).gsub(/\n/, '<br/>')
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
data/lib/simplyrets/version.rb
DELETED
data/models/agent.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
class Agent
|
2
|
-
attr_accessor :last_name, :contact, :first_name, :id
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:last_name => :lastName,
|
8
|
-
:contact => :contact,
|
9
|
-
:first_name => :firstName,
|
10
|
-
:id => :id
|
11
|
-
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(attributes = {})
|
16
|
-
return if attributes.empty?
|
17
|
-
# Morph attribute keys into undescored rubyish style
|
18
|
-
if self.class.attribute_map[:"last_name"]
|
19
|
-
@last_name = attributes["lastName"]
|
20
|
-
end
|
21
|
-
if self.class.attribute_map[:"contact"]
|
22
|
-
@contact = attributes["contact"]
|
23
|
-
end
|
24
|
-
if self.class.attribute_map[:"first_name"]
|
25
|
-
@first_name = attributes["firstName"]
|
26
|
-
end
|
27
|
-
if self.class.attribute_map[:"id"]
|
28
|
-
@id = attributes["id"]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_body
|
33
|
-
body = {}
|
34
|
-
self.class.attribute_map.each_pair do |key, value|
|
35
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
36
|
-
end
|
37
|
-
body
|
38
|
-
end
|
39
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
class ContactInformation
|
2
|
-
attr_accessor :office, :cell, :full
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:office => :office,
|
8
|
-
:cell => :cell,
|
9
|
-
:full => :full
|
10
|
-
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(attributes = {})
|
15
|
-
return if attributes.empty?
|
16
|
-
# Morph attribute keys into undescored rubyish style
|
17
|
-
if self.class.attribute_map[:"office"]
|
18
|
-
@office = attributes["office"]
|
19
|
-
end
|
20
|
-
if self.class.attribute_map[:"cell"]
|
21
|
-
@cell = attributes["cell"]
|
22
|
-
end
|
23
|
-
if self.class.attribute_map[:"full"]
|
24
|
-
@full = attributes["full"]
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_body
|
30
|
-
body = {}
|
31
|
-
self.class.attribute_map.each_pair do |key, value|
|
32
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
33
|
-
end
|
34
|
-
body
|
35
|
-
end
|
36
|
-
end
|
data/models/geographicdata.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
class GeographicData
|
2
|
-
attr_accessor :county, :lat, :lng, :market_area, :directions
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:county => :county,
|
8
|
-
:lat => :lat,
|
9
|
-
:lng => :lng,
|
10
|
-
:market_area => :marketArea,
|
11
|
-
:directions => :directions
|
12
|
-
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(attributes = {})
|
17
|
-
return if attributes.empty?
|
18
|
-
# Morph attribute keys into undescored rubyish style
|
19
|
-
if self.class.attribute_map[:"county"]
|
20
|
-
@county = attributes["county"]
|
21
|
-
end
|
22
|
-
if self.class.attribute_map[:"lat"]
|
23
|
-
@lat = attributes["lat"]
|
24
|
-
end
|
25
|
-
if self.class.attribute_map[:"lng"]
|
26
|
-
@lng = attributes["lng"]
|
27
|
-
end
|
28
|
-
if self.class.attribute_map[:"market_area"]
|
29
|
-
@market_area = attributes["marketArea"]
|
30
|
-
end
|
31
|
-
if self.class.attribute_map[:"directions"]
|
32
|
-
@directions = attributes["directions"]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def to_body
|
37
|
-
body = {}
|
38
|
-
self.class.attribute_map.each_pair do |key, value|
|
39
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
40
|
-
end
|
41
|
-
body
|
42
|
-
end
|
43
|
-
end
|
data/models/listing.rb
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
class Listing
|
2
|
-
attr_accessor :property, :mls_id, :showing_instructions, :office, :disclaimer, :address, :list_date, :agent, :modified, :school, :photos, :list_price, :listing_id, :mls, :geo, :tax, :remarks
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:property => :property,
|
8
|
-
:mls_id => :mlsId,
|
9
|
-
:showing_instructions => :showingInstructions,
|
10
|
-
:office => :office,
|
11
|
-
:disclaimer => :disclaimer,
|
12
|
-
:address => :address,
|
13
|
-
:list_date => :listDate,
|
14
|
-
:agent => :agent,
|
15
|
-
:modified => :modified,
|
16
|
-
:school => :school,
|
17
|
-
:photos => :photos,
|
18
|
-
:list_price => :listPrice,
|
19
|
-
:listing_id => :listingId,
|
20
|
-
:mls => :mls,
|
21
|
-
:geo => :geo,
|
22
|
-
:tax => :tax,
|
23
|
-
:remarks => :remarks
|
24
|
-
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
def initialize(attributes = {})
|
29
|
-
return if attributes.empty?
|
30
|
-
# Morph attribute keys into undescored rubyish style
|
31
|
-
if self.class.attribute_map[:"property"]
|
32
|
-
@property = attributes["property"]
|
33
|
-
end
|
34
|
-
if self.class.attribute_map[:"mls_id"]
|
35
|
-
@mls_id = attributes["mlsId"]
|
36
|
-
end
|
37
|
-
if self.class.attribute_map[:"showing_instructions"]
|
38
|
-
@showing_instructions = attributes["showingInstructions"]
|
39
|
-
end
|
40
|
-
if self.class.attribute_map[:"office"]
|
41
|
-
@office = attributes["office"]
|
42
|
-
end
|
43
|
-
if self.class.attribute_map[:"disclaimer"]
|
44
|
-
@disclaimer = attributes["disclaimer"]
|
45
|
-
end
|
46
|
-
if self.class.attribute_map[:"address"]
|
47
|
-
@address = attributes["address"]
|
48
|
-
end
|
49
|
-
if self.class.attribute_map[:"list_date"]
|
50
|
-
@list_date = attributes["listDate"]
|
51
|
-
end
|
52
|
-
if self.class.attribute_map[:"agent"]
|
53
|
-
@agent = attributes["agent"]
|
54
|
-
end
|
55
|
-
if self.class.attribute_map[:"modified"]
|
56
|
-
@modified = attributes["modified"]
|
57
|
-
end
|
58
|
-
if self.class.attribute_map[:"school"]
|
59
|
-
@school = attributes["school"]
|
60
|
-
end
|
61
|
-
if self.class.attribute_map[:"photos"]
|
62
|
-
if (value = attributes["photos"]).is_a?(Array)
|
63
|
-
@photos = value
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
if self.class.attribute_map[:"list_price"]
|
68
|
-
@list_price = attributes["listPrice"]
|
69
|
-
end
|
70
|
-
if self.class.attribute_map[:"listing_id"]
|
71
|
-
@listing_id = attributes["listingId"]
|
72
|
-
end
|
73
|
-
if self.class.attribute_map[:"mls"]
|
74
|
-
@mls = attributes["mls"]
|
75
|
-
end
|
76
|
-
if self.class.attribute_map[:"geo"]
|
77
|
-
@geo = attributes["geo"]
|
78
|
-
end
|
79
|
-
if self.class.attribute_map[:"tax"]
|
80
|
-
@tax = attributes["tax"]
|
81
|
-
end
|
82
|
-
if self.class.attribute_map[:"remarks"]
|
83
|
-
@remarks = attributes["remarks"]
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
def to_body
|
89
|
-
body = {}
|
90
|
-
self.class.attribute_map.each_pair do |key, value|
|
91
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
92
|
-
end
|
93
|
-
body
|
94
|
-
end
|
95
|
-
end
|
data/models/mlsinformation.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
class MlsInformation
|
2
|
-
attr_accessor :status, :area, :days_on_market
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:status => :status,
|
8
|
-
:area => :area,
|
9
|
-
:days_on_market => :daysOnMarket
|
10
|
-
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(attributes = {})
|
15
|
-
return if attributes.empty?
|
16
|
-
# Morph attribute keys into undescored rubyish style
|
17
|
-
if self.class.attribute_map[:"status"]
|
18
|
-
@status = attributes["status"]
|
19
|
-
end
|
20
|
-
if self.class.attribute_map[:"area"]
|
21
|
-
@area = attributes["area"]
|
22
|
-
end
|
23
|
-
if self.class.attribute_map[:"days_on_market"]
|
24
|
-
@days_on_market = attributes["daysOnMarket"]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_body
|
29
|
-
body = {}
|
30
|
-
self.class.attribute_map.each_pair do |key, value|
|
31
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
32
|
-
end
|
33
|
-
body
|
34
|
-
end
|
35
|
-
end
|
data/models/office.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
class Office
|
2
|
-
attr_accessor :contact, :name, :serving_name, :brokerid
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:contact => :contact,
|
8
|
-
:name => :name,
|
9
|
-
:serving_name => :servingName,
|
10
|
-
:brokerid => :brokerid
|
11
|
-
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize(attributes = {})
|
16
|
-
return if attributes.empty?
|
17
|
-
# Morph attribute keys into undescored rubyish style
|
18
|
-
if self.class.attribute_map[:"contact"]
|
19
|
-
@contact = attributes["contact"]
|
20
|
-
end
|
21
|
-
if self.class.attribute_map[:"name"]
|
22
|
-
@name = attributes["name"]
|
23
|
-
end
|
24
|
-
if self.class.attribute_map[:"serving_name"]
|
25
|
-
@serving_name = attributes["servingName"]
|
26
|
-
end
|
27
|
-
if self.class.attribute_map[:"brokerid"]
|
28
|
-
@brokerid = attributes["brokerid"]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_body
|
33
|
-
body = {}
|
34
|
-
self.class.attribute_map.each_pair do |key, value|
|
35
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
36
|
-
end
|
37
|
-
body
|
38
|
-
end
|
39
|
-
end
|
data/models/property.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
class Property
|
2
|
-
attr_accessor :roof, :style, :area, :baths_full, :baths_half, :stories, :fireplaces, :heating, :bedrooms, :interior_features, :lot_size, :exterior_features, :subdivision, :type, :year_built
|
3
|
-
|
4
|
-
# :internal => :external
|
5
|
-
def self.attribute_map
|
6
|
-
{
|
7
|
-
:roof => :roof,
|
8
|
-
:style => :style,
|
9
|
-
:area => :area,
|
10
|
-
:baths_full => :bathsFull,
|
11
|
-
:baths_half => :bathsHalf,
|
12
|
-
:stories => :stories,
|
13
|
-
:fireplaces => :fireplaces,
|
14
|
-
:heating => :heating,
|
15
|
-
:bedrooms => :bedrooms,
|
16
|
-
:interior_features => :interiorFeatures,
|
17
|
-
:lot_size => :lotSize,
|
18
|
-
:exterior_features => :exteriorFeatures,
|
19
|
-
:subdivision => :subdivision,
|
20
|
-
:type => :type,
|
21
|
-
:year_built => :yearBuilt
|
22
|
-
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def initialize(attributes = {})
|
27
|
-
return if attributes.empty?
|
28
|
-
# Morph attribute keys into undescored rubyish style
|
29
|
-
if self.class.attribute_map[:"roof"]
|
30
|
-
@roof = attributes["roof"]
|
31
|
-
end
|
32
|
-
if self.class.attribute_map[:"style"]
|
33
|
-
@style = attributes["style"]
|
34
|
-
end
|
35
|
-
if self.class.attribute_map[:"area"]
|
36
|
-
@area = attributes["area"]
|
37
|
-
end
|
38
|
-
if self.class.attribute_map[:"baths_full"]
|
39
|
-
@baths_full = attributes["bathsFull"]
|
40
|
-
end
|
41
|
-
if self.class.attribute_map[:"baths_half"]
|
42
|
-
@baths_half = attributes["bathsHalf"]
|
43
|
-
end
|
44
|
-
if self.class.attribute_map[:"stories"]
|
45
|
-
@stories = attributes["stories"]
|
46
|
-
end
|
47
|
-
if self.class.attribute_map[:"fireplaces"]
|
48
|
-
@fireplaces = attributes["fireplaces"]
|
49
|
-
end
|
50
|
-
if self.class.attribute_map[:"heating"]
|
51
|
-
@heating = attributes["heating"]
|
52
|
-
end
|
53
|
-
if self.class.attribute_map[:"bedrooms"]
|
54
|
-
@bedrooms = attributes["bedrooms"]
|
55
|
-
end
|
56
|
-
if self.class.attribute_map[:"interior_features"]
|
57
|
-
@interior_features = attributes["interiorFeatures"]
|
58
|
-
end
|
59
|
-
if self.class.attribute_map[:"lot_size"]
|
60
|
-
@lot_size = attributes["lotSize"]
|
61
|
-
end
|
62
|
-
if self.class.attribute_map[:"exterior_features"]
|
63
|
-
@exterior_features = attributes["exteriorFeatures"]
|
64
|
-
end
|
65
|
-
if self.class.attribute_map[:"subdivision"]
|
66
|
-
@subdivision = attributes["subdivision"]
|
67
|
-
end
|
68
|
-
if self.class.attribute_map[:"type"]
|
69
|
-
@type = attributes["type"]
|
70
|
-
end
|
71
|
-
if self.class.attribute_map[:"year_built"]
|
72
|
-
@year_built = attributes["yearBuilt"]
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
def to_body
|
78
|
-
body = {}
|
79
|
-
self.class.attribute_map.each_pair do |key, value|
|
80
|
-
body[value] = self.send(key) unless self.send(key).nil?
|
81
|
-
end
|
82
|
-
body
|
83
|
-
end
|
84
|
-
end
|