oo_auth 1.0.1 → 1.0.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
- SHA1:
3
- metadata.gz: f44e251363fa6a3e04af50dbc4d52679750ea2c1
4
- data.tar.gz: ad34af2268abd94cda65a31c06c32d2530b6bc88
2
+ SHA256:
3
+ metadata.gz: 178f38351c6f267d456819463e4ca2c93926117870d861ec72e3ed29683b3a37
4
+ data.tar.gz: f1ac00838a7e75882e43b66e3375c1fa98dc53a2fcbbfe1b56318b3f1d6a67fe
5
5
  SHA512:
6
- metadata.gz: 59e9c9926872c7efaa36e45a6098692ade3417ba335b6b5f3eb186bcefd5a7da953366b89aad2122c08f4bc2b628288e507ff8b64bce735b4e9a695301dafb72
7
- data.tar.gz: 4e393b44327a8c313310b5c69226f776e83d1d027d4168e18769e2f0deec6e03f44ea0883425ee284168872d26a02b9d0f1b934632bbb037acfbd61827296e50
6
+ metadata.gz: b6ce16bde9a6ab1cd8d7efec77c37384bf638dd1b0a7fdb860fdbba53da60a52352beaeb2211f7a44df6507e3e18cfacfae9d82ee0e4c75eeae859613d5ba893
7
+ data.tar.gz: 327e56fb32b8bf427aa91729f03edb33809eba68282c4acd0c80c9405b88d9bf217a98e89ef41b9c4f189b17c0b4223bebcce7bc0f5269dcb5fc6c8696607103
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Gem Version](https://badge.fury.io/rb/oo_auth.png)](http://badge.fury.io/rb/oo_auth) [![Code Climate](https://codeclimate.com/github/mtgrosser/oo_auth.png)](https://codeclimate.com/github/mtgrosser/oo_auth)
1
+ [![Gem Version](https://badge.fury.io/rb/oo_auth.png)](http://badge.fury.io/rb/oo_auth) [![Build Status](https://travis-ci.org/mtgrosser/girocode.svg)](https://travis-ci.org/mtgrosser/girocode) [![Code Climate](https://codeclimate.com/github/mtgrosser/oo_auth.png)](https://codeclimate.com/github/mtgrosser/oo_auth)
2
2
 
3
3
  # oo_auth
4
4
 
@@ -78,13 +78,13 @@ module OoAuth
78
78
  #
79
79
  # See Also: {OAuth core spec version 1.0, section 5.1}[http://oauth.net/core/1.0#rfc.section.5.1]
80
80
  def escape(value)
81
- URI.escape(value.to_s, RESERVED_CHARACTERS)
81
+ uri_escape(value.to_s)
82
82
  rescue ArgumentError
83
- URI.escape(value.to_s.force_encoding(Encoding::UTF_8), RESERVED_CHARACTERS)
83
+ uri_escape(value.to_s.force_encoding(Encoding::UTF_8))
84
84
  end
85
85
 
86
86
  def unescape(value)
87
- URI.unescape(value.gsub('+', '%2B'))
87
+ URI.decode_www_form_component(value.gsub('+', '%2B'))
88
88
  end
89
89
 
90
90
  # cf. http://tools.ietf.org/html/rfc5849#section-3.4.1.1
@@ -124,6 +124,14 @@ module OoAuth
124
124
  authorization
125
125
  end
126
126
 
127
+ private
128
+
129
+ def uri_escape(string)
130
+ encoding = string.encoding
131
+ string.b.gsub(RESERVED_CHARACTERS) { |m|
132
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase }.force_encoding(encoding)
133
+ end
134
+
127
135
  end
128
136
 
129
137
  end
@@ -18,7 +18,7 @@ module OoAuth
18
18
  header = header.to_s
19
19
  return unless header.start_with?('OAuth ')
20
20
  # decompose
21
- params = header[6, header.length].split(',').inject({}) do |hsh, str|
21
+ header[6, header.length].split(',').inject({}) do |hsh, str|
22
22
  key, value = str.split('=').map { |s| OoAuth.unescape(s.strip) }
23
23
  if PARAMETERS.include?(key)
24
24
  hsh[key] = value.sub(/^\"(.*)\"$/, '\1')
@@ -1,3 +1,3 @@
1
1
  module OoAuth
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oo_auth
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
  - Matthias Grosser
@@ -118,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.4.5.1
121
+ rubygems_version: 3.0.3
123
122
  signing_key:
124
123
  specification_version: 4
125
124
  summary: OAuth without the callbacks