pipl-api 2.0.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c697e18bae4c2053ae0748880ec12f9158a44139
4
- data.tar.gz: cd14044050efd45485cdd96ad1394aac3dcd4b71
3
+ metadata.gz: 277759755ec3306fb00f3cf1f318f4dc0ee1f1f5
4
+ data.tar.gz: 5b3810e03f302b94b929e2a101a55d9e8b844788
5
5
  SHA512:
6
- metadata.gz: d72a343c5f3da146421e3a611ccf2dbc3477ade8a23865c806d8d291f44ce010525712b77cf671151bc6e58963265b7031f4284b88e105cabc26c6d8ea017a22
7
- data.tar.gz: c7762721133551f86bc215eaa66d12f8a8a7286947ddcdbc46849a0c46dcb51bcc10091f59ea63e55a81bbeec01fcf6d648f2d3127f7ef88a9d939f7a0d95ee8
6
+ metadata.gz: efc50e0f04e19e9cb1d4975180981401c8be43b023c1394f1c73940b4b8e3ed155859718581cde470267e220e063ac9e6d3d53ef555255911a2f01d84a14a7cb
7
+ data.tar.gz: aa5f4b5f691e1fe1abdcd8c4f5d13844553c35909034b633d2e4431cb9efc49ce4028000e803c7fc951555cb316472adc38f2cba19b558b6104d48fdf5f24e03
@@ -25,19 +25,27 @@ module Pipl
25
25
  end
26
26
 
27
27
  def to_hash
28
- {
29
- name: name.to_hash,
30
- full_names: full_names.to_hash,
31
- nicknames: nicknames.to_hash,
32
- spellings: spellings.to_hash,
33
- translations: translations,
34
- gender: gender.to_hash,
35
- locations: locations.map(&:to_hash),
36
- ages: ages.map(&:to_hash),
37
- estimated_world_persons_count: estimated_world_persons_count
38
- }
28
+ [
29
+ :name, :full_names, :nicknames,
30
+ :spellings, :translations, :gender,
31
+ :locations, :ages, :estimated_world_persons_count
32
+ ].each do |accessor|
33
+ value = case send(accessor)
34
+ when Array then send(accessor).map(&:to_hash) if send(accessor).any?
35
+ when Integer then send(accessor) if send(accessor)
36
+ else send(accessor).to_hash if send(accessor)
37
+ end
38
+ { accessor => value }
39
+ end.inject(&:merge!)
39
40
  end
40
41
  alias_method :to_h, :to_hash
42
+
43
+
44
+ private
45
+
46
+ def nil_or_hash(subject)
47
+ subject.to_hash if subject
48
+ end
41
49
  end
42
50
  end
43
51
  end
@@ -1,5 +1,5 @@
1
1
  module Pipl
2
2
  module API
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipl-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-01 00:00:00.000000000 Z
11
+ date: 2013-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json