apartment_ratings 1.0.1 → 1.1.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "apartment_ratings"
8
- s.version = "1.0.1"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["gregory"]
12
- s.date = "2014-09-25"
12
+ s.date = "2014-09-30"
13
13
  s.description = "Ruby client for ApartmentRating API"
14
14
  s.email = "greg2502@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -13,7 +13,7 @@ module ApartmentRatings
13
13
 
14
14
  property :apartmentRating
15
15
  property :averageRating
16
- property :percentageRecomanded
16
+ property :percentageRecommended
17
17
  property :reviews
18
18
 
19
19
  coerce_key :address, ApartmentRatings::Address
@@ -3,7 +3,7 @@ module ApartmentRatings
3
3
  include Hashie::Extensions::IndifferentAccess
4
4
  include Hashie::Extensions::Coercion
5
5
 
6
- property :datePosted
6
+ property :created_at, from: :datePosted
7
7
  property :text, from: :fullReviewText
8
8
  property :responses
9
9
  property :author, from: :reviewerScreenName
@@ -13,5 +13,9 @@ module ApartmentRatings
13
13
 
14
14
  coerce_key :responses, Set[ApartmentRatings::Reviews::Response]
15
15
  coerce_key :rating, Hash[String => ApartmentRatings::Reviews::Rating]
16
+
17
+ def avg_rating
18
+ rating.sum{|_, rating| rating.value.nil? ? 0 : rating.value } / [rating.keys.size, 1].max.to_f
19
+ end
16
20
  end
17
21
  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.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-25 00:00:00.000000000 Z
12
+ date: 2014-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -255,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
255
  version: '0'
256
256
  segments:
257
257
  - 0
258
- hash: 2934065606484445986
258
+ hash: -2538087811996024814
259
259
  required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  none: false
261
261
  requirements: