mls 1.3.0 → 1.4.0

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: 394774786bfa36695f06cbc1629564bb3383a502
4
- data.tar.gz: dcb908d31bea54620d9b2d225b5c1034032f039c
3
+ metadata.gz: cb4f1f49e4d47a1947018382340a4189a949fe96
4
+ data.tar.gz: 413f3241e6392a275e93ffbcbdc2e8ee9f5da48c
5
5
  SHA512:
6
- metadata.gz: ed460f3af42891c93935da8f8ec1aff84abd83b360b46f808b663f27429a38ad7eee636f9ad637d49092f56da729623b6be7a065a4728031205d3ede59e65a06
7
- data.tar.gz: 2de742f1e7d57b0e200526e53940597b73eda2ab68da98cb106c7ae6002794a2f77bf3f086f7c159d8a2d5f3ddc64c4dc9e5a7f62330e439e9d6299b510fce6a
6
+ metadata.gz: 7039ef61eedc1426662d6bbf3d52e7c308537f404a111c6e2f83fc1a8d36da2d328729e43c3678eb73a79a87070b2a3dcbf97d2b630d042733c1b76dac51be75
7
+ data.tar.gz: 3ec113f6972d240cfe47f04f1b4998ad5eeaa370d3ad1e8cd93e15ceb025bb25b6e971dd006a27edbeff7879dc74a2eacabbe67eaa1d03f86cb76537f932fb83
data/lib/mls.rb CHANGED
@@ -70,15 +70,24 @@ module MLS::Avatar
70
70
  end
71
71
 
72
72
  def avatar_url(options={})
73
+
73
74
  options.reverse_merge!({
74
75
  :style => nil,
75
- :protocol => "http",
76
76
  :bg => nil,
77
- :format => "jpg"
77
+ :protocol => 'https',
78
+ :format => "jpg",
79
+ :host => MLS.image_host
78
80
  });
79
81
 
80
- url_params = {s: options[:style], bg: options[:bg]}.select{ |k, v| v }
81
- result = "#{options[:protocol]}://#{MLS.image_host}/#{avatar_digest}.#{options[:format]}"
82
+ url_params = { s: options[:style], bg: options[:bg] }.select{ |k, v| v }
83
+
84
+ if options[:protocol] == :relative # Protocol Relative
85
+ result = '//'
86
+ else options[:protocol]
87
+ result = "#{options[:protocol]}://"
88
+ end
89
+
90
+ result += "#{options[:host]}/#{avatar_digest}.#{options[:format]}"
82
91
  result += "?#{url_params.to_param}" if url_params.size > 0
83
92
 
84
93
  result
data/lib/mls/account.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  class Account < MLS::Model
2
2
 
3
+ include MLS::Slugger
3
4
  include MLS::Avatar
4
5
 
5
6
  has_one :lead, foreign_key: :account_id
data/lib/mls/listing.rb CHANGED
@@ -16,7 +16,8 @@ class Listing < MLS::Model
16
16
  '/yr' => 'rate_per_year',
17
17
  }
18
18
  TERM_UNITS = ['years', 'months']
19
- AMENITIES = %W(kitchen showers patio reception ready_to_move_in furniture natural_light high_ceilings)
19
+ AMENITIES = %W(kitchen showers outdoor_space reception turnkey build_to_suit furniture
20
+ natural_light high_ceilings plug_and_play additional_storage storefront)
20
21
 
21
22
  belongs_to :property
22
23
  belongs_to :floorplan
@@ -24,7 +25,7 @@ class Listing < MLS::Model
24
25
 
25
26
  has_many :spaces
26
27
 
27
- has_many :photos, -> { order('photos.order ASC') }, :as => :subject, :inverse_of => :subject
28
+ has_many :photos, -> { order(:order => :asc) }, :as => :subject, :inverse_of => :subject
28
29
 
29
30
  has_many :agencies, -> { order(:order) }, :as => :subject
30
31
  has_many :agents, -> { order('agencies.order') }, :through => :agencies, :source => :agent
@@ -1,6 +1,9 @@
1
1
  class Organization < MLS::Model
2
2
  include MLS::Avatar
3
-
3
+ include MLS::Slugger
4
+
5
+ has_many :agents, :class_name => 'Account'
6
+
4
7
  def name
5
8
  common_name || legal_name
6
9
  end
data/lib/mls/photo.rb CHANGED
@@ -5,14 +5,26 @@ class Photo < MLS::Model
5
5
  def url(options={})
6
6
  options.reverse_merge!({
7
7
  :style => nil,
8
- :protocol => "http",
9
8
  :bg => nil,
10
- :format => "jpg"
9
+ :protocol => 'https',
10
+ :format => "jpg",
11
+ :host => MLS.image_host
11
12
  });
13
+
12
14
  url_params = {s: options[:style], bg: options[:bg]}.select{ |k, v| v }
13
- result = "#{options[:protocol]}://#{MLS.image_host}/#{digest}.#{options[:format]}"
15
+
16
+ if options[:protocol] == :relative # Protocol Relative
17
+ result = '//'
18
+ else options[:protocol]
19
+ result = "#{options[:protocol]}://"
20
+ end
21
+
22
+ result += "#{options[:host]}/#{digest}.#{options[:format]}"
14
23
  result += "?#{url_params.to_param}" if url_params.size > 0
15
24
 
16
25
  result
17
26
  end
18
- end
27
+ end
28
+
29
+
30
+ class InternalPhoto < Photo; end
data/lib/mls/property.rb CHANGED
@@ -8,11 +8,14 @@ class Property < MLS::Model
8
8
  has_many :listings
9
9
  has_many :localities
10
10
  has_many :regions, :through => :localities
11
- has_many :photos, -> { order('photos.order ASC') }, :as => :subject, :inverse_of => :subject
12
- # has_many :regions
11
+ has_many :photos, -> { where(:type => "Photo").order(:order => :asc) }, :as => :subject, :inverse_of => :subject
12
+ has_many :internal_photos, -> { order(:order => :asc) }, :as => :subject, :inverse_of => :subject
13
13
 
14
- has_many :addresses
15
- has_one :address, -> { where(:primary => true) }
14
+ has_many :addresses do
15
+ def primary
16
+ where(:primary => true).first
17
+ end
18
+ end
16
19
 
17
20
  def default_contact
18
21
  @default_contact ||= listings.where(lease_state: :listed, ghost: false, authorized: true)
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.3.0'
6
+ s.version = '1.4.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.3.0
4
+ version: 1.4.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-11-17 00:00:00.000000000 Z
12
+ date: 2014-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake