social_media_parser 0.1.1 → 0.1.2

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: 118b227b802b71eb23147a919b5757067a7a24f7
4
- data.tar.gz: 71fb3bb95e7224290f8df62f307bb15417b2fad8
3
+ metadata.gz: 81e1743fef080d76703d8f0ac2bbc1bc8a89d7da
4
+ data.tar.gz: 18e4525c15ccb56b71b6a72392d6588756e070ce
5
5
  SHA512:
6
- metadata.gz: c0d244c23a4389fdcc05a2292d3f12dce90bece65a6ae801fdabde663d79dcc88eb0618b8290002ab110003863fd138517e60e4fed2ecaa1eb7a67f12c801f07
7
- data.tar.gz: 97735b8243a2feaa95435e51b8aaca3541aedebbe7ec246af9e538e9be673295d78e9e6e5b58a6e4bf808bc569b4011a20052fccd011d48409475ec84dca247c
6
+ metadata.gz: 568853ad7b2cb1998b5662ee302065e41b5fe2bdd70ce55e2d34d6388a7e158cb566a462ff96f6063651b0467e85dc4ee2547bd5f3802d78d4102781a66766aa
7
+ data.tar.gz: b61fc4e3a7090d05ecc9b2008b39c6b5ee0a240136272710e8901747a37d0a7f33ca455d055a1c84d81d5c8e9f97192b521811e46cb9a7c7862dfaa3416470e6
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem "codeclimate-test-reporter", group: :test, require: nil
4
+
3
5
  # Specify your gem's dependencies in social_media_parser.gemspec
4
6
  gemspec
data/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Parse social media attributes from url or construct url from attributes.
4
4
 
5
- [![Code Climate](https://codeclimate.com/github/mynewsdesk/social_media_parser/badges/gpa.svg)](https://codeclimate.com/github/mynewsdesk/social_media_parser)
6
5
  [![Build Status](https://semaphoreapp.com/api/v1/projects/488b1479-a701-4807-956c-a0a513308163/237493/badge.png)](https://semaphoreapp.com/mynewsdesk/social_media_parser)
6
+ [![Code Climate](https://codeclimate.com/github/mynewsdesk/social_media_parser/badges/gpa.svg)](https://codeclimate.com/github/mynewsdesk/social_media_parser)
7
+ [![Test Coverage](https://codeclimate.com/github/mynewsdesk/social_media_parser/badges/coverage.svg)](https://codeclimate.com/github/mynewsdesk/social_media_parser)
7
8
 
8
9
  ## Installation
9
10
 
@@ -37,7 +38,7 @@ parser.url
37
38
  => "https://www.facebook.com/teamcoco"
38
39
  ```
39
40
 
40
- `SocialMediaParser#parse` accepts either a url string or a hash, that accepts
41
+ `SocialMediaParser.parse` accepts either a url string or a hash, that accepts
41
42
 
42
43
  ```ruby
43
44
  {
@@ -63,4 +64,8 @@ link.url
63
64
  => "http://www.ruby-lang.org/en/"
64
65
  ```
65
66
 
66
- The `url` method will always return a clean url, prepending http schema if needed and validating the top domain, using public_suffix.
67
+ The `url` method will always return a clean url, prepending http schema if needed and validating the top domain, using [public_suffix](https://github.com/weppos/publicsuffix-ruby).
68
+
69
+ ## Requirements
70
+
71
+ Ruby > 1.9
@@ -1,4 +1,5 @@
1
1
  require 'public_suffix'
2
+ require 'uri'
2
3
 
3
4
  module SocialMediaParser
4
5
  class Link
@@ -1,4 +1,5 @@
1
1
  require 'social_media_parser/link'
2
+ require 'uri'
2
3
 
3
4
  module SocialMediaParser
4
5
  module Provider
@@ -3,7 +3,7 @@ require 'social_media_parser/provider/base'
3
3
  module SocialMediaParser
4
4
  module Provider
5
5
  class Youtube < Base
6
- URL_REGEX = /(?:(?:http|https):\/\/)?(?:www.)?youtube\.com\/(?:user\/)([\w\-\.]{1,})/i
6
+ URL_REGEX = /(?:(?:http|https):\/\/)?(?:www.)?youtube\.com\/(?!channel|playlist)(?:user\/|)([\w\-\.]{1,})/i
7
7
 
8
8
  def provider
9
9
  'youtube'
@@ -1,3 +1,3 @@
1
1
  module SocialMediaParser
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -47,8 +47,8 @@ describe SocialMediaParser do
47
47
  expect(parser.username).to eq "collegehumor"
48
48
  end
49
49
 
50
- it "parses username from url without user" do
51
- parser = described_class.parse "https://www.youtube.com/user/collegehumor"
50
+ it "parses username from shortcut url" do
51
+ parser = described_class.parse "https://www.youtube.com/collegehumor"
52
52
  expect(parser.username).to eq "collegehumor"
53
53
  end
54
54
 
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  $:.push File.expand_path("../lib", __FILE__)
2
5
 
3
6
  require 'social_media_parser'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_media_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Nordin
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-20 00:00:00.000000000 Z
13
+ date: 2014-10-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: public_suffix