ids_please 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fc61f2173fb750fec7df4b629a7ade28ea6ead0
4
- data.tar.gz: a502e562bcf87f2aa198f3a0553e6fd3f07850f5
3
+ metadata.gz: 8be9083e210f8b4df81b14c15e8ca7065cf5abd9
4
+ data.tar.gz: 369434e6de5f193aa1435be83e0f52b94b104f10
5
5
  SHA512:
6
- metadata.gz: 1a42ed0c14b29bae3cd13206b9e0baab7181f37d312cd6ce12d6e61e899b25c7c98f1716e718fd61da99a597ed16ddcb7bde30f7768a6d9e63064b1e66ce469a
7
- data.tar.gz: 4d83ac5bac217e9f57cc4f273e37af05757e47d702f8809114eedcc0d253b28783c8ba74c37432dc6b3aa763ac6688fe7871fd067a238ca8b2e3ee99b8caf937
6
+ metadata.gz: 49d8e1bd0da7ec6112ed78efc71502a7d91f1005ddca7cc2fd24617fb2da35769abe832dd2edbab2fd095d9a067b892219de15014cc1efd467e310ca4b22290e
7
+ data.tar.gz: 7f8bbbf422297eae40f64ae6ad17cc2246b2a640eb33cd5a1c19f0bbaf359b74378b1798d9a6b7017f62458228f8652ac3b69576b713471ad108b7014ac2d5d3
@@ -4,10 +4,12 @@ class IdsPlease
4
4
  MASK = /odnoklassniki/i
5
5
 
6
6
  def self.parse_link(link)
7
- if link.path =~ /\/profile\//
8
- link.path.split('/').last
9
- elsif link.path.split('/').size == 2
10
- link.path.split('/').last
7
+ if matched = link.path.match(/\/(\d{2,})/)
8
+ matched[1]
9
+ elsif link.path =~ /\/about\//
10
+ link.path.split('/')[-2]
11
+ elsif link.path.split('/').size >= 3
12
+ link.path.split('/')[2]
11
13
  end
12
14
  end
13
15
 
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.1'
17
+ VERSION = '1.0.2'
18
18
 
19
19
  attr_accessor :original, :recognized, :unrecognized, :parsed
20
20
 
@@ -14,6 +14,8 @@ describe IdsPlease do
14
14
  https://soundcloud.com/sc_acc
15
15
  https://youtube.com/channels/yb_acc
16
16
  http://tumblr-acc.tumblr.com
17
+ http://odnoklassniki.com/profile/12341234/about
18
+ http://odnoklassniki.com/group/43214321/about?some=123
17
19
  )
18
20
 
19
21
  not_recognazible_links = %w(
@@ -73,6 +75,10 @@ describe IdsPlease do
73
75
  expect(@recognizer.parsed[:tumblr].first).to eq('tumblr-acc')
74
76
  end
75
77
 
78
+ it 'get right id from odnoklassniki link' do
79
+ expect(@recognizer.parsed[:odnoklassniki]).to eq(['12341234', '43214321'])
80
+ end
81
+
76
82
  end
77
83
 
78
84
  end
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.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gazay