libpixel 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +8 -0
- data/lib/libpixel/client.rb +9 -1
- data/lib/libpixel/version.rb +1 -1
- data/test/test_client.rb +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 371f5707b83500219bf589fec16a37d1390cd6e6
|
4
|
+
data.tar.gz: 6d1f6141025ec621708552bff558aa49c364c56b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6f2bc027f67b5c6cd43f3724f48b072c997ac1d76604e4e4b16c668f13efe90097c96c5016336b1bffb5a9760ebb72bac6c645a1e62a87a8f3c6111867af186
|
7
|
+
data.tar.gz: 8f5b3e5ac05bbf2cddc21a627311f6d5655cea7efe48f4117482c6e7e496dbac175b74f7d6c1c3020ab1e3a826ddf238fb10aa1bdf072a6daa376884d3d4aa5d
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
## [1.1.0] - 2015-08-12
|
6
|
+
### Changed
|
7
|
+
- Make path optional in LibPixel::Client#url [@matiaskorhonen](https://github.com/matiaskorhonen).
|
8
|
+
|
9
|
+
## [1.0.1] - 2015-08-11
|
10
|
+
### Fixed
|
11
|
+
- Set path default value to "/" in LibPixel::Client#url.
|
12
|
+
|
13
|
+
## [1.0.0] - 2015-08-11
|
14
|
+
### Added
|
15
|
+
- Initial release.
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# LibPixel
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/libpixel/libpixel-ruby.svg?branch=master)](https://travis-ci.org/libpixel/libpixel-ruby)
|
4
|
+
|
3
5
|
Ruby library to generate and sign LibPixel URLs.
|
4
6
|
|
5
7
|
## Installation
|
@@ -46,6 +48,12 @@ You can also generate and sign URLs at the same time with the `url` function:
|
|
46
48
|
url = LibPixel.url("/images/1.jpg", height: 400, blur: 20, saturation: -80)
|
47
49
|
```
|
48
50
|
|
51
|
+
If you're using the `src` parameter, you can skip the path:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
url = LibPixel.url(src: "http://...", width: 300)
|
55
|
+
```
|
56
|
+
|
49
57
|
### Multiple clients
|
50
58
|
|
51
59
|
It's also possible to have multiple instances of LibPixel clients (e.g. when dealing with multiple accounts):
|
data/lib/libpixel/client.rb
CHANGED
@@ -28,7 +28,15 @@ module LibPixel
|
|
28
28
|
uri.to_s
|
29
29
|
end
|
30
30
|
|
31
|
-
def url(
|
31
|
+
def url(path_or_options, options={})
|
32
|
+
path = nil
|
33
|
+
|
34
|
+
if path_or_options.respond_to? :fetch
|
35
|
+
options = path_or_options
|
36
|
+
else
|
37
|
+
path = path_or_options
|
38
|
+
end
|
39
|
+
|
32
40
|
path = "/" if path.nil? || path.empty?
|
33
41
|
query = options.map { |k,v| "#{k}=#{URI.encode_www_form_component(v)}" }.join("&")
|
34
42
|
|
data/lib/libpixel/version.rb
CHANGED
data/test/test_client.rb
CHANGED
@@ -68,6 +68,12 @@ describe LibPixel::Client do
|
|
68
68
|
assert_equal url, client.url("", src: "url")
|
69
69
|
assert_equal url, client.url(nil, src: "url")
|
70
70
|
end
|
71
|
+
|
72
|
+
it "sets the path to '/' if the path is omitted" do
|
73
|
+
client = LibPixel::Client.new(host: "test.libpx.com")
|
74
|
+
url = "http://test.libpx.com/?src=url"
|
75
|
+
assert_equal url, client.url(src: "url")
|
76
|
+
end
|
71
77
|
end
|
72
78
|
|
73
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libpixel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joao Carlos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
63
|
- ".travis.yml"
|
64
|
+
- CHANGELOG.md
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE
|
66
67
|
- README.md
|