piplapis-ruby 5.0.0 → 5.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.
@@ -84,7 +84,7 @@ module Pipl
84
84
 
85
85
  unless opts.key? :search_pointer
86
86
  unless opts[:person] and opts[:person].is_searchable?
87
- raise ArgumentError.new('At least one valid name/username/phone/email is required for search')
87
+ raise ArgumentError.new('No valid name/username/user_id/phone/email/address or search pointer in request')
88
88
  end
89
89
  end
90
90
 
@@ -279,7 +279,10 @@ module Pipl
279
279
  @names.any? { |f| f.is_searchable? } or
280
280
  @emails.any? { |f| f.is_searchable? } or
281
281
  @phones.any? { |f| f.is_searchable? } or
282
- @usernames.any? { |f| f.is_searchable? }
282
+ @usernames.any? { |f| f.is_searchable? } or
283
+ @user_ids.any? { |f| f.is_searchable? } or
284
+ @urls.any? { |f| f.is_searchable? } or
285
+ @addresses.any? { |f| f.is_sole_searchable? }
283
286
  end
284
287
 
285
288
  def unsearchable_fields
@@ -161,7 +161,11 @@ module Pipl
161
161
  end
162
162
 
163
163
  def is_searchable?
164
- [@raw, @country, @state, @city].any? {|x| x and not x.empty?}
164
+ [@raw, @country, @state, @city].any? {|x| not x.to_s.empty?}
165
+ end
166
+
167
+ def is_sole_searchable?
168
+ not @raw.to_s.empty? or [@city, @street, @house].all? {|x| not x.to_s.empty?}
165
169
  end
166
170
 
167
171
  def country_full
@@ -424,7 +428,7 @@ module Pipl
424
428
  end
425
429
 
426
430
  def is_searchable?
427
- @content and Pipl::Utils.alnum_chars(@content).length > 3
431
+ !@content.nil? and Pipl::Utils.alnum_chars(@content).length > 3
428
432
  end
429
433
 
430
434
  end
@@ -433,7 +437,7 @@ module Pipl
433
437
  class UserID < Username
434
438
 
435
439
  def is_searchable?
436
- false
440
+ not /.+@.+/.match(@content).nil?
437
441
  end
438
442
 
439
443
  end
@@ -554,6 +558,10 @@ module Pipl
554
558
  [:category, :domain, :name, :sponsored, :source_id]
555
559
  end
556
560
 
561
+ def is_searchable?
562
+ not @url.to_s.empty?
563
+ end
564
+
557
565
  end
558
566
 
559
567
 
@@ -1,3 +1,3 @@
1
1
  module Pipl
2
- VERSION = '5.0.0'.freeze
2
+ VERSION = '5.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piplapis-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
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: 2016-02-11 00:00:00.000000000 Z
12
+ date: 2016-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler