mls 0.2.35 → 0.2.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,7 @@ environment and want the photos to load.
30
30
 
31
31
  #!ruby
32
32
  MLS.asset_host = "assets.42floors.com"
33
+ MLS.image_host = "images.42floors.com"
33
34
 
34
35
  == Bugs
35
36
 
data/lib/mls.rb CHANGED
@@ -24,7 +24,7 @@ class MLS
24
24
  API_VERSION = '0.1.0'
25
25
 
26
26
  attr_reader :url, :user_agent
27
- attr_writer :asset_host, :listing_amenities, :address_amenities
27
+ attr_writer :asset_host, :image_host, :listing_amenities, :address_amenities
28
28
  attr_accessor :api_key, :auth_key, :logger
29
29
 
30
30
  # Sets the API Token and Host of the MLS Server
@@ -58,6 +58,10 @@ class MLS
58
58
  def asset_host # TODO: testme
59
59
  @asset_host ||= get('/asset_host').body
60
60
  end
61
+
62
+ def image_host # TODO: testme
63
+ @asset_host ||= get('/image_host').body
64
+ end
61
65
 
62
66
  def listing_amenities
63
67
  @listing_amenities ||= Yajl::Parser.new(:symbolize_keys => true)
@@ -51,7 +51,7 @@ class MLS::Address < MLS::Resource
51
51
  attr_accessor :listings, :listing_types, :photos, :videos
52
52
 
53
53
  # should include an optional use address or no_image image
54
- def avatar(size='100x200', protocol='http')
54
+ def avatar(size='100x200#', protocol='http')
55
55
  params = {
56
56
  :size => size,
57
57
  :format => 'png',
@@ -61,7 +61,7 @@ class MLS::Address < MLS::Resource
61
61
  }
62
62
 
63
63
  if avatar_digest
64
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
64
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
65
65
  else
66
66
  "#{protocol}://maps.googleapis.com/maps/api/streetview?" + params.map{|k,v| k.to_s + '=' + URI.escape(v.to_s) }.join('&')
67
67
  end
@@ -12,8 +12,8 @@ class MLS::Floorplan < MLS::Resource
12
12
  "#{protocol}://#{MLS.asset_host}/floorplans/#{digest}/#{file_name}"
13
13
  end
14
14
 
15
- def avatar(size='150x100', protocol='http')
16
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
15
+ def avatar(size='150x100#', protocol='http')
16
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
17
17
  end
18
18
 
19
19
  def self.create(attrs)
@@ -12,8 +12,8 @@ class MLS::Flyer < MLS::Resource
12
12
  "#{protocol}://#{MLS.asset_host}/flyers/#{digest}/#{file_name}"
13
13
  end
14
14
 
15
- def avatar(size='150x100', protocol='http')
16
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
15
+ def avatar(size='150x100#', protocol='http')
16
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
17
17
  end
18
18
 
19
19
  def self.create(attrs)
@@ -69,9 +69,9 @@ class MLS::Listing < MLS::Resource
69
69
  attr_accessor :address, :agents, :account, :photos, :flyer, :floorplan, :videos
70
70
  attr_writer :amenities
71
71
 
72
- def avatar(size='150x100', protocol='http')
72
+ def avatar(size='150x100#', protocol='http')
73
73
  if avatar_digest
74
- "#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
74
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
75
75
  else
76
76
  address.avatar(size, protocol)
77
77
  end
@@ -5,8 +5,8 @@ class MLS::PDF < MLS::Resource
5
5
  property :file_url, String
6
6
  property :type, String
7
7
 
8
- def url(style='large', protocol='http')
9
- "#{protocol}://#{MLS.asset_host}/#{type}s/#{style}/#{@digest}.jpg"
8
+ def url(style='700x467#', protocol='http')
9
+ "#{protocol}://#{MLS.image_host}/#{avatar_digest}.jpg?s=#{URI.escape(size)}"
10
10
  end
11
11
  end
12
12
 
@@ -12,8 +12,8 @@ class MLS::Photo < MLS::Resource
12
12
  property :url_template, String
13
13
  property :caption, String
14
14
 
15
- def url(style='large', protocol='http')
16
- "#{protocol}://#{MLS.asset_host}/photos/#{style}/#{@digest}.jpg"
15
+ def url(style='700x467#', protocol='http')
16
+ "#{protocol}://#{MLS.image_host}/#{digest}.jpg?s=#{URI.escape(style)}"
17
17
  end
18
18
 
19
19
  def self.create(attrs)
@@ -64,7 +64,6 @@ class MLS::TourRequest < MLS::Resource
64
64
 
65
65
  def find_by_token(token)
66
66
  response = MLS.get("/tour_requests/#{token}")
67
- puts response.body
68
67
  MLS::TourRequest::Parser.parse(response.body)
69
68
  end
70
69
 
@@ -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.2.35'
6
+ s.version = '0.2.36'
7
7
  s.authors = ["James R. Bracy", "Jon Bracy"]
8
8
  s.email = ["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: 0.2.35
4
+ version: 0.2.36
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-19 00:00:00.000000000 Z
13
+ date: 2013-02-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  version: '0'
284
284
  requirements: []
285
285
  rubyforge_project: mls
286
- rubygems_version: 1.8.24
286
+ rubygems_version: 1.8.23
287
287
  signing_key:
288
288
  specification_version: 3
289
289
  summary: 42Floors MLS Client