pilbox 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pilbox.rb +30 -1
  3. data/lib/pilbox/version.rb +1 -1
  4. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12b3de46a2ffae7aab7700e96289f01ae385230b
4
- data.tar.gz: 4848979c4b5cfaa7b5428a7637af38253b0b0736
3
+ metadata.gz: 333e1e732714a5aaaed03800d2f29e886675d07b
4
+ data.tar.gz: 0a9b399c497e17c5101c38420025dab0b6130363
5
5
  SHA512:
6
- metadata.gz: 5bc4e243951a7bd9f5dfe2b8e8e830ecd6f1b2618e2430660c6efc61143863cd6cea606065db0abdf66b5d8d92dffbf254717ccf9a5fd26a682bf0759dc91ef8
7
- data.tar.gz: 4bc452d9cd77f72bf671af18e19c1b84f02f54f74f3680a0e5d1d88b9d83181aa81ab537de49e8ef5d8f69ca4b8d2e887e94fec43f8a0a20556ce904d3fd09c2
6
+ metadata.gz: f6d8a1fe71aac0253c82784a3c2dc0eba85d6dc68265847a113aa4eb63d8df1223033f08748f58e5927a05fd51559e71cddd13db643f101f0406c76c1eaab609
7
+ data.tar.gz: 1de75ed07b93a0355c5d306cfa7a7cb4b7e69031606844be0f2c0d0d54ffce94c5829575adbe561201944c4afbd56f22a2ada5b7c0c99af66a479b22830620ff
@@ -35,7 +35,8 @@ module Pilbox
35
35
  client_key = params.delete("client_key")
36
36
 
37
37
  original_params = CGI.parse(uri.query || "")
38
- uri.query = URI.encode_www_form(original_params.merge(params))
38
+
39
+ uri.query = encode_www_form(original_params.merge(params))
39
40
 
40
41
  if client_key
41
42
  signature = generate_signature(client_key, uri.query)
@@ -47,6 +48,34 @@ module Pilbox
47
48
 
48
49
  private
49
50
 
51
+ # This method is customized from URI.encode_www_form because we need
52
+ # some values not to be url-encoded.
53
+ #
54
+ def self.encode_www_form(enum, except = nil)
55
+ enum.map do |k,v|
56
+ if v.nil?
57
+ URI.encode_www_form_component(k)
58
+ elsif v.respond_to?(:to_ary)
59
+ v.to_ary.map do |w|
60
+ str = URI.encode_www_form_component(k)
61
+ unless w.nil?
62
+ str << '='
63
+ str << URI.encode_www_form_component(w)
64
+ end
65
+ end.join('&')
66
+ else
67
+ str = URI.encode_www_form_component(k)
68
+ str << '='
69
+
70
+ if "op" == k
71
+ str << URI.encode_www_form_component(v).gsub("%2C", ",")
72
+ else
73
+ str << URI.encode_www_form_component(v)
74
+ end
75
+ end
76
+ end.join('&')
77
+ end
78
+
50
79
  def self.generate_signature(client_key, query_string)
51
80
  OpenSSL::HMAC.hexdigest(
52
81
  OpenSSL::Digest.new("sha1"),
@@ -1,3 +1,3 @@
1
1
  module Pilbox
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pilbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Workman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-25 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,9 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.4.5
95
+ rubygems_version: 2.5.2
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: An URL-signing utility for Pilbox, the image resizing service.
99
99
  test_files: []
100
- has_rdoc: