mls 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff09dafc90a6ff857a40f593ba4f0c978c36bb31
4
- data.tar.gz: ff991984c50826e07e700a37b67466632fc8be18
3
+ metadata.gz: 29b32b14a88b40ef3ba7e052b0b7879440e83082
4
+ data.tar.gz: 3301c63391f4d2d263d52de6365e2dd5b3263f12
5
5
  SHA512:
6
- metadata.gz: fac30e5dbb965e6f5de1db007f22c4121b0b08a1385bb61ad63510acd7b23840c25379d40f01f464162b119471f5654253d577b25936d75fb1cddf6b1e3c89b4
7
- data.tar.gz: 26ab3dcd0c351b104d55a887b78f1792b5cabe8a7d4b9f366f1db72f3227b620aad003d4e5ffd0f6a3aff3183c599fa0e1283043635dd66a2436c5f62d82db6b
6
+ metadata.gz: 2b93870aca8be84585b43c4a84770727d4e1f304ffa77bce61cc38733c5948b70a58097960d99dc109be9a4e0e81b3eec168be9c087d855e7cf70f6f633afeee
7
+ data.tar.gz: 534c1c533e91a10735594c4fa41ce3c479d051fec9079de033f63e878ac6348b61a6b31d393447dd751b937e90dc8fea7c3eabd4126d9f8d0a3cff5b8be5aaa3
@@ -153,9 +153,10 @@ class MLS::Listing < MLS::Resource
153
153
  end
154
154
 
155
155
  # TODO: remove /desk/mo conversions
156
- def rate(units='/sqft/mo')
156
+ def rate(units=nil)
157
157
  return nil if !@rate
158
-
158
+ units ||= rate_units
159
+
159
160
  price = if rate_units == '/sqft/mo'
160
161
  if units == '/sqft/mo'
161
162
  @rate
@@ -220,7 +221,7 @@ class MLS::Listing < MLS::Resource
220
221
  if units == '/sqft/mo'
221
222
  @rate / 200.0
222
223
  elsif units == '/sqft/yr'
223
- ((@rate / 200.0) * 12) / @size.to_f
224
+ (@rate * 12) / 200.0
224
225
  elsif units == '/mo'
225
226
  @rate
226
227
  elsif units == '/yr'
data/mls.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mls"
6
- s.version = '0.9.4'
6
+ s.version = '0.9.5'
7
7
  s.authors = ["James R. Bracy", "Jon Bracy"]
8
8
  s.email = ["james@42floors.com"]
9
9
  s.homepage = "http://mls.42floors.com"
@@ -194,7 +194,7 @@ class TestListing < ::Test::Unit::TestCase
194
194
  def test_rate_per_sqft_per_year
195
195
  listing = MLS::Listing.new(:rate => 126, :rate_units => '/sqft/yr', :size => 5)
196
196
 
197
- assert_equal 10.5, listing.rate
197
+ assert_equal 126, listing.rate
198
198
  assert_equal 10.5, listing.rate('/sqft/mo')
199
199
  assert_equal 126, listing.rate('/sqft/yr')
200
200
  assert_equal 52.5, listing.rate('/mo')
@@ -208,7 +208,7 @@ class TestListing < ::Test::Unit::TestCase
208
208
  def test_rate_per_month
209
209
  listing = MLS::Listing.new(:rate => 52.5, :rate_units => '/mo', :size => 5)
210
210
 
211
- assert_equal 10.5, listing.rate
211
+ assert_equal 52.5, listing.rate
212
212
  assert_equal 10.5, listing.rate('/sqft/mo')
213
213
  assert_equal 126, listing.rate('/sqft/yr')
214
214
  assert_equal 52.5, listing.rate('/mo')
@@ -222,7 +222,7 @@ class TestListing < ::Test::Unit::TestCase
222
222
  def test_rate_per_year
223
223
  listing = MLS::Listing.new(:rate => 630, :rate_units => '/yr', :size => 5)
224
224
 
225
- assert_equal 10.5, listing.rate
225
+ assert_equal 630, listing.rate
226
226
  assert_equal 10.5, listing.rate('/sqft/mo')
227
227
  assert_equal 126, listing.rate('/sqft/yr')
228
228
  assert_equal 52.5, listing.rate('/mo')
@@ -234,13 +234,13 @@ class TestListing < ::Test::Unit::TestCase
234
234
  end
235
235
 
236
236
  def test_rate_per_desk_per_month
237
- listing = MLS::Listing.new(:rate => 630, :rate_units => '/yr', :size => 5)
237
+ listing = MLS::Listing.new(:rate => 2100, :rate_units => '/desk/mo', :size => 5)
238
238
 
239
- assert_equal 10.5, listing.rate
239
+ assert_equal 2100, listing.rate
240
240
  assert_equal 10.5, listing.rate('/sqft/mo')
241
241
  assert_equal 126, listing.rate('/sqft/yr')
242
- assert_equal 52.5, listing.rate('/mo')
243
- assert_equal 630, listing.rate('/yr')
242
+ assert_equal 2100, listing.rate('/mo')
243
+ assert_equal 25200, listing.rate('/yr')
244
244
  assert_equal 2100, listing.rate('/desk/mo')
245
245
  assert_raises RuntimeError do
246
246
  listing.rate('/random')
@@ -250,7 +250,6 @@ class TestListing < ::Test::Unit::TestCase
250
250
  def test_rate_percision
251
251
  listing = MLS::Listing.new(:rate => 47, :rate_units => '/sqft/yr', :size => 5)
252
252
 
253
- assert_equal 3.92, listing.rate
254
253
  assert_equal 3.92, listing.rate('/sqft/mo')
255
254
  assert_equal 47, listing.rate('/sqft/yr')
256
255
  assert_equal 19.58, listing.rate('/mo')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James R. Bracy