ids_please 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ids_please/base_parser.rb +9 -1
- data/lib/ids_please.rb +1 -1
- data/spec/ids_please/basic_spec.rb +3 -2
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d90a0c1c1f2b84eca4ea8e301db99aba0e552cda
|
4
|
+
data.tar.gz: 667625ed05e41665519c369c5f807d0e4ecff5bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6206c2a0c1346c60ec05a4c71a4724c4b64365aff5b948ff3e619bd0f4e6ae4f581cfc78638aa2dd2c7cd7aa20755eb39af6259c7e25935f9e07f31f1f50342
|
7
|
+
data.tar.gz: 59f5d650e8d5d7ee31a5e53c56170d3a21e9a7ae98735c431df777456cf2e29fc60156698a00a278845a855fb83cbabc317a9a41b4497240e83cedc579428195
|
@@ -6,7 +6,11 @@ class IdsPlease
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.parse(links)
|
9
|
-
links.map
|
9
|
+
links.map do |l|
|
10
|
+
id = parse_link(l)
|
11
|
+
matched_id = id.match(valid_id_regex)
|
12
|
+
matched_id[1] if matched_id
|
13
|
+
end.compact
|
10
14
|
end
|
11
15
|
|
12
16
|
private
|
@@ -15,5 +19,9 @@ class IdsPlease
|
|
15
19
|
link.path.split('/')[1]
|
16
20
|
end
|
17
21
|
|
22
|
+
def self.valid_id_regex
|
23
|
+
/\A([\w\.\+-]{2,})/
|
24
|
+
end
|
25
|
+
|
18
26
|
end
|
19
27
|
end
|
data/lib/ids_please.rb
CHANGED
@@ -5,6 +5,7 @@ describe IdsPlease do
|
|
5
5
|
describe 'recognize' do
|
6
6
|
recognazible_links = %w(
|
7
7
|
https://www.facebook.com/fb_acc
|
8
|
+
https://www.facebook.com/fb_acc2<U+200>
|
8
9
|
http://instagram.com/inst_acc
|
9
10
|
http://vk.com/vk_acc
|
10
11
|
https://twitter.com/twi_acc
|
@@ -40,7 +41,7 @@ describe IdsPlease do
|
|
40
41
|
end
|
41
42
|
|
42
43
|
it 'get right id from facebook link' do
|
43
|
-
expect(@recognizer.parsed[:facebook]
|
44
|
+
expect(@recognizer.parsed[:facebook]).to eq(['fb_acc', 'fb_acc2'])
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'get right id from instagram link' do
|
@@ -60,7 +61,7 @@ describe IdsPlease do
|
|
60
61
|
end
|
61
62
|
|
62
63
|
it 'get right id from google+ link' do
|
63
|
-
expect(@recognizer.parsed[:google_plus]).to eq(['12341234', 'VladimirBokov'])
|
64
|
+
expect(@recognizer.parsed[:google_plus]).to eq(['12341234', '+VladimirBokov'])
|
64
65
|
end
|
65
66
|
|
66
67
|
it 'get right id from soundcloud link' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ids_please
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gazay
|
@@ -14,42 +14,42 @@ dependencies:
|
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Helps to get ids or screen names from links to social network accounts
|
@@ -59,7 +59,7 @@ extensions: []
|
|
59
59
|
extra_rdoc_files:
|
60
60
|
- LICENSE
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE
|
65
65
|
- README.md
|
@@ -85,22 +85,22 @@ licenses:
|
|
85
85
|
metadata: {}
|
86
86
|
post_install_message:
|
87
87
|
rdoc_options:
|
88
|
-
- --charset=UTF-8
|
88
|
+
- "--charset=UTF-8"
|
89
89
|
require_paths:
|
90
90
|
- lib
|
91
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- -
|
98
|
+
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.2.2
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Helps to get ids or screen names from links to social network accounts
|