contacts_txt 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/contacts_txt.rb +20 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a2c14d80c95502b1db1c6aeb4687853807cba32
|
4
|
+
data.tar.gz: e7ed2b0253993915768a102bde50a3e033518e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 766950c9290b976600fd622a0c4763d982708e61cf6e85a93bf8d710c728283a7a3c638d145cb0be4f78814d6190f5bd01083ebe3bfbf78a61c0c4b220567124
|
7
|
+
data.tar.gz: 3708b321cfde13a3503c67bbf586f73a98d5a7876604a774d3663726737d6e2798d2d7cf1ffba81f2bf6365e562e812e862bcb9813f8fc13785f2ff420ce5ae6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/contacts_txt.rb
CHANGED
@@ -38,15 +38,33 @@ class ContactsTxt
|
|
38
38
|
@dx
|
39
39
|
end
|
40
40
|
|
41
|
+
def find_by_mobile(raw_number, countrycode='44')
|
42
|
+
|
43
|
+
number = Regexp.new number.sub(/^(?:0|#{countrycode})/,'').gsub(/ */,'')
|
44
|
+
|
45
|
+
@dx.all.find {|x| x.mobile.gsub(/ */,'') =~ number }
|
46
|
+
|
47
|
+
end
|
48
|
+
|
41
49
|
def find_by_name(raw_name)
|
42
50
|
|
43
|
-
name = Regexp.new raw_name
|
51
|
+
name = Regexp.new raw_name, Regexp::IGNORECASE
|
44
52
|
|
45
53
|
@dx.all.select do |x|
|
46
54
|
x.fullname =~ name or x.firstname =~ name or x.lastname =~ name
|
47
55
|
end
|
48
56
|
|
49
57
|
end
|
58
|
+
|
59
|
+
def find_by_sms(raw_number, countrycode='44')
|
60
|
+
|
61
|
+
number = Regexp.new raw_number\
|
62
|
+
.sub(/^(?:0|#{countrycode})/,'').gsub(/ */,'')
|
63
|
+
|
64
|
+
@dx.all.find {|x| x.sms.gsub(/ */,'') =~ number \
|
65
|
+
or x.mobile.gsub(/ */,'') =~ number }
|
66
|
+
|
67
|
+
end
|
50
68
|
|
51
69
|
# returns a Dynarex object
|
52
70
|
#
|
@@ -60,7 +78,7 @@ class ContactsTxt
|
|
60
78
|
|
61
79
|
def save(filename=@filename)
|
62
80
|
|
63
|
-
s = dx_to_s(@dx
|
81
|
+
s = dx_to_s(@dx)
|
64
82
|
File.write File.join(@path, filename), s
|
65
83
|
@dx.save File.join(@path, filename.sub(/\.txt$/,'.xml'))
|
66
84
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contacts_txt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
Ebw/4t8+mfs6ivuW6xdj3SlqhEXlfJ83mZuvJ3LtQteR5p0R8DSLcTXMkOrWD6wC
|
32
32
|
07GXbdChvjqXQg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-09-
|
34
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex
|
metadata.gz.sig
CHANGED
Binary file
|