Class: Binance::Client::REST_FUTURE::TimestampRequestMiddleware
- Inherits:
-
Struct
- Object
- Struct
- Binance::Client::REST_FUTURE::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
21 22 23 |
# File 'lib/binance/client/rest/timestamp_request_middleware.rb', line 21 def app @app end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/binance/client/rest/timestamp_request_middleware.rb', line 22 def call(env) date = DateTime.now date = Time.at(date.to_time.to_f-$diff).to_datetime if !$diff.nil? env.url.query = REST_FUTURE.add_query_param( env.url.query, 'timestamp', date.strftime('%Q') ) app.call env end |