Class: WEB_API::SignedMethod
- Inherits:
-
AuthMethod
- Object
- WebApiMethod
- AuthMethod
- WEB_API::SignedMethod
- Defined in:
- lib/web_api/signed.rb
Constant Summary
Constants inherited from WebApiMethod
WebApiMethod::OK, WebApiMethod::SCHEMES, WebApiMethod::SSL, WebApiMethod::TYPES
Instance Attribute Summary
Attributes inherited from AuthMethod
Attributes inherited from WebApiMethod
Instance Method Summary collapse
- #call(args) ⇒ Object
-
#headers(args) ⇒ Object
This modified from sferik’s mtgox gem’s MtGox::Request#headers.
Methods inherited from AuthMethod
Methods inherited from WebApiMethod
#arg_map, #args_map, #escape, #get, #http, #initialize, #kv_map, #parse, #pathquery, #post
Constructor Details
This class inherits a constructor from WEB_API::AuthMethod
Instance Method Details
#call(args) ⇒ Object
18 19 20 21 22 |
# File 'lib/web_api/signed.rb', line 18 def call(args) nonce = (Time.now.to_f * 1000000).to_i args.push( {:nonce => nonce} ) super(args) end |
#headers(args) ⇒ Object
This modified from sferik’s mtgox gem’s MtGox::Request#headers
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/web_api/signed.rb', line 5 def headers(args) signature = Base64.strict_encode64( OpenSSL::HMAC.digest 'sha512', Base64.decode64(auth[:secret]), data(args) ) headers = super(args) headers['Rest-Key'] = auth[:key] headers['Rest-Sign'] = signature Signed.trace.puts "headers:\n#{headers}" if Signed.trace return headers end |