mls 0.12.5 → 0.13.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: fc66ef17dac9f6b53dc4b5073aa0856432321333
4
- data.tar.gz: 1178562b07a00afb8cdcabd8cc49393926bca715
3
+ metadata.gz: 2038b3ee1f58d0c9b529c5ecfe3ef927af8068b8
4
+ data.tar.gz: 87d5a02cfa10037c074923202903c17f81c6211a
5
5
  SHA512:
6
- metadata.gz: cc198a68697a5760e5ae86801d1f829c4347d24d10a3824550047b4221b1016f4472802ba78ad7f1ae30d1953c3fd142884465856bac526aed6abbd66c35547d
7
- data.tar.gz: d3c999fff6742bf1b1064ead5b0aac6792bd0fc54fd7e5b9da2918eea1eccd97fa5f251df3b41ec4421d831546a4b3d031c19fb0ab05f79016e68fbfb35b8268
6
+ metadata.gz: 60cc8dba490166630d4c498828d2a5b2d82374a86bb496a7a409c65d172718bd1bc6cdd7da9e9e012c0c8c33e704636ab082244fdd4a24bdd8bcf1f47652a7d9
7
+ data.tar.gz: 659c7557d36e305f7fe8a5c79f328f7854dc2535608cd2daa3013f9d63b0dc7028a63aafd0506d72845f7b92f8ac660d1783740f9271b25cb8b8db24dbc6a43e
data/lib/mls.rb CHANGED
@@ -35,6 +35,7 @@ class MLS
35
35
  @url = URI.parse(uri)
36
36
  @api_key = CGI.unescape(@url.user)
37
37
  @host, @port = @url.host, @url.port
38
+ @ssl = (url.scheme == 'https')
38
39
  end
39
40
 
40
41
  # Sets the user agent so that MLS can distinguish between multiple users
@@ -50,7 +51,10 @@ class MLS
50
51
  # Returns the current connection to the MLS or if connection has been made
51
52
  # it returns a new connection
52
53
  def connection # TODO: testme
53
- @connection ||= Net::HTTP.new(@host, @port)
54
+ return @connection if @connection
55
+ @connection = Net::HTTP.new(@host, @port)
56
+ @connection.use_ssl = @ssl
57
+ @connection
54
58
  end
55
59
 
56
60
  # provides the asset host, if asset_host is set then it is returned,
@@ -365,12 +369,16 @@ class MLS
365
369
  raise MLS::Exception::BadRequest, response.body
366
370
  when 401
367
371
  raise MLS::Exception::Unauthorized, response.body
368
- when 404, 410
372
+ when 404
369
373
  raise MLS::Exception::NotFound
374
+ when 410
375
+ raise MLS::Exception::Gone
370
376
  when 422
371
377
  raise MLS::Exception::ApiVersionUnsupported, response.body
372
378
  when 503
373
379
  raise MLS::Exception::ServiceUnavailable, response.body
380
+ when 301
381
+ raise MLS::Exception::MovedPermanently, response.body
374
382
  when 300..599
375
383
  raise MLS::Exception, code
376
384
  end
@@ -13,6 +13,12 @@ end
13
13
  class MLS::Exception::NotFound < MLS::Exception
14
14
  end
15
15
 
16
+ class MLS::Exception::Gone < MLS::Exception
17
+ end
18
+
19
+ class MLS::Exception::MovedPermanently < MLS::Exception
20
+ end
21
+
16
22
  class MLS::Exception::ApiVersionUnsupported < MLS::Exception
17
23
  end
18
24
 
@@ -8,6 +8,12 @@ class MLS::Brokerage < MLS::Resource
8
8
  attribute :avatar_digest, String, :serialize => false
9
9
 
10
10
  class << self
11
+
12
+ def avatar(format='png', protocol='http')
13
+ if avatar_digest
14
+ "#{protocol}://assets.42floors.com/photos/original/#{avatar_digest}.png"
15
+ end
16
+ end
11
17
 
12
18
  def find(id)
13
19
  response = MLS.get("/brokerages/#{id}")
@@ -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.12.5'
6
+ s.version = '0.13.0'
7
7
  s.authors = ["James R. Bracy", "Jon Bracy"]
8
8
  s.email = ["james@42floors.com"]
9
9
  s.homepage = "http://mls.42floors.com"
@@ -24,13 +24,14 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'bundler'
25
25
  s.add_development_dependency 'minitest', '4.7.4'
26
26
  s.add_development_dependency 'turn'
27
- s.add_development_dependency 'faker'
28
- s.add_development_dependency 'factory_girl'
27
+ # s.add_development_dependency 'faker'
28
+ # s.add_development_dependency 'factory_girl'
29
29
  s.add_development_dependency 'fakeweb'
30
30
 
31
31
  # Runtime
32
32
  s.add_runtime_dependency 'activesupport'
33
33
  # the gem provides factories, so this is required as a runtime dependency
34
+ s.add_runtime_dependency 'faker'
34
35
  s.add_runtime_dependency 'factory_girl'
35
36
  s.add_runtime_dependency 'yajl-ruby'
36
37
  s.add_runtime_dependency 'rest-client'
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.12.5
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James R. Bracy
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-22 00:00:00.000000000 Z
12
+ date: 2014-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rdoc
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sdoc
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
@@ -85,112 +85,98 @@ dependencies:
85
85
  name: turn
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
- name: faker
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - '>='
103
- - !ruby/object:Gem::Version
104
- version: '0'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - '>='
110
- - !ruby/object:Gem::Version
111
- version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: factory_girl
99
+ name: fakeweb
114
100
  requirement: !ruby/object:Gem::Requirement
115
101
  requirements:
116
- - - '>='
102
+ - - ">="
117
103
  - !ruby/object:Gem::Version
118
104
  version: '0'
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
108
  requirements:
123
- - - '>='
109
+ - - ">="
124
110
  - !ruby/object:Gem::Version
125
111
  version: '0'
126
112
  - !ruby/object:Gem::Dependency
127
- name: fakeweb
113
+ name: activesupport
128
114
  requirement: !ruby/object:Gem::Requirement
129
115
  requirements:
130
- - - '>='
116
+ - - ">="
131
117
  - !ruby/object:Gem::Version
132
118
  version: '0'
133
- type: :development
119
+ type: :runtime
134
120
  prerelease: false
135
121
  version_requirements: !ruby/object:Gem::Requirement
136
122
  requirements:
137
- - - '>='
123
+ - - ">="
138
124
  - !ruby/object:Gem::Version
139
125
  version: '0'
140
126
  - !ruby/object:Gem::Dependency
141
- name: activesupport
127
+ name: faker
142
128
  requirement: !ruby/object:Gem::Requirement
143
129
  requirements:
144
- - - '>='
130
+ - - ">="
145
131
  - !ruby/object:Gem::Version
146
132
  version: '0'
147
133
  type: :runtime
148
134
  prerelease: false
149
135
  version_requirements: !ruby/object:Gem::Requirement
150
136
  requirements:
151
- - - '>='
137
+ - - ">="
152
138
  - !ruby/object:Gem::Version
153
139
  version: '0'
154
140
  - !ruby/object:Gem::Dependency
155
141
  name: factory_girl
156
142
  requirement: !ruby/object:Gem::Requirement
157
143
  requirements:
158
- - - '>='
144
+ - - ">="
159
145
  - !ruby/object:Gem::Version
160
146
  version: '0'
161
147
  type: :runtime
162
148
  prerelease: false
163
149
  version_requirements: !ruby/object:Gem::Requirement
164
150
  requirements:
165
- - - '>='
151
+ - - ">="
166
152
  - !ruby/object:Gem::Version
167
153
  version: '0'
168
154
  - !ruby/object:Gem::Dependency
169
155
  name: yajl-ruby
170
156
  requirement: !ruby/object:Gem::Requirement
171
157
  requirements:
172
- - - '>='
158
+ - - ">="
173
159
  - !ruby/object:Gem::Version
174
160
  version: '0'
175
161
  type: :runtime
176
162
  prerelease: false
177
163
  version_requirements: !ruby/object:Gem::Requirement
178
164
  requirements:
179
- - - '>='
165
+ - - ">="
180
166
  - !ruby/object:Gem::Version
181
167
  version: '0'
182
168
  - !ruby/object:Gem::Dependency
183
169
  name: rest-client
184
170
  requirement: !ruby/object:Gem::Requirement
185
171
  requirements:
186
- - - '>='
172
+ - - ">="
187
173
  - !ruby/object:Gem::Version
188
174
  version: '0'
189
175
  type: :runtime
190
176
  prerelease: false
191
177
  version_requirements: !ruby/object:Gem::Requirement
192
178
  requirements:
193
- - - '>='
179
+ - - ">="
194
180
  - !ruby/object:Gem::Version
195
181
  version: '0'
196
182
  description: Ruby library for integrating with the 42Floors MLS
@@ -200,7 +186,7 @@ executables: []
200
186
  extensions: []
201
187
  extra_rdoc_files: []
202
188
  files:
203
- - .gitignore
189
+ - ".gitignore"
204
190
  - Gemfile
205
191
  - README.rdoc
206
192
  - Rakefile
@@ -279,17 +265,17 @@ require_paths:
279
265
  - lib
280
266
  required_ruby_version: !ruby/object:Gem::Requirement
281
267
  requirements:
282
- - - '>='
268
+ - - ">="
283
269
  - !ruby/object:Gem::Version
284
270
  version: '0'
285
271
  required_rubygems_version: !ruby/object:Gem::Requirement
286
272
  requirements:
287
- - - '>='
273
+ - - ">="
288
274
  - !ruby/object:Gem::Version
289
275
  version: '0'
290
276
  requirements: []
291
277
  rubyforge_project: mls
292
- rubygems_version: 2.1.11
278
+ rubygems_version: 2.2.0
293
279
  signing_key:
294
280
  specification_version: 4
295
281
  summary: 42Floors MLS Client