Class: OAuth1::Helper
- Inherits:
-
Object
- Object
- OAuth1::Helper
- Defined in:
- lib/viagogo/oauth1_helper.rb
Instance Attribute Summary collapse
-
#url_params ⇒ Object
readonly
Returns the value of attribute url_params.
Instance Method Summary collapse
- #append_signature_to_params ⇒ Object
- #full_url ⇒ Object
-
#initialize(method, url, params, options) ⇒ Helper
constructor
A new instance of Helper.
- #signature_base ⇒ Object
Constructor Details
#initialize(method, url, params, options) ⇒ Helper
Returns a new instance of Helper.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/viagogo/oauth1_helper.rb', line 11 def initialize(method, url, params, ) = { version: "1.0", signature_method: 'HMAC-SHA1', timestamp: Time.now.to_i.to_s, nonce: SecureRandom.uuid # token: "" }.merge() @consumer_secret = .delete(:consumer_secret) @token_secret = .delete(:token_secret) @url_params = params.merge(prepend_oauth_to_key()) @method = method.to_s.upcase @url = Addressable::URI.parse(url) end |
Instance Attribute Details
#url_params ⇒ Object (readonly)
Returns the value of attribute url_params.
9 10 11 |
# File 'lib/viagogo/oauth1_helper.rb', line 9 def url_params @url_params end |
Instance Method Details
#append_signature_to_params ⇒ Object
33 34 35 |
# File 'lib/viagogo/oauth1_helper.rb', line 33 def append_signature_to_params @url_params[:oauth_signature] = hmac_sha1_signature(key, signature_base) end |
#full_url ⇒ Object
37 38 39 40 |
# File 'lib/viagogo/oauth1_helper.rb', line 37 def full_url append_signature_to_params url_with_params.to_s end |
#signature_base ⇒ Object
27 28 29 30 31 |
# File 'lib/viagogo/oauth1_helper.rb', line 27 def signature_base @url_params.delete :oauth_signature # p @url_params, @url.to_s, url_with_params.query [@method, @url.to_s, url_with_params.query].map{|v| CGI.escape(v) }.join('&') end |