Skip to content
Browse files

Adding the Brokerage model.

  • Loading branch information...
1 parent 704b7b8 commit f2b9b06ef01b3ff45c1b40bfd44a48e6403e5d7a @waratuman waratuman committed Oct 22, 2013
Showing with 27 additions and 2 deletions.
  1. +1 −0 lib/mls.rb
  2. +24 −0 lib/mls/models/brokerage.rb
  3. +1 −1 mls.gemspec
  4. +1 −1 test/test_helper.rb
View
1 lib/mls.rb
@@ -438,6 +438,7 @@ def self.parse(json) # TODO: testme
require 'mls/models/flyer'
require 'mls/models/floorplan'
require 'mls/models/region'
+require 'mls/models/brokerage'
#factories
require 'mls/factories_helper'
View
24 lib/mls/models/brokerage.rb
@@ -0,0 +1,24 @@
+class MLS::Brokerage < MLS::Resource
+
+ property :id, Fixnum, :serialize => :if_present
+ property :name, String, :serialize => :if_present
+ property :admin_id, Fixnum, :serialize => :if_present
+
+ class << self
+
+ def find(id)
+ response = MLS.get("/brokerages/#{id}")
+ MLS::Brokerage::Parser.parse(response.body)
+ end
+
+ def all(options={})
+ response = MLS.get('/brokerages', options)
+ MLS::Brokerage::Parser.parse_collection(response.body)
+ end
+
+ end
+
+end
+
+class MLS::Brokerage::Parser < MLS::Parser
+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.9.9'
+ s.version = '0.10.0'
s.authors = ["James R. Bracy", "Jon Bracy"]
s.email = ["james@42floors.com"]
s.homepage = "http://mls.42floors.com"
View
2 test/test_helper.rb
@@ -16,7 +16,7 @@
CACHE = {}
MLS_HOST = ENV['MLS_URL'] || 'http://localhost:4000/api'
-MLS.url = ENV["MLS_TEST_URL"] || 'http://LBJXFC%2BhDiRRCYj6kXtXREfgNXRCJa8ALvPn%2FIeyjSe2QsQyHZ%2F%2BWwN2VZM2cw%3D%3D@localhost:4000'#
+MLS.url = ENV["MLS_TEST_URL"] || 'http://LBJXFC%2BhDiRRCYj6kXtXREfgNXRCJa8ALvPn%2FIeyjSe2QsQyHZ%2F%2BWwN2VZM2cw%3D%3D@localhost:5000'#
# MLS.auth_key = MLS::Account.authenticate('jonbracy@gmail.com', 'test').auth_key
# File 'lib/active_support/testing/declarative.rb', somewhere in rails....

0 comments on commit f2b9b06

Please sign in to comment.
Something went wrong with that request. Please try again.