README.md in rongcloud-server-sdk-1.0.2 vs README.md in rongcloud-server-sdk-1.1.0

- old
+ new

@@ -58,10 +58,23 @@ http: { timeout_class: HTTP::Timeout::Global, timeout_options: {global_timeout: 5} } ) + +# Use the global HTTP timeout options. +rongcloud.api.user.gettoken({ + userId: "nutzer", name: "John Doe" +}) + +# Override global HTTP timeout options in a specific HTTP request. +rongcloud.api.user.gettoken({ + userId: "nutzer", name: "John Doe" +}, { + timeout_class: HTTP::Timeout::Global, + timeout_options: {global_timeout: 10} +}) ``` ### Logging ```ruby @@ -70,9 +83,37 @@ app_secret: ENV["RONGCLOUD_APP_SECRET"], host: "api-cn.ronghub.com", http: { features: { logging: {logger: Logger.new($stdout)} + } + } +) +``` + +### Request ID + +```ruby +class RequestID < HTTP::Feature + def wrap_request(req) + req.headers["X-Request-ID"] = make_request_id + req + end + + private + + def make_request_id + Thread.current[:request_id] || SecureRandom.uuid + end +end + +rongcloud = RongCloud::Client.new( + app_key: ENV["RONGCLOUD_APP_KEY"], + app_secret: ENV["RONGCLOUD_APP_SECRET"], + host: "api-cn.ronghub.com", + http: { + features: { + request_id: RequestID.new } } ) ```