lib/simple_oauth.rb in simple_oauth-0.1.1 vs lib/simple_oauth.rb in simple_oauth-0.1.2

- old
+ new

@@ -5,11 +5,11 @@ module SimpleOAuth module Version MAJOR = 0 MINOR = 1 - PATCH = 1 + PATCH = 2 STRING = [MAJOR, MINOR, PATCH].join('.') end class Header ATTRIBUTE_KEYS = [:consumer_key, :nonce, :signature_method, :timestamp, :token, :version] @@ -22,11 +22,11 @@ :version => '1.0' } end def self.encode(value) - URI.encode(value.to_s, /[^\w\-\.\~]/) + URI.encode(value.to_s, /[^a-z0-9\-\.\_\~]/i) end def self.decode(value) URI.decode(value.to_s) end @@ -65,16 +65,16 @@ valid = options[:signature] == signature options.replace(original_options) valid end + def signed_attributes + attributes.merge(:oauth_signature => signature) + end + private def normalized_attributes signed_attributes.sort_by{|k,v| k.to_s }.map{|k,v| %(#{k}="#{self.class.encode(v)}") }.join(', ') - end - - def signed_attributes - attributes.merge(:oauth_signature => signature) end def attributes ATTRIBUTE_KEYS.inject({}){|a,k| options.key?(k) ? a.merge(:"oauth_#{k}" => options[k]) : a } end