mls 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d966f4641bdffc44263761b3feb02e298e21dca
4
- data.tar.gz: fcccc0fa5e8595beaa734bd44af6c4d04d0d7bca
3
+ metadata.gz: 394774786bfa36695f06cbc1629564bb3383a502
4
+ data.tar.gz: dcb908d31bea54620d9b2d225b5c1034032f039c
5
5
  SHA512:
6
- metadata.gz: cad4104cad88b181f74d4598bd693f1c9591ef1d39bd170468297b3e08f3c578d7c3edec24e15c5eb1087c3681a51e2dc7a665c3438d4bea1fb68f4260fb8856
7
- data.tar.gz: d0c8e5a94404263d58fa5adff8530b3bc21a00c140e1d3ac1cd4d9b4171ed0e8cc203131ddd4d58e331c341f077ce493a87c81652ec495d327264d4be809dd31
6
+ metadata.gz: ed460f3af42891c93935da8f8ec1aff84abd83b360b46f808b663f27429a38ad7eee636f9ad637d49092f56da729623b6be7a065a4728031205d3ede59e65a06
7
+ data.tar.gz: 2de742f1e7d57b0e200526e53940597b73eda2ab68da98cb106c7ae6002794a2f77bf3f086f7c159d8a2d5f3ddc64c4dc9e5a7f62330e439e9d6299b510fce6a
data/lib/mls/account.rb CHANGED
@@ -7,5 +7,10 @@ class Account < MLS::Model
7
7
  belongs_to :organization
8
8
 
9
9
  has_many :agencies, :inverse_of => :agent, :foreign_key => :agent_id
10
+ has_many :emails, :dependent => :destroy do
11
+ def primary
12
+ where(:primary => true).first
13
+ end
14
+ end
10
15
 
11
16
  end
@@ -0,0 +1,6 @@
1
+ class Comment < MLS::Model
2
+
3
+ belongs_to :account
4
+ belongs_to :subject, :polymorphic => true
5
+
6
+ end
data/lib/mls/email.rb ADDED
@@ -0,0 +1,8 @@
1
+ class Email < MLS::Model
2
+ self.inheritance_column = false
3
+
4
+ TYPES = %w(work personal other)
5
+
6
+ belongs_to :account
7
+
8
+ end
@@ -5,4 +5,6 @@ class LeadListing < MLS::Model
5
5
  belongs_to :lead
6
6
  belongs_to :property
7
7
 
8
+ has_many :comments, :as => :subject
9
+
8
10
  end
data/lib/mls/listing.rb CHANGED
@@ -4,7 +4,6 @@ class Listing < MLS::Model
4
4
  include MLS::Slugger
5
5
  include MLS::Avatar
6
6
 
7
- STATES = %w(processing visible invisible off_market expired)
8
7
  LEASE_STATES = %w(listed leased)
9
8
  SPACE_TYPES = %w(unit floor building)
10
9
  TYPES = %w(Sale Lease Sublease CoworkingSpace)
@@ -28,7 +27,7 @@ class Listing < MLS::Model
28
27
  has_many :photos, -> { order('photos.order ASC') }, :as => :subject, :inverse_of => :subject
29
28
 
30
29
  has_many :agencies, -> { order(:order) }, :as => :subject
31
- has_many :agents, :through => :agencies, :source => :agent
30
+ has_many :agents, -> { order('agencies.order') }, :through => :agencies, :source => :agent
32
31
 
33
32
  has_one :address
34
33
  has_many :addresses
data/lib/mls/property.rb CHANGED
@@ -15,8 +15,8 @@ class Property < MLS::Model
15
15
  has_one :address, -> { where(:primary => true) }
16
16
 
17
17
  def default_contact
18
- @default_contact ||= listings.where(lease_state: :listed, state: :visible)
19
- .where({ type: ['Lease', 'Sublease', 'Sale']})
18
+ @default_contact ||= listings.where(lease_state: :listed, ghost: false, authorized: true)
19
+ .where({ type: ['Lease', 'Sublease']})
20
20
  .order(size: :desc)
21
21
  .first.try(:contact)
22
22
  end
data/lib/mls.rb CHANGED
@@ -30,7 +30,7 @@ module MLS
30
30
  ensure
31
31
  Thread.current[:sunstone_cookie_store] = nil
32
32
  end
33
-
33
+
34
34
  end
35
35
 
36
36
  class MLS::Model < ActiveRecord::Base
@@ -38,11 +38,11 @@ class MLS::Model < ActiveRecord::Base
38
38
  end
39
39
 
40
40
  module MLS::Slugger
41
-
41
+
42
42
  extend ActiveSupport::Concern
43
-
43
+
44
44
  module ClassMethods
45
-
45
+
46
46
  def find(*args)
47
47
  friendly = -> (arg) { arg.respond_to?(:to_i) && arg.to_i.to_s != arg.to_s }
48
48
 
@@ -54,7 +54,7 @@ module MLS::Slugger
54
54
  end
55
55
 
56
56
  end
57
-
57
+
58
58
  def to_param
59
59
  slug
60
60
  end
@@ -88,6 +88,7 @@ end
88
88
 
89
89
  require 'mls/photo'
90
90
  require 'mls/account'
91
+ require 'mls/email'
91
92
  require 'mls/organization'
92
93
  require 'mls/property'
93
94
  require 'mls/region'
@@ -104,6 +105,7 @@ require 'mls/agency'
104
105
  require 'mls/session'
105
106
  require 'mls/floorplan'
106
107
  require 'mls/use'
108
+ require 'mls/comment'
107
109
 
108
110
  # Models
109
111
  # # Helpers
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 = '1.2.0'
6
+ s.version = '1.3.0'
7
7
  s.authors = ["Jon Bracy", "James R. Bracy"]
8
8
  s.email = ["jon@42floors.com", "james@42floors.com"]
9
9
  s.homepage = "http://mls.42floors.com"
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: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-28 00:00:00.000000000 Z
12
+ date: 2014-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -195,6 +195,8 @@ files:
195
195
  - lib/mls/account.rb
196
196
  - lib/mls/address.rb
197
197
  - lib/mls/agency.rb
198
+ - lib/mls/comment.rb
199
+ - lib/mls/email.rb
198
200
  - lib/mls/floorplan.rb
199
201
  - lib/mls/flyer.rb
200
202
  - lib/mls/inquiry.rb