Class: WCC::Arena::SignedPath
- Inherits:
-
Object
- Object
- WCC::Arena::SignedPath
- Defined in:
- lib/wcc/arena/signed_path.rb
Instance Attribute Summary collapse
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #api_sig ⇒ Object
- #call ⇒ Object
-
#initialize(args = {}) ⇒ SignedPath
constructor
A new instance of SignedPath.
- #path_with_session ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ SignedPath
Returns a new instance of SignedPath.
9 10 11 12 13 14 |
# File 'lib/wcc/arena/signed_path.rb', line 9 def initialize(args={}) @path = args.fetch(:path) @session_id = args.fetch(:session_id) @api_secret = args.fetch(:api_secret) @query = args.fetch(:query) { Hash.new } end |
Instance Attribute Details
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
7 8 9 |
# File 'lib/wcc/arena/signed_path.rb', line 7 def api_secret @api_secret end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/wcc/arena/signed_path.rb', line 7 def path @path end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
7 8 9 |
# File 'lib/wcc/arena/signed_path.rb', line 7 def query @query end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
7 8 9 |
# File 'lib/wcc/arena/signed_path.rb', line 7 def session_id @session_id end |
Instance Method Details
#api_sig ⇒ Object
30 31 32 |
# File 'lib/wcc/arena/signed_path.rb', line 30 def api_sig Digest::MD5.hexdigest("#{api_secret}_#{path_with_session.downcase}") end |
#call ⇒ Object
16 17 18 19 20 21 |
# File 'lib/wcc/arena/signed_path.rb', line 16 def call [ path_with_session, "api_sig=#{api_sig}", ].join("&") end |
#path_with_session ⇒ Object
23 24 25 26 27 28 |
# File 'lib/wcc/arena/signed_path.rb', line 23 def path_with_session [ path, URI.encode_www_form(query.merge(api_session: session_id)), ].join("?") end |