Skip to content
Browse files

New image server.

  • Loading branch information...
1 parent 8c7a311 commit 3b91fc5031e5aaef8564377f352351c2ff6faee2 @waratuman waratuman committed Feb 25, 2013
View
1 README.rdoc
@@ -30,6 +30,7 @@ environment and want the photos to load.
#!ruby
MLS.asset_host = "assets.42floors.com"
+ MLS.image_host = "images.42floors.com"
== Bugs
View
6 lib/mls.rb
@@ -24,7 +24,7 @@ class MLS
API_VERSION = '0.1.0'
attr_reader :url, :user_agent
- attr_writer :asset_host, :listing_amenities, :address_amenities
+ attr_writer :asset_host, :image_host, :listing_amenities, :address_amenities
attr_accessor :api_key, :auth_key, :logger
# Sets the API Token and Host of the MLS Server
@@ -58,6 +58,10 @@ def connection # TODO: testme
def asset_host # TODO: testme
@asset_host ||= get('/asset_host').body
end
+
+ def image_host # TODO: testme
+ @asset_host ||= get('/image_host').body
+ end
def listing_amenities
@listing_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
View
4 lib/mls/models/address.rb
@@ -51,7 +51,7 @@ class MLS::Address < MLS::Resource
attr_accessor :listings, :listing_types, :photos, :videos
# should include an optional use address or no_image image
- def avatar(size='100x200', protocol='http')
+ def avatar(size='100x200#', protocol='http')
params = {
:size => size,
:format => 'png',
@@ -61,7 +61,7 @@ def avatar(size='100x200', protocol='http')
}
if avatar_digest
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
else
"#{protocol}://maps.googleapis.com/maps/api/streetview?" + params.map{|k,v| k.to_s + '=' + URI.escape(v.to_s) }.join('&')
end
View
4 lib/mls/models/floorplan.rb
@@ -12,8 +12,8 @@ def url(protocol='http')
"#{protocol}://#{MLS.asset_host}/floorplans/#{digest}/#{file_name}"
end
- def avatar(size='150x100', protocol='http')
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
+ def avatar(size='150x100#', protocol='http')
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
end
def self.create(attrs)
View
4 lib/mls/models/flyer.rb
@@ -12,8 +12,8 @@ def url(protocol='http')
"#{protocol}://#{MLS.asset_host}/flyers/#{digest}/#{file_name}"
end
- def avatar(size='150x100', protocol='http')
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
+ def avatar(size='150x100#', protocol='http')
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
end
def self.create(attrs)
View
4 lib/mls/models/listing.rb
@@ -69,9 +69,9 @@ class MLS::Listing < MLS::Resource
attr_accessor :address, :agents, :account, :photos, :flyer, :floorplan, :videos
attr_writer :amenities
- def avatar(size='150x100', protocol='http')
+ def avatar(size='150x100#', protocol='http')
if avatar_digest
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
else
address.avatar(size, protocol)
end
View
4 lib/mls/models/pdf.rb
@@ -5,8 +5,8 @@ class MLS::PDF < MLS::Resource
property :file_url, String
property :type, String
- def url(style='large', protocol='http')
- "#{protocol}://#{MLS.asset_host}/#{type}s/#{style}/#{@digest}.jpg"
+ def url(style='700x467#', protocol='http')
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
end
end
View
4 lib/mls/models/photo.rb
@@ -12,8 +12,8 @@ class MLS::Photo < MLS::Resource
property :url_template, String
property :caption, String
- def url(style='large', protocol='http')
- "#{protocol}://#{MLS.asset_host}/photos/#{style}/#{@digest}.jpg"
+ def url(style='700x467#', protocol='http')
+ "#{protocol}://#{MLS.image_host}/#{digest}.jpg?s=#{URI.escape(style)}"
end
def self.create(attrs)
View
1 lib/mls/models/tour_request.rb
@@ -64,7 +64,6 @@ def get_all_for_account
def find_by_token(token)
response = MLS.get("/tour_requests/#{token}")
- puts response.body
MLS::TourRequest::Parser.parse(response.body)
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.2.35'
+ s.version = '0.2.36'
s.authors = ["James R. Bracy", "Jon Bracy"]
s.email = ["james@42floors.com"]
s.homepage = "http://mls.42floors.com"

0 comments on commit 3b91fc5

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