embiggen 0.1.1 → 0.2.0
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 +4 -4
- data/README.md +3 -3
- data/lib/embiggen/uri.rb +2 -1
- data/spec/embiggen/uri_spec.rb +19 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e042af897bb6b3d3f859ef7f8b98b2baa82a549c
|
4
|
+
data.tar.gz: de3ac88d70c05591727ba4cbd291dea762add074
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52ea1b1bdd91f6d958ff730e94dafa63475794b28803743fce061980288bd9d75d80f1937eaad6c998d7b6b967daf9c274500e3fa6979f590a5044ec121f20b7
|
7
|
+
data.tar.gz: 920c7a714f80a7d75ade6a8982a68c6791bc4bfda7aca81e7956469a2d8ec0e1d92c9c71995577bf6ef319d2a45c62e352b8f4fe8ef415e1f88b39e33023c3c1
|
data/README.md
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
A Ruby library to expand shortened URLs.
|
4
4
|
|
5
|
-
**Current version:** 0.
|
5
|
+
**Current version:** 0.2.0
|
6
6
|
**Supported Ruby versions:** 1.8.7, 1.9.2, 1.9.3, 2.0, 2.1, 2.2
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
10
|
```
|
11
|
-
gem install embiggen -v '~> 0.
|
11
|
+
gem install embiggen -v '~> 0.2'
|
12
12
|
```
|
13
13
|
|
14
14
|
Or, in your `Gemfile`:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem 'embiggen', '~> 0.
|
17
|
+
gem 'embiggen', '~> 0.2'
|
18
18
|
```
|
19
19
|
|
20
20
|
## Usage
|
data/lib/embiggen/uri.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'embiggen/configuration'
|
2
|
+
require 'addressable/uri'
|
2
3
|
require 'net/http'
|
3
4
|
|
4
5
|
module Embiggen
|
@@ -6,7 +7,7 @@ module Embiggen
|
|
6
7
|
attr_reader :uri
|
7
8
|
|
8
9
|
def initialize(uri)
|
9
|
-
@uri =
|
10
|
+
@uri = URI(::Addressable::URI.parse(uri).normalize.to_s)
|
10
11
|
end
|
11
12
|
|
12
13
|
def expand(request_options = {})
|
data/spec/embiggen/uri_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'embiggen'
|
2
3
|
|
3
4
|
module Embiggen
|
@@ -30,6 +31,24 @@ module Embiggen
|
|
30
31
|
expect(uri.expand).to eq(URI('http://us.macmillan.com/books/9781466879980'))
|
31
32
|
end
|
32
33
|
|
34
|
+
it 'expands URIs with encoded locations' do
|
35
|
+
stub_redirect('http://bit.ly/1ciyUPh',
|
36
|
+
'http://www.example.com/%C3%A9%20%C3%BC')
|
37
|
+
|
38
|
+
uri = described_class.new('http://bit.ly/1ciyUPh')
|
39
|
+
|
40
|
+
expect(uri.expand).to eq(URI('http://www.example.com/%C3%A9%20%C3%BC'))
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'expands URIs with unencoded locations' do
|
44
|
+
stub_redirect('http://bit.ly/1ciyUPh',
|
45
|
+
'http://www.example.com/é ü')
|
46
|
+
|
47
|
+
uri = described_class.new('http://bit.ly/1ciyUPh')
|
48
|
+
|
49
|
+
expect(uri.expand).to eq(URI('http://www.example.com/%C3%A9%20%C3%BC'))
|
50
|
+
end
|
51
|
+
|
33
52
|
it 'does not expand unshortened URIs' do
|
34
53
|
uri = described_class.new(URI('http://www.altmetric.com'))
|
35
54
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embiggen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Mucur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: addressable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|