piplapis-ruby 4.0.0 → 4.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/lib/pipl/fields.rb +21 -14
- data/lib/pipl/version.rb +1 -1
- metadata +2 -2
data/lib/pipl/fields.rb
CHANGED
@@ -191,6 +191,7 @@ module Pipl
|
|
191
191
|
|
192
192
|
end
|
193
193
|
|
194
|
+
|
194
195
|
class Phone < Field
|
195
196
|
# @!attribute country_code
|
196
197
|
# @return [Fixnum] International country calling code
|
@@ -242,6 +243,7 @@ module Pipl
|
|
242
243
|
|
243
244
|
end
|
244
245
|
|
246
|
+
|
245
247
|
class Email < Field
|
246
248
|
|
247
249
|
RE_EMAIL = Regexp.new('^[\w.%\-+]+@[\w.%\-]+\.[a-zA-Z]{2,6}$')
|
@@ -294,6 +296,7 @@ module Pipl
|
|
294
296
|
|
295
297
|
end
|
296
298
|
|
299
|
+
|
297
300
|
class Job < Field
|
298
301
|
|
299
302
|
attr_accessor :title, :organization, :industry, :date_range, :display
|
@@ -485,6 +488,7 @@ module Pipl
|
|
485
488
|
|
486
489
|
def age_range
|
487
490
|
if @date_range
|
491
|
+
return [self.age, self.age] unless @date_range.start and @date_range.end
|
488
492
|
start_age = DOB.new({date_range: Pipl::DateRange.new(@date_range.start, @date_range.start)}).age
|
489
493
|
end_age = DOB.new({date_range: Pipl::DateRange.new(@date_range.end, @date_range.end)}).age
|
490
494
|
return end_age, start_age
|
@@ -627,6 +631,7 @@ module Pipl
|
|
627
631
|
|
628
632
|
end
|
629
633
|
|
634
|
+
|
630
635
|
class OriginCountry < Field
|
631
636
|
|
632
637
|
attr_accessor :country
|
@@ -669,31 +674,29 @@ module Pipl
|
|
669
674
|
attr_reader :start, :end
|
670
675
|
|
671
676
|
def initialize(start, end_)
|
672
|
-
raise ArgumentError.new('Start/End parameters missing') unless start and end_
|
673
|
-
|
674
677
|
@start = start
|
675
678
|
@end = end_
|
676
|
-
if @start > @end
|
679
|
+
if @start and @end and @start > @end
|
677
680
|
@start, @end = @end, @start
|
678
681
|
end
|
679
682
|
end
|
680
683
|
|
681
|
-
def ==(other)
|
682
|
-
|
683
|
-
end
|
684
|
-
|
685
|
-
alias_method :eql?, :==
|
684
|
+
# def ==(other)
|
685
|
+
# other.instance_of?(self.class) and inspect == other.inspect
|
686
|
+
# end
|
687
|
+
#
|
688
|
+
# alias_method :eql?, :==
|
686
689
|
|
687
690
|
def is_exact?
|
688
|
-
@start == @end
|
691
|
+
@start and @end and @start == @end
|
689
692
|
end
|
690
693
|
|
691
694
|
def middle
|
692
|
-
@start + ((@end - @start) / 2)
|
695
|
+
@start and @end ? @start + ((@end - @start) / 2) : @start or @end
|
693
696
|
end
|
694
697
|
|
695
698
|
def years_range
|
696
|
-
|
699
|
+
[@start.year, @end.year] if @start and @end
|
697
700
|
end
|
698
701
|
|
699
702
|
def self.from_years_range(start_year, end_year)
|
@@ -702,12 +705,16 @@ module Pipl
|
|
702
705
|
|
703
706
|
def self.from_hash(h)
|
704
707
|
start_, end_ = h[:start], h[:end]
|
705
|
-
|
706
|
-
|
708
|
+
initializing_start = start_ ? Date.strptime(start_, Pipl::DATE_FORMAT) : nil
|
709
|
+
initializing_end = end_ ? Date.strptime(end_, Pipl::DATE_FORMAT) : nil
|
710
|
+
self.new(initializing_start, initializing_end)
|
707
711
|
end
|
708
712
|
|
709
713
|
def to_hash
|
710
|
-
|
714
|
+
h = {}
|
715
|
+
h[:start] = @start.strftime(Pipl::DATE_FORMAT) if @start
|
716
|
+
h[:end] = @end.strftime(Pipl::DATE_FORMAT) if @end
|
717
|
+
h
|
711
718
|
end
|
712
719
|
end
|
713
720
|
|
data/lib/pipl/version.rb
CHANGED
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: 4.0.
|
4
|
+
version: 4.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: 2015-
|
12
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|