apartment_ratings 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/apartment_ratings.gemspec +1 -1
- data/lib/apartment_ratings.rb +13 -12
- data/lib/apartment_ratings/client.rb +1 -1
- data/lib/apartment_ratings/complex.rb +4 -4
- data/lib/apartment_ratings/review.rb +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/apartment_ratings.gemspec
CHANGED
data/lib/apartment_ratings.rb
CHANGED
@@ -4,29 +4,30 @@ require 'tnt'
|
|
4
4
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'apartment_ratings'))
|
5
5
|
|
6
6
|
module ApartmentRatings
|
7
|
-
autoload :Configuration, 'configuration'
|
8
|
-
autoload :Client, 'client'
|
9
|
-
autoload :Address, 'address'
|
10
|
-
autoload :Complex, 'complex'
|
11
|
-
autoload :Review, 'review'
|
12
|
-
autoload :Errors, 'errors'
|
13
|
-
|
14
7
|
module Reviews
|
15
8
|
autoload :Rating, 'reviews/rating'
|
16
9
|
autoload :Response, 'reviews/response'
|
17
10
|
end
|
18
11
|
|
12
|
+
require 'review'
|
13
|
+
require 'configuration'
|
14
|
+
require 'client'
|
15
|
+
require 'errors'
|
16
|
+
require 'address'
|
17
|
+
require 'complex'
|
18
|
+
|
19
|
+
|
19
20
|
class<<self
|
20
21
|
attr_reader :config
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.configure
|
24
|
-
@config = Configuration.new.tap { |configuration| yield(configuration) }
|
25
|
+
@config = ApartmentRatings::Configuration.new.tap { |configuration| yield(configuration) }
|
25
26
|
end
|
26
27
|
|
27
28
|
def self.credentials
|
28
29
|
if config.nil?
|
29
|
-
fail InvalidConfig
|
30
|
+
fail ApartmentRatings::Errors::InvalidConfig
|
30
31
|
else
|
31
32
|
config.select { |key, _| [:username, :password].include?(key) }
|
32
33
|
end
|
@@ -34,11 +35,11 @@ module ApartmentRatings
|
|
34
35
|
|
35
36
|
def self.client
|
36
37
|
@client ||= begin
|
37
|
-
fail Errors::InvalidConfig if config.nil?
|
38
|
+
fail ApartmentRatings::Errors::InvalidConfig if config.nil?
|
38
39
|
options = {
|
39
40
|
api_base_path: config.api_base_path
|
40
41
|
}
|
41
|
-
Client.new(options)
|
42
|
+
ApartmentRatings::Client.new(options)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
@@ -49,7 +50,7 @@ module ApartmentRatings
|
|
49
50
|
|
50
51
|
if !result['errors'].nil? && !result['errors']['serviceToken'].nil?
|
51
52
|
# Mostlikely the token expired, lets try to refresh it
|
52
|
-
fail Errors::InvalidToken unless errors_opts[:token] < ApartmentRatings.config.max_token_retry
|
53
|
+
fail ApartmentRatings::Errors::InvalidToken unless errors_opts[:token] < ApartmentRatings.config.max_token_retry
|
53
54
|
|
54
55
|
client.refresh_token
|
55
56
|
return post(url, params, headers, { token: (errors_opts[:token] + 1) }, &block)
|
@@ -16,9 +16,9 @@ module ApartmentRatings
|
|
16
16
|
property :percentageRecomanded
|
17
17
|
property :reviews
|
18
18
|
|
19
|
-
coerce_key :address, Address
|
20
|
-
coerce_key :averageRating, Hash[String => Reviews::Rating]
|
21
|
-
coerce_key :reviews, Set[Review]
|
19
|
+
coerce_key :address, ApartmentRatings::Address
|
20
|
+
coerce_key :averageRating, Hash[String => ApartmentRatings::Reviews::Rating]
|
21
|
+
coerce_key :reviews, Set[ApartmentRatings::Review]
|
22
22
|
|
23
23
|
def self.all
|
24
24
|
ApartmentRatings.post('index') do |result|
|
@@ -36,7 +36,7 @@ module ApartmentRatings
|
|
36
36
|
default_options = { id: id }
|
37
37
|
new default_options.merge(result)
|
38
38
|
else
|
39
|
-
fail Errors::InvalidComplexId.new(id, result['errorMessage'])
|
39
|
+
fail ApartmentRatings::Errors::InvalidComplexId.new(id, result['errorMessage'])
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -11,7 +11,7 @@ module ApartmentRatings
|
|
11
11
|
property :updated_at, from: :lastUpdatedDate
|
12
12
|
property :url
|
13
13
|
|
14
|
-
coerce_key :responses, Set[Reviews::Response]
|
15
|
-
coerce_key :rating, Hash[String => Reviews::Rating]
|
14
|
+
coerce_key :responses, Set[ApartmentRatings::Reviews::Response]
|
15
|
+
coerce_key :rating, Hash[String => ApartmentRatings::Reviews::Rating]
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apartment_ratings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -255,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
255
|
version: '0'
|
256
256
|
segments:
|
257
257
|
- 0
|
258
|
-
hash:
|
258
|
+
hash: 2934065606484445986
|
259
259
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
260
|
none: false
|
261
261
|
requirements:
|