Module: MLS::Avatar

Extended by:
ActiveSupport::Concern
Included in:
Account, Floorplan, Flyer, Listing, Organization, Property
Defined in:
lib/mls.rb

Instance Method Summary collapse

Instance Method Details

#avatar_url(options = {}) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mls.rb', line 72

def avatar_url(options={})
  options.reverse_merge!({
    :style => nil,
    :protocol => "http",
    :bg => nil,
    :format => "jpg"
  });

  url_params = {s: options[:style], bg: options[:bg]}.select{ |k, v| v }
  result = "#{options[:protocol]}://#{MLS.image_host}/#{avatar_digest}.#{options[:format]}"
  result += "?#{url_params.to_param}" if url_params.size > 0

  result
end