Class: Binance::Client::REST::TimestampRequestMiddleware
- Inherits:
-
Struct
- Object
- Struct
- Binance::Client::REST::TimestampRequestMiddleware
- Defined in:
- lib/binance/client/rest/timestamp_request_middleware.rb
Overview
Generate a timestamp in milliseconds and append to query string
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Instance Method Summary collapse
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app
7 8 9 |
# File 'lib/binance/client/rest/timestamp_request_middleware.rb', line 7 def app @app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/binance/client/rest/timestamp_request_middleware.rb', line 8 def call(env) date = DateTime.now date = Time.at(date.to_time.to_f-$diff).to_datetime if !$diff.nil? env.url.query = REST.add_query_param( env.url.query, 'timestamp', date.strftime('%Q') ) app.call env end |