mirror of
https://github.com/samsonjs/simple_oauth.git
synced 2026-04-26 14:47:46 +00:00
Use canonical method names in class
This commit is contained in:
parent
e951d6a892
commit
3d340dd4c0
1 changed files with 5 additions and 5 deletions
|
|
@ -21,7 +21,7 @@ module SimpleOAuth
|
||||||
def parse(header)
|
def parse(header)
|
||||||
header.to_s.sub(/^OAuth\s/, '').split(/,\s*/).inject({}) do |attributes, pair|
|
header.to_s.sub(/^OAuth\s/, '').split(/,\s*/).inject({}) do |attributes, pair|
|
||||||
match = pair.match(/^(\w+)\=\"([^\"]*)\"$/)
|
match = pair.match(/^(\w+)\=\"([^\"]*)\"$/)
|
||||||
attributes.merge(match[1].sub(/^oauth_/, '').to_sym => decode(match[2]))
|
attributes.merge(match[1].sub(/^oauth_/, '').to_sym => unescape(match[2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ module SimpleOAuth
|
||||||
private
|
private
|
||||||
|
|
||||||
def normalized_attributes
|
def normalized_attributes
|
||||||
signed_attributes.sort_by{|k,v| k.to_s }.map{|k,v| %(#{k}="#{self.class.encode(v)}") }.join(', ')
|
signed_attributes.sort_by{|k,v| k.to_s }.map{|k,v| %(#{k}="#{self.class.escape(v)}") }.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
def attributes
|
def attributes
|
||||||
|
|
@ -94,16 +94,16 @@ module SimpleOAuth
|
||||||
end
|
end
|
||||||
|
|
||||||
def secret
|
def secret
|
||||||
options.values_at(:consumer_secret, :token_secret).map{|v| self.class.encode(v) }.join('&')
|
options.values_at(:consumer_secret, :token_secret).map{|v| self.class.escape(v) }.join('&')
|
||||||
end
|
end
|
||||||
alias_method :plaintext_signature, :secret
|
alias_method :plaintext_signature, :secret
|
||||||
|
|
||||||
def signature_base
|
def signature_base
|
||||||
[method, url, normalized_params].map{|v| self.class.encode(v) }.join('&')
|
[method, url, normalized_params].map{|v| self.class.escape(v) }.join('&')
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalized_params
|
def normalized_params
|
||||||
signature_params.map{|p| p.map{|v| self.class.encode(v) } }.sort.map{|p| p.join('=') }.join('&')
|
signature_params.map{|p| p.map{|v| self.class.escape(v) } }.sort.map{|p| p.join('=') }.join('&')
|
||||||
end
|
end
|
||||||
|
|
||||||
def signature_params
|
def signature_params
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue