Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #5 from 42floors/awesomeness

Awesomeness
  • Loading branch information...
commit eb4e9752a01cb81294ee17f2e66403400b591138 2 parents b2016df + 5b6ab7f
@malomalo malomalo authored
View
2  .gitignore
@@ -5,3 +5,5 @@ pkg/*
.rvmrc
coverage
doc
+*#*
+*~
View
7 lib/mls.rb
@@ -24,7 +24,7 @@ class MLS
API_VERSION = '0.1.0'
attr_reader :url, :user_agent
- attr_writer :asset_host, :image_host, :listing_amenities, :address_amenities
+ attr_writer :asset_host, :image_host, :agent_profile, :listing_amenities, :address_amenities
attr_accessor :api_key, :auth_key, :logger
# Sets the API Token and Host of the MLS Server
@@ -72,6 +72,11 @@ def listing_amenities
.parse(MLS.get('/listings/amenities').body)
end
+ def agent_profile(id)
+ @agent_profile = Yajl::Parser.new(:symbolize_keys => true)
+ .parse(MLS.get("/agents/#{id}").body)
+ end
+
def address_amenities
@address_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
.parse(MLS.get('/addresses/amenities').body)
View
7 lib/mls/models/account.rb
@@ -26,6 +26,7 @@ class MLS::Account < MLS::Resource
property :created_at, DateTime, :serialize => :false
property :updated_at, DateTime, :serialize => :false
+ property :email_token, String, :serialize => false
property :auth_key, String, :serialize => false
exclude_from_comparison :password, :password_confirmation
@@ -66,7 +67,11 @@ def favorites
response = MLS.get('/account/favorites')
@favorites = MLS::Listing::Parser.parse_collection(response.body, {:collection_root_element => :favorites})
end
-
+
+ def agent_profile
+ @agent_profile ||= MLS.agent_profile id
+ end
+
def favorited?(listing)
favorites.include?(listing)
end
View
13 lib/mls/models/listing.rb
@@ -35,6 +35,8 @@ class MLS::Listing < MLS::Resource
property :lease_terms, String
property :rate, Decimal
property :rate_units, String, :default => '/sqft/mo'
+ property :low_rate, Decimal, :serialize => :false
+ property :high_rate, Decimal, :serialize => :false
property :rate_per_sqft_per_month, Decimal, :serialize => :false # need to make write methods for these that set rate to the according rate units. not accepted on api
property :rate_per_sqft_per_year, Decimal, :serialize => :false
property :rate_per_month, Decimal, :serialize => :false
@@ -65,9 +67,14 @@ class MLS::Listing < MLS::Resource
property :created_at, DateTime, :serialize => :false
property :updated_at, DateTime, :serialize => :false
- property :touched_at, DateTime, :serialize => :false
+ property :touched_at, DateTime, :serialize => :false
property :leased_on, DateTime
-
+ property :photography_requested_on, DateTime, :serialize => :false
+
+ property :awesome_score, Fixnum
+ property :awesome_needs, Array, :serialize => :if_present
+ property :awesome_label, String
+
property :flyer_id, Fixnum, :serialize => :if_present
property :floorplan_id, Fixnum, :serialize => :if_present
@@ -154,7 +161,7 @@ def request_tour(account, tour={})
MLS::Tour.create(id, account, tour)
end
-
+
def create
MLS.post('/listings', {:listing => to_hash}, 201, 400) do |response, code|
raise MLS::Exception::UnexpectedResponse if ![201, 400].include?(code)
View
1  lib/mls/parser.rb
@@ -54,6 +54,7 @@ def method_missing(method, *args, &block)
def extract_attributes(data)
Yajl::Parser.new(:symbolize_keys => true).parse(data)
end
+
def self.extract_attributes(data)
Yajl::Parser.new(:symbolize_keys => true).parse(data)
end
View
2  mls.gemspec
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "mls"
- s.version = '0.5.5'
+ s.version = '0.5.6'
s.authors = ["James R. Bracy", "Jon Bracy"]
s.email = ["james@42floors.com"]
s.homepage = "http://mls.42floors.com"
Please sign in to comment.
Something went wrong with that request. Please try again.