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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b150b28348511e43fc3c4837d365e3e8c2cc4557
4
- data.tar.gz: b344f737d79576cba3e40630bb1a6ca94337339f
3
+ metadata.gz: d90a0c1c1f2b84eca4ea8e301db99aba0e552cda
4
+ data.tar.gz: 667625ed05e41665519c369c5f807d0e4ecff5bf
5
5
  SHA512:
6
- metadata.gz: c1b66fd4ccbd81608922f35b40b567562dda844d0bfc00b386f7a461f6e70e82a6bd2ad0d93a34d210607c2fa2d037f9b57cb1cc941987e8d271fee7316323cf
7
- data.tar.gz: 3319b17b71d9de2fac1a6ff2fa554f637a0cfb89888fb0394b4995734c6141a12f0bdfb0e49535795c59f8ad9cc20aadaba0ca5587da1fe538a60ca863fddbb6
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 { |l| parse_link(l) }.compact
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
@@ -14,7 +14,7 @@ require_relative 'ids_please/odnoklassniki'
14
14
 
15
15
  class IdsPlease
16
16
 
17
- VERSION = '1.0.4'
17
+ VERSION = '1.0.5'
18
18
 
19
19
  attr_accessor :original, :recognized, :unrecognized, :parsed
20
20
 
@@ -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].first).to eq('fb_acc')
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
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.0.14
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